Skip to content

Python: Replace references to removed ChatAgent and Responses client classes - #9754

Draft
Naveen Chatlapalli (1aifanatic) wants to merge 2 commits into
microsoft:mainfrom
1aifanatic:contrib/python-removed-class-references
Draft

Naveen Chatlapalli (1aifanatic) wants to merge 2 commits into
microsoft:mainfrom
1aifanatic:contrib/python-removed-class-references

Conversation

@1aifanatic

Copy link
Copy Markdown
Contributor

Motivation & Context

ChatAgent was renamed to Agent in #3747. OpenAIResponsesClient and AzureOpenAIResponsesClient were folded into OpenAIChatClient in #4990, which removed the deprecated surfaces. Some docstrings and two error messages still name the old classes:

where old reference on main
A2AExecutor docstring example from agent_framework.openai import OpenAIResponsesClient ImportError
OpenAIFileSearchBackend docstring (content understanding) "Use with OpenAIChatClient or AzureOpenAIResponsesClient" names a class that no longer exists
OpenAIChatClient hosted-tool helpers (5 docstrings) agent = ChatAgent(client, tools=[tool]) ChatAgent is not defined
OpenAIChatCompletionClient.get_web_search_tool same same
AnthropicClient hosted-tool helpers (3 docstrings) "ready to pass to ChatAgent" stale name
ClaudeAgent / GitHubCopilotAgent MCP-tool error messages "or use a ChatAgent, where the framework owns the connection" tells users to reach for a removed class
samples/03-workflows/parallelism/fan_out_fan_in_edges.py comment "Wraps a ChatAgent" stale name

Description & Review Guide

  • What are the major changes? Text-only replacements:
    • OpenAIChatClient replaces OpenAIResponsesClient. For the file-search backend, the docstring now notes that it also works when OpenAIChatClient targets Azure OpenAI through azure_endpoint.
    • Agent(client=client, tools=[tool]), with an added from agent_framework import Agent, replaces ChatAgent(client, tools=[tool]).
    • The error messages now say "use an Agent with a chat client".
  • What is the impact of these changes? Docs and error-message text only. No behavior changes, and no tests assert on the old wording.
  • What do you want reviewers to focus on? The error-message wording.

With the fix, the A2A example builds its Starlette app (2 routes) using the installed a2a SDK. On main it 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

  • No material AI assistance was used.
  • This is an AI-assisted contribution. I reviewed, understood, and verified all submitted content and accept responsibility for it.

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

  • The code builds clean without any errors or warnings
  • All unit tests pass, and I have added new tests where possible
  • The PR follows the Contribution Guidelines
  • This PR links to an agreed issue with no competing open PR, or the Related Issue section documents a trivial-change or repository-automation exception.
  • This is not a breaking change. If it is a breaking change, add the breaking change label (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

…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>
Copilot AI balanced review requested due to automatic review settings October 27, 2026 12:44
@agent-framework-automation agent-framework-automation Bot added the python Usage: [Issues, PRs], Target: Python label Oct 27, 2026

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.

🟢 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 Agent and OpenAIChatClient, including imports and keyword arguments in examples.
  • Clarify Azure OpenAI compatibility in file-search documentation.
  • Update MCP error guidance to recommend an Agent with 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])

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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>

This branch was previously deployed

1 inactive deployment
github-app-auth — c41d176f Deployed Oct 27, 2026 by 1aifanatic via add_label #26326
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

python Usage: [Issues, PRs], Target: Python

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants