Skip to content

Update ai-projects SDK samples to use agent endpoint for agent responses and conversa…#47686

Open
luigiw wants to merge 1 commit into
Azure:mainfrom
luigiw:hancwang/agent-endpoint
Open

Update ai-projects SDK samples to use agent endpoint for agent responses and conversa…#47686
luigiw wants to merge 1 commit into
Azure:mainfrom
luigiw:hancwang/agent-endpoint

Conversation

@luigiw

@luigiw luigiw commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

…tions calls

Description

Please add an informative description that covers that changes made by the pull request and link all relevant issues.

If an SDK is being regenerated based on a new API spec, a link to the pull request containing these API spec changes should be included above.

All SDK Contribution checklist:

  • The pull request does not introduce [breaking changes]
  • CHANGELOG is updated for new features, bug fixes or other significant changes.
  • I have read the contribution guidelines.

General Guidelines and Best Practices

  • Title of the pull request is clear and informative.
  • There are a small number of commits, each of which have an informative message. This means that previously merged commits do not appear in the history of the PR. For more information on cleaning up the commits in your PR, see this page.

Testing Guidelines

  • Pull request includes test coverage for the included changes.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the azure-ai-projects SDK samples so that Responses and Conversations calls are routed through an agent-scoped OpenAI client (get_openai_client(agent_name=...)) instead of identifying the agent inline via extra_body={"agent_reference": ...}. This aligns the samples with the agent-endpoint routing behavior of the client, where agent_name points the client's base_url at the agent's endpoint and requires allow_preview=True.

Changes:

  • Add allow_preview=True to AIProjectClient construction in the affected samples (where not already present).
  • Replace project_client.get_openai_client() with project_client.get_openai_client(agent_name=...), either inline in the with header or as a separate agent_client when a project-scoped client is still needed.
  • Remove the now-redundant extra_body={"agent_reference": ...} from responses.create()/conversations.create() calls, while preserving other extra_body keys such as structured_inputs.
Show a summary per file
File Description
samples/hosted_agents/sample_skill_in_toolbox.py Use agent_name=AGENT_NAME client; drop agent_reference
samples/evaluations/sample_continuous_evaluation_rule.py Add agent-scoped agent_client; keep openai_client for evals
samples/evaluations/sample_agent_response_evaluation.py Add agent-scoped agent_client for responses/conversations
samples/evaluations/sample_agent_response_evaluation_with_function_tool.py Add agent-scoped agent_client; keep openai_client for evals
samples/datasets/sample_dataset_generation_job_traces_for_finetuning.py Add agent_client; keep openai_client for file ops
samples/datasets/sample_dataset_generation_job_traces_for_evaluation.py Single agent-scoped client for seeding traces
samples/agents/tools/sample_toolboxes_with_search_preview*.py Agent-scoped client; drop agent_reference
samples/agents/tools/sample_agent_work_iq*.py Agent-scoped client; drop agent_reference
samples/agents/tools/sample_agent_web_search*.py Agent-scoped client; drop agent_reference
samples/agents/tools/sample_agent_to_agent.py Agent-scoped client; drop agent_reference
samples/agents/tools/sample_agent_sharepoint.py Agent-scoped client; drop agent_reference
samples/agents/tools/sample_agent_openapi*.py Agent-scoped client; drop agent_reference
samples/agents/tools/sample_agent_memory_search*.py Agent-scoped client; drop agent_reference
samples/agents/tools/sample_agent_mcp*.py Agent-scoped client; drop agent_reference
samples/agents/tools/sample_agent_image_generation*.py Agent-scoped client; keep extra_headers
samples/agents/tools/sample_agent_function_tool*.py Agent-scoped client; drop agent_reference
samples/agents/tools/sample_agent_file_search*.py Add agent_client; keep openai_client for vector store/files
samples/agents/tools/sample_agent_fabric*.py Agent-scoped client; drop agent_reference
samples/agents/tools/sample_agent_computer_use*.py Agent-scoped client; keep truncation
samples/agents/tools/sample_agent_code_interpreter*.py Agent-scoped client; preserve structured_inputs
samples/agents/tools/sample_agent_browser_automation.py Agent-scoped client; drop agent_reference
samples/agents/tools/sample_agent_bing_*.py Agent-scoped client; drop agent_reference
samples/agents/tools/sample_agent_azure_function.py Agent-scoped client; drop agent_reference
samples/agents/tools/sample_agent_ai_search.py Agent-scoped client; drop agent_reference
samples/agents/telemetry/sample_agent_basic_with_*_tracing.py Agent-scoped client; drop agent_reference
samples/agents/sample_workflow_multi_agent*.py Workflow-scoped client via agent_name
samples/agents/sample_agent_structured_output*.py Agent-scoped client; drop agent_reference
samples/agents/sample_agent_stream_events.py Agent-scoped client; drop agent_reference
samples/agents/sample_agent_retrieve_basic*.py Agent-scoped client via yielded agent_name
samples/agents/sample_agent_basic*.py Agent-scoped client; drop agent_reference

Review details

  • Files reviewed: 58/58 changed files
  • Comments generated: 0
  • Review effort level: Medium

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants