Repository navigation
Python: Replace references to removed ChatAgent and Responses client classes - #9754
Naveen Chatlapalli (1aifanatic) wants to merge 2 commits into
Conversation
…classes ChatAgent became Agent and OpenAIResponsesClient / AzureOpenAIResponsesClient were folded into OpenAIChatClient, but several docstrings and two error messages still name the old classes. The A2AExecutor example fails with ImportError as written. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
🟢 Approval recommended
The text-only replacements match the current APIs and introduce no blocking issues; remaining documentation cleanup is non-blocking.
1 open issue
What changed in this PR
Updates stale Python API references following the ChatAgent rename and removal of deprecated Responses clients in #3747 and #4990. Changes affect documentation, sample comments, and error-message text only.
Changes:
- Replace removed class names with
AgentandOpenAIChatClient, including imports and keyword arguments in examples. - Clarify Azure OpenAI compatibility in file-search documentation.
- Update MCP error guidance to recommend an
Agentwith a chat client.
| File | Description |
|---|---|
python/samples/03-workflows/parallelism/fan_out_fan_in_edges.py |
Corrects the AgentExecutor explanatory comment. |
python/packages/openai/agent_framework_openai/_chat_completion_client.py |
Updates web-search documentation and its agent example. |
python/packages/openai/agent_framework_openai/_chat_client.py |
Updates five hosted-tool examples and return descriptions. |
python/packages/github_copilot/agent_framework_github_copilot/_agent.py |
Replaces the removed agent name in MCP error guidance. |
python/packages/claude/agent_framework_claude/_agent.py |
Replaces the removed agent name in MCP error guidance. |
python/packages/azure-contentunderstanding/agent_framework_azure_contentunderstanding/_file_search.py |
Documents the current client and Azure endpoint support. |
python/packages/anthropic/agent_framework_anthropic/_chat_client.py |
Updates hosted-tool return descriptions to name Agent. |
python/packages/a2a/agent_framework_a2a/_a2a_executor.py |
Uses OpenAIChatClient in the executor example. |
Review effort: Balanced
|
|
||
| # Use with agent | ||
| agent = ChatAgent(client, tools=[tool]) | ||
| agent = Agent(client=client, tools=[tool]) |
There was a problem hiding this comment.
Fixed in this PR rather than a follow-up, since these are the same examples it touches. All six now pass OpenAIChatClient() / OpenAIChatCompletionClient() to Agent. Checked by extracting each example from the docstring and running it with OPENAI_API_KEY/OPENAI_MODEL set: every one builds an agent with the tool attached.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Motivation & Context
ChatAgentwas renamed toAgentin #3747.OpenAIResponsesClientandAzureOpenAIResponsesClientwere folded intoOpenAIChatClientin #4990, which removed the deprecated surfaces. Some docstrings and two error messages still name the old classes:mainA2AExecutordocstring examplefrom agent_framework.openai import OpenAIResponsesClientImportErrorOpenAIFileSearchBackenddocstring (content understanding)OpenAIChatClientorAzureOpenAIResponsesClient"OpenAIChatClienthosted-tool helpers (5 docstrings)agent = ChatAgent(client, tools=[tool])ChatAgentis not definedOpenAIChatCompletionClient.get_web_search_toolAnthropicClienthosted-tool helpers (3 docstrings)ClaudeAgent/GitHubCopilotAgentMCP-tool error messagessamples/03-workflows/parallelism/fan_out_fan_in_edges.pyDescription & Review Guide
OpenAIChatClientreplacesOpenAIResponsesClient. For the file-search backend, the docstring now notes that it also works whenOpenAIChatClienttargets Azure OpenAI throughazure_endpoint.Agent(client=client, tools=[tool]), with an addedfrom agent_framework import Agent, replacesChatAgent(client, tools=[tool]).With the fix, the A2A example builds its Starlette app (2 routes) using the installed
a2aSDK. Onmainit stops at the import. The claude, github_copilot and a2a test suites pass (540 passed, 6 skipped). I found these by type-checking the docstring examples, then searching for the other renamed classes.Related Issue
N/A - trivial change: references to classes removed by #3747 and #4990 are updated to their documented replacements.
AI Assistance
AI assistance details: Claude Code helped find the stale names by type-checking docstring examples and searching for renamed classes, make the edits, and draft this description.
Contribution Checklist
breaking changelabel (or add "[BREAKING]" to the title prefix, before or after any language prefix) — a workflow keeps the label and title prefix in sync automatically.🤖 Generated with Claude Code