Python: docs: fix removed ChatAgent references in _clients.py docstrings#6924
Open
sumesh-ramasamy wants to merge 3 commits into
Open
Python: docs: fix removed ChatAgent references in _clients.py docstrings#6924sumesh-ramasamy wants to merge 3 commits into
sumesh-ramasamy wants to merge 3 commits into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Updates Python core docstrings in agent_framework/_clients.py to reflect the breaking rename from ChatAgent to Agent, keeping the tool-support protocol examples and as_agent docs aligned with the current public API.
Changes:
- Replaced stale
ChatAgentreferences withAgentacross multiple tool-support protocol docstrings. - Fixed nearby grammar in the
as_agentdocstring (“a Agent” → “an Agent”). - Kept changes docstring-only (no runtime behavior changes intended).
Comment on lines
+674
to
+678
| @@ -675,7 +675,7 @@ class SupportsCodeInterpreterTool(Protocol): | |||
|
|
|||
| if isinstance(client, SupportsCodeInterpreterTool): | |||
| tool = client.get_code_interpreter_tool() | |||
| agent = ChatAgent(client, tools=[tool]) | |||
| agent = Agent(client, tools=[tool]) | |||
Comment on lines
+704
to
+708
| @@ -705,7 +705,7 @@ class SupportsWebSearchTool(Protocol): | |||
|
|
|||
| if isinstance(client, SupportsWebSearchTool): | |||
| tool = client.get_web_search_tool() | |||
| agent = ChatAgent(client, tools=[tool]) | |||
| agent = Agent(client, tools=[tool]) | |||
Comment on lines
+734
to
+738
| @@ -735,7 +735,7 @@ class SupportsImageGenerationTool(Protocol): | |||
|
|
|||
| if isinstance(client, SupportsImageGenerationTool): | |||
| tool = client.get_image_generation_tool() | |||
| agent = ChatAgent(client, tools=[tool]) | |||
| agent = Agent(client, tools=[tool]) | |||
Comment on lines
+764
to
+768
| @@ -765,7 +765,7 @@ class SupportsMCPTool(Protocol): | |||
|
|
|||
| if isinstance(client, SupportsMCPTool): | |||
| tool = client.get_mcp_tool(name="my_mcp", url="https://...") | |||
| agent = ChatAgent(client, tools=[tool]) | |||
| agent = Agent(client, tools=[tool]) | |||
Comment on lines
+795
to
+799
| @@ -796,7 +796,7 @@ class SupportsFileSearchTool(Protocol): | |||
|
|
|||
| if isinstance(client, SupportsFileSearchTool): | |||
| tool = client.get_file_search_tool(vector_store_ids=["vs_123"]) | |||
| agent = ChatAgent(client, tools=[tool]) | |||
| agent = Agent(client, tools=[tool]) | |||
Comment on lines
+825
to
+829
| @@ -826,7 +826,7 @@ class SupportsShellTool(Protocol): | |||
|
|
|||
| if isinstance(client, SupportsShellTool): | |||
| tool = client.get_shell_tool(func=shell.as_function()) | |||
| agent = ChatAgent(client, tools=[tool]) | |||
| agent = Agent(client, tools=[tool]) | |||
Author
|
@microsoft-github-policy-service agree |
Contributor
|
@sumesh-ramasamy Thank you for the contribution. Please have a look at Copilot's PR feedback. |
Contributor
Python Test Coverage Report •
Python Unit Test Overview
|
||||||||||||||||||||||||||||||
Import Agent in each tool-support protocol docstring example so copy/pasting no longer raises NameError, and define the shell executor (LocalShellTool) in the SupportsShellTool example. Addresses Copilot review feedback on microsoft#6924. Co-authored-by: Cursor <cursoragent@cursor.com>
`async with LocalShellTool()` is a SyntaxError at module level, so the copy/pasted snippet must live inside an async function to be valid. Co-authored-by: Cursor <cursoragent@cursor.com>
Author
|
Thanks @moonbox3, and thanks to Copilot for the review. I've pushed two follow-up commits addressing the feedback:
I verified locally by extracting each docstring code-block and executing it verbatim against a protocol-conforming client — all six now import, run, and construct an Happy to make any further adjustments. |
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.
What
ChatAgentwas renamed toAgent(#3747) with no back-compat alias, but the tool-supportprotocol docstrings in
python/packages/core/agent_framework/_clients.pystill referenceChatAgent. Copy-pasting the examples raisesNameError.This renames the 12 stale references to
Agentacross 6 protocol classes(
SupportsCodeInterpreterTool,SupportsWebSearchTool,SupportsImageGenerationTool,SupportsMCPTool,SupportsFileSearchTool,SupportsShellTool). Also fixes three"a Agent" -> "an Agent" grammar slips in the adjacent
as_agentdocstring.Docstring-only; no code behavior changes.
Verify
from agent_framework import ChatAgentraisesImportError—Agentis the exported name.