Update ai-projects SDK samples to use agent endpoint for agent responses and conversa…#47686
Open
luigiw wants to merge 1 commit into
Open
Update ai-projects SDK samples to use agent endpoint for agent responses and conversa…#47686luigiw wants to merge 1 commit into
luigiw wants to merge 1 commit into
Conversation
Contributor
There was a problem hiding this comment.
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=TruetoAIProjectClientconstruction in the affected samples (where not already present). - Replace
project_client.get_openai_client()withproject_client.get_openai_client(agent_name=...), either inline in thewithheader or as a separateagent_clientwhen a project-scoped client is still needed. - Remove the now-redundant
extra_body={"agent_reference": ...}fromresponses.create()/conversations.create()calls, while preserving otherextra_bodykeys such asstructured_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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
…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:
General Guidelines and Best Practices
Testing Guidelines