From 5b9e02ae3daa3655134a149a23533300b32bb7f7 Mon Sep 17 00:00:00 2001 From: aifanatic Date: Tue, 27 Oct 2026 07:43:59 -0500 Subject: [PATCH 1/2] Python: replace references to removed ChatAgent and Responses client 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 --- .../a2a/agent_framework_a2a/_a2a_executor.py | 4 +-- .../agent_framework_anthropic/_chat_client.py | 6 ++--- .../_file_search.py | 2 +- .../claude/agent_framework_claude/_agent.py | 2 +- .../agent_framework_github_copilot/_agent.py | 4 +-- .../agent_framework_openai/_chat_client.py | 25 +++++++++++-------- .../_chat_completion_client.py | 7 +++--- .../parallelism/fan_out_fan_in_edges.py | 2 +- 8 files changed, 29 insertions(+), 23 deletions(-) diff --git a/python/packages/a2a/agent_framework_a2a/_a2a_executor.py b/python/packages/a2a/agent_framework_a2a/_a2a_executor.py index 1958b73ac28..346c7ebc443 100644 --- a/python/packages/a2a/agent_framework_a2a/_a2a_executor.py +++ b/python/packages/a2a/agent_framework_a2a/_a2a_executor.py @@ -64,7 +64,7 @@ class A2AExecutor(AgentExecutor): from a2a.server.tasks import InMemoryTaskStore from a2a.types import AgentCapabilities, AgentCard, AgentInterface from agent_framework.a2a import A2AExecutor - from agent_framework.openai import OpenAIResponsesClient + from agent_framework.openai import OpenAIChatClient from starlette.applications import Starlette public_agent_card = AgentCard( @@ -81,7 +81,7 @@ class A2AExecutor(AgentExecutor): ) # Create an agent - agent = OpenAIResponsesClient().as_agent( + agent = OpenAIChatClient().as_agent( name="Food Agent", instructions="A simple agent that provides food-related information.", ) diff --git a/python/packages/anthropic/agent_framework_anthropic/_chat_client.py b/python/packages/anthropic/agent_framework_anthropic/_chat_client.py index dd894913609..d4ef0cd6394 100644 --- a/python/packages/anthropic/agent_framework_anthropic/_chat_client.py +++ b/python/packages/anthropic/agent_framework_anthropic/_chat_client.py @@ -456,7 +456,7 @@ def get_code_interpreter_tool( name: The name for this tool. Defaults to "code_execution". Returns: - A dict-based tool configuration ready to pass to ChatAgent. + A dict-based tool configuration ready to pass to an Agent. Examples: .. code-block:: python @@ -481,7 +481,7 @@ def get_web_search_tool( name: The name for this tool. Defaults to "web_search". Returns: - A dict-based tool configuration ready to pass to ChatAgent. + A dict-based tool configuration ready to pass to an Agent. Examples: .. code-block:: python @@ -569,7 +569,7 @@ def get_mcp_tool( authorization_token: Authorization token for the MCP server (e.g., Bearer token). Returns: - A dict-based tool configuration ready to pass to ChatAgent. + A dict-based tool configuration ready to pass to an Agent. Examples: .. code-block:: python diff --git a/python/packages/azure-contentunderstanding/agent_framework_azure_contentunderstanding/_file_search.py b/python/packages/azure-contentunderstanding/agent_framework_azure_contentunderstanding/_file_search.py index 08096a03d6c..cdfead18bbe 100644 --- a/python/packages/azure-contentunderstanding/agent_framework_azure_contentunderstanding/_file_search.py +++ b/python/packages/azure-contentunderstanding/agent_framework_azure_contentunderstanding/_file_search.py @@ -75,7 +75,7 @@ async def delete_file(self, file_id: str) -> None: class OpenAIFileSearchBackend(_OpenAICompatBackend): """File search backend for OpenAI Responses API. - Use with ``OpenAIChatClient`` or ``AzureOpenAIResponsesClient``. + Use with ``OpenAIChatClient``, including when it targets Azure OpenAI through ``azure_endpoint``. Requires an ``AsyncOpenAI`` or ``AsyncAzureOpenAI`` client. Args: diff --git a/python/packages/claude/agent_framework_claude/_agent.py b/python/packages/claude/agent_framework_claude/_agent.py index e5f879c7930..58d22ddada1 100644 --- a/python/packages/claude/agent_framework_claude/_agent.py +++ b/python/packages/claude/agent_framework_claude/_agent.py @@ -79,7 +79,7 @@ "connects to MCP servers itself, so a framework-managed MCPTool would keep none of its " "framework behavior. Configure the server natively instead, for example " "default_options={{'mcp_servers': {{'{name}': " - "{{'type': 'stdio', 'command': 'python', 'args': ['server.py']}}}}}}, or use a ChatAgent, " + "{{'type': 'stdio', 'command': 'python', 'args': ['server.py']}}}}}}, or use an Agent with a chat client, " "where the framework owns the connection." ) diff --git a/python/packages/github_copilot/agent_framework_github_copilot/_agent.py b/python/packages/github_copilot/agent_framework_github_copilot/_agent.py index 4dfdd70894a..8722e81196d 100644 --- a/python/packages/github_copilot/agent_framework_github_copilot/_agent.py +++ b/python/packages/github_copilot/agent_framework_github_copilot/_agent.py @@ -212,8 +212,8 @@ def _provider_service_session_state_keys(agent: object, client: object | None) - "connects to MCP servers itself, so a framework-managed MCPTool would keep none of its " "framework behavior. Configure the server natively instead, for example " "default_options={{'mcp_servers': {{'{name}': {{'type': 'stdio', 'command': 'python', " - "'args': ['server.py'], 'tools': ['*']}}}}}}, or use a ChatAgent, where the framework owns " - "the connection." + "'args': ['server.py'], 'tools': ['*']}}}}}}, or use an Agent with a chat client, where the " + "framework owns the connection." ) diff --git a/python/packages/openai/agent_framework_openai/_chat_client.py b/python/packages/openai/agent_framework_openai/_chat_client.py index fdb8c3d8eae..8509bfce900 100644 --- a/python/packages/openai/agent_framework_openai/_chat_client.py +++ b/python/packages/openai/agent_framework_openai/_chat_client.py @@ -1323,11 +1323,12 @@ def get_code_interpreter_tool( or provide a TypedDict with custom container settings. Returns: - A CodeInterpreter tool parameter ready to pass to ChatAgent. + A CodeInterpreter tool parameter ready to pass to an Agent. Examples: .. code-block:: python + from agent_framework import Agent from agent_framework.openai import OpenAIChatClient # Basic code interpreter @@ -1337,7 +1338,7 @@ def get_code_interpreter_tool( tool = OpenAIChatClient.get_code_interpreter_tool(file_ids=["file-abc123"]) # Use with agent - agent = ChatAgent(client, tools=[tool]) + agent = Agent(client=client, tools=[tool]) """ container_config: CodeInterpreterContainerCodeInterpreterToolAuto = ( container if isinstance(container, dict) else {"type": "auto"} @@ -1365,11 +1366,12 @@ def get_web_search_tool( filters: Additional search filters. Returns: - A WebSearchToolParam dict ready to pass to ChatAgent. + A WebSearchToolParam dict ready to pass to an Agent. Examples: .. code-block:: python + from agent_framework import Agent from agent_framework.openai import OpenAIChatClient # Basic web search @@ -1381,7 +1383,7 @@ def get_web_search_tool( search_context_size="medium", ) - agent = ChatAgent(client, tools=[tool]) + agent = Agent(client=client, tools=[tool]) """ web_search_tool = WebSearchToolParam(type="web_search") @@ -1427,11 +1429,12 @@ def get_image_generation_tool( output_compression: Compression level for output (0-100). Returns: - An ImageGeneration tool parameter dict ready to pass to ChatAgent. + An ImageGeneration tool parameter dict ready to pass to an Agent. Examples: .. code-block:: python + from agent_framework import Agent from agent_framework.openai import OpenAIChatClient # Basic image generation @@ -1444,7 +1447,7 @@ def get_image_generation_tool( output_format="png", ) - agent = ChatAgent(client, tools=[tool]) + agent = Agent(client=client, tools=[tool]) """ tool: ImageGeneration = {"type": "image_generation"} @@ -1586,11 +1589,12 @@ def get_mcp_tool( headers: HTTP headers to include in requests to the MCP server. Returns: - An Mcp tool parameter dict ready to pass to ChatAgent. + An Mcp tool parameter dict ready to pass to an Agent. Examples: .. code-block:: python + from agent_framework import Agent from agent_framework.openai import OpenAIChatClient # Basic MCP tool @@ -1618,7 +1622,7 @@ def get_mcp_tool( }, ) - agent = ChatAgent(client, tools=[tool]) + agent = Agent(client=client, tools=[tool]) """ mcp: Mcp = { "type": "mcp", @@ -1659,11 +1663,12 @@ def get_file_search_tool( max_num_results: Maximum number of results to return. Defaults to 50 if not specified. Returns: - A FileSearchToolParam dict ready to pass to ChatAgent. + A FileSearchToolParam dict ready to pass to an Agent. Examples: .. code-block:: python + from agent_framework import Agent from agent_framework.openai import OpenAIChatClient # Basic file search @@ -1677,7 +1682,7 @@ def get_file_search_tool( max_num_results=10, ) - agent = ChatAgent(client, tools=[tool]) + agent = Agent(client=client, tools=[tool]) """ tool = FileSearchToolParam( type="file_search", diff --git a/python/packages/openai/agent_framework_openai/_chat_completion_client.py b/python/packages/openai/agent_framework_openai/_chat_completion_client.py index 92be0f53933..eed90d0d70e 100644 --- a/python/packages/openai/agent_framework_openai/_chat_completion_client.py +++ b/python/packages/openai/agent_framework_openai/_chat_completion_client.py @@ -525,7 +525,7 @@ def get_web_search_tool( Note: For the Chat Completions API, web search is passed via the `web_search_options` parameter rather than in the `tools` array. This method returns a dict that can be - passed as a tool to ChatAgent, which will handle it appropriately. + passed as a tool to an Agent, which will handle it appropriately. Keyword Args: web_search_options: The full WebSearchOptions configuration. This TypedDict includes: @@ -534,11 +534,12 @@ def get_web_search_tool( - search_context_size: One of "low", "medium", "high". Returns: - A dict configuration that enables web search when passed to ChatAgent. + A dict configuration that enables web search when passed to an Agent. Examples: .. code-block:: python + from agent_framework import Agent from agent_framework.openai import OpenAIChatCompletionClient # Basic web search @@ -555,7 +556,7 @@ def get_web_search_tool( } ) - agent = ChatAgent(client, tools=[tool]) + agent = Agent(client=client, tools=[tool]) """ tool: dict[str, Any] = {"type": "web_search"} diff --git a/python/samples/03-workflows/parallelism/fan_out_fan_in_edges.py b/python/samples/03-workflows/parallelism/fan_out_fan_in_edges.py index b2bc8dd0036..0f00f3544bf 100644 --- a/python/samples/03-workflows/parallelism/fan_out_fan_in_edges.py +++ b/python/samples/03-workflows/parallelism/fan_out_fan_in_edges.py @@ -6,7 +6,7 @@ from agent_framework import ( Agent, - AgentExecutor, # Wraps a ChatAgent as an Executor for use in workflows + AgentExecutor, # Wraps an Agent as an Executor for use in workflows AgentExecutorRequest, # The message bundle sent to an AgentExecutor AgentExecutorResponse, # The structured result returned by an AgentExecutor AgentResponseUpdate, From c41d176f53edfae69950d6f3fec53e7c6e8a3c19 Mon Sep 17 00:00:00 2001 From: aifanatic Date: Tue, 27 Oct 2026 10:15:11 -0500 Subject: [PATCH 2/2] Instantiate the client in OpenAI tool examples Co-Authored-By: Claude Opus 5.5 --- .../openai/agent_framework_openai/_chat_client.py | 10 +++++----- .../agent_framework_openai/_chat_completion_client.py | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/python/packages/openai/agent_framework_openai/_chat_client.py b/python/packages/openai/agent_framework_openai/_chat_client.py index 8509bfce900..003d080f1d2 100644 --- a/python/packages/openai/agent_framework_openai/_chat_client.py +++ b/python/packages/openai/agent_framework_openai/_chat_client.py @@ -1338,7 +1338,7 @@ def get_code_interpreter_tool( tool = OpenAIChatClient.get_code_interpreter_tool(file_ids=["file-abc123"]) # Use with agent - agent = Agent(client=client, tools=[tool]) + agent = Agent(client=OpenAIChatClient(), tools=[tool]) """ container_config: CodeInterpreterContainerCodeInterpreterToolAuto = ( container if isinstance(container, dict) else {"type": "auto"} @@ -1383,7 +1383,7 @@ def get_web_search_tool( search_context_size="medium", ) - agent = Agent(client=client, tools=[tool]) + agent = Agent(client=OpenAIChatClient(), tools=[tool]) """ web_search_tool = WebSearchToolParam(type="web_search") @@ -1447,7 +1447,7 @@ def get_image_generation_tool( output_format="png", ) - agent = Agent(client=client, tools=[tool]) + agent = Agent(client=OpenAIChatClient(), tools=[tool]) """ tool: ImageGeneration = {"type": "image_generation"} @@ -1622,7 +1622,7 @@ def get_mcp_tool( }, ) - agent = Agent(client=client, tools=[tool]) + agent = Agent(client=OpenAIChatClient(), tools=[tool]) """ mcp: Mcp = { "type": "mcp", @@ -1682,7 +1682,7 @@ def get_file_search_tool( max_num_results=10, ) - agent = Agent(client=client, tools=[tool]) + agent = Agent(client=OpenAIChatClient(), tools=[tool]) """ tool = FileSearchToolParam( type="file_search", diff --git a/python/packages/openai/agent_framework_openai/_chat_completion_client.py b/python/packages/openai/agent_framework_openai/_chat_completion_client.py index eed90d0d70e..773db632746 100644 --- a/python/packages/openai/agent_framework_openai/_chat_completion_client.py +++ b/python/packages/openai/agent_framework_openai/_chat_completion_client.py @@ -556,7 +556,7 @@ def get_web_search_tool( } ) - agent = Agent(client=client, tools=[tool]) + agent = Agent(client=OpenAIChatCompletionClient(), tools=[tool]) """ tool: dict[str, Any] = {"type": "web_search"}