Skip to content

Python: docs: fix removed ChatAgent references in _clients.py docstrings - #6924

Merged
Evan Mattson (moonbox3) merged 3 commits into
microsoft:mainfrom
sumesh-ramasamy:fix/clients-chatagent-docstrings
Jul 9, 2026
Merged

Python: docs: fix removed ChatAgent references in _clients.py docstrings#6924
Evan Mattson (moonbox3) merged 3 commits into
microsoft:mainfrom
sumesh-ramasamy:fix/clients-chatagent-docstrings

Conversation

@sumesh-ramasamy

Copy link
Copy Markdown
Contributor

What

ChatAgent was renamed to Agent (#3747) with no back-compat alias, but the tool-support
protocol docstrings in python/packages/core/agent_framework/_clients.py still reference
ChatAgent. Copy-pasting the examples raises NameError.

This renames the 12 stale references to Agent across 6 protocol classes
(SupportsCodeInterpreterTool, SupportsWebSearchTool, SupportsImageGenerationTool,
SupportsMCPTool, SupportsFileSearchTool, SupportsShellTool). Also fixes three
"a Agent" -> "an Agent" grammar slips in the adjacent as_agent docstring.

Docstring-only; no code behavior changes.

Verify

from agent_framework import ChatAgent raises ImportErrorAgent is the exported name.

Copilot AI review requested due to automatic review settings July 5, 2026 20:00
@giles17 Giles Odigwe (giles17) added the python Usage: [Issues, PRs], Target: Python label Jul 5, 2026
@github-actions github-actions Bot changed the title docs: fix removed ChatAgent references in _clients.py docstrings Python: docs: fix removed ChatAgent references in _clients.py docstrings Jul 5, 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.

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 ChatAgent references with Agent across multiple tool-support protocol docstrings.
  • Fixed nearby grammar in the as_agent docstring (“a Agent” → “an Agent”).
  • Kept changes docstring-only (no runtime behavior changes intended).

Comment thread python/packages/core/agent_framework/_clients.py Outdated
Comment thread python/packages/core/agent_framework/_clients.py Outdated
Comment thread python/packages/core/agent_framework/_clients.py Outdated
Comment thread python/packages/core/agent_framework/_clients.py Outdated
Comment thread python/packages/core/agent_framework/_clients.py Outdated
Comment thread python/packages/core/agent_framework/_clients.py Outdated
@sumesh-ramasamy

Copy link
Copy Markdown
Contributor Author

@microsoft-github-policy-service agree

@moonbox3

Copy link
Copy Markdown
Contributor

Sumesh Ramasamy (@sumesh-ramasamy) Thank you for the contribution. Please have a look at Copilot's PR feedback.

@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Python Test Coverage

Python Test Coverage Report •
FileStmtsMissCoverMissing
packages/core/agent_framework
   _clients.py140695%322, 373, 536–539
TOTAL43375518788% 

Python Unit Test Overview

Tests Skipped Failures Errors Time
8543 33 💤 0 ❌ 0 🔥 2m 14s ⏱️

Sumesh Bharathi Ramasamy and others added 2 commits July 5, 2026 21:37
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>
@sumesh-ramasamy

Copy link
Copy Markdown
Contributor Author

Thanks Evan Mattson (@moonbox3), and thanks to Copilot for the review. I've pushed two follow-up commits addressing the feedback:

  • Added Agent to the import line in all six tool-support protocol examples (SupportsCodeInterpreterTool, SupportsWebSearchTool, SupportsImageGenerationTool, SupportsMCPTool, SupportsFileSearchTool, SupportsShellTool) so the snippets no longer raise NameError on copy/paste.
  • For the SupportsShellTool example, I also defined the shell executor with LocalShellTool (from agent-framework-tools, matching the existing samples) and wrapped it in an async def, since async with isn't valid at module scope.

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 Agent successfully.

Happy to make any further adjustments.

@moonbox3
Evan Mattson (moonbox3) added this pull request to the merge queue Jul 9, 2026
Merged via the queue into microsoft:main with commit 13fc425 Jul 9, 2026
37 checks passed
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.

5 participants