Skip to content

Conversation

@dmytrostruk
Copy link
Member

Motivation and Context

Related ADR: https://github.com/microsoft/agent-framework/blob/main/docs/decisions/0011-create-get-agent-api.md

This PR renames BaseChatClient method that creates local wrapper agents from create_agent to as_agent, following naming convention where as_* indicates a lightweight conversion/wrapping operation without side effects.

# Before
agent = chat_client.create_agent(...)

# After
agent = chat_client.as_agent(...)

Contribution Checklist

  • The code builds clean without any errors or warnings
  • The PR follows the Contribution Guidelines
  • All unit tests pass, and I have added new tests where possible
  • Is this a breaking change? If yes, add "[BREAKING]" prefix to the title of the PR.

@dmytrostruk dmytrostruk self-assigned this Jan 16, 2026
Copilot AI review requested due to automatic review settings January 16, 2026 07:43
@dmytrostruk dmytrostruk added the documentation Improvements or additions to documentation label Jan 16, 2026
@dmytrostruk dmytrostruk requested a review from a team as a code owner January 16, 2026 07:43
@dmytrostruk dmytrostruk added python breaking change Introduces changes that are not backward compatible and may require updates to dependent code. labels Jan 16, 2026
@markwallace-microsoft markwallace-microsoft added the lab Agent Framework Lab label Jan 16, 2026
@markwallace-microsoft
Copy link
Member

markwallace-microsoft commented Jan 16, 2026

Python Test Coverage

Python Test Coverage Report •
FileStmtsMissCoverMissing
packages/azure-ai/agent_framework_azure_ai
   _chat_client.py4248180%376, 635–636, 638, 641, 644, 647–652, 655, 657, 665, 677–679, 683, 686–687, 695–698, 708, 716–719, 721–722, 724–725, 732, 740–741, 749–750, 755–756, 760–767, 772–773, 781, 787, 795–797, 800, 822–823, 933, 935, 937, 952, 980, 993–997, 1036–1038, 1041–1042, 1083–1088, 1213
   _client.py1763679%244–247, 252, 255–258, 263, 266–267, 270, 277, 387, 413–416, 459, 496, 498, 503, 505–506, 508–516, 518, 563
packages/azurefunctions/agent_framework_azurefunctions
   _app.py3748078%197–198, 203–204, 422, 430–431, 451–453, 459–461, 467–469, 502–503, 563–564, 699, 702, 711–713, 715–717, 719, 721, 732, 734–737, 739, 741–742, 744, 751–752, 754–755, 757–758, 760, 764, 774–776, 778–779, 781–783, 790, 792–793, 795, 816, 821, 833, 909, 921, 928–930, 975, 989, 1000–1002, 1004–1007, 1032, 1039, 1041, 1044
packages/core/agent_framework
   _clients.py55590%48, 268, 312, 440, 442
packages/core/agent_framework/_workflows
   _handoff.py3865984%58, 110–111, 113, 142–143, 163–173, 175, 177, 179, 184, 284, 338, 363, 389, 397–398, 412, 461–462, 492, 539–541, 729, 736, 741, 828, 831, 840–843, 853, 858, 865, 871–874, 909, 914, 1104, 1117, 1120, 1128, 1146, 1153, 1228
packages/core/agent_framework/openai
   _assistants_client.py2783587%67, 360, 374, 377, 379–380, 383, 386, 389–390, 401, 426, 428, 430, 432, 434, 439, 442, 445, 449, 460, 545, 564–565, 568, 576, 628, 663, 698–701, 753, 770, 815
TOTAL17429266984% 

Python Unit Test Overview

Tests Skipped Failures Errors Time
3148 213 💤 0 ❌ 0 🔥 1m 8s ⏱️

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR implements a breaking change that renames the create_agent method to as_agent on BaseChatClient and all its subclasses. This naming change better aligns with the convention where as_* indicates a lightweight conversion or wrapping operation without side effects.

Changes:

  • Renamed BaseChatClient.create_agent() to BaseChatClient.as_agent() in the core implementation
  • Updated all sample code, documentation, and README files to use the new method name
  • Updated docstrings and code examples in the implementation

Reviewed changes

Copilot reviewed 160 out of 160 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
python/packages/core/agent_framework/_clients.py Core method rename from create_agent to as_agent with updated docstrings
python/packages/core/agent_framework/_workflows/_handoff.py Updated documentation examples to use as_agent
python/packages/declarative/agent_framework_declarative/_workflows/_factory.py Updated documentation examples to use as_agent
python/packages/foundry_local/agent_framework_foundry_local/_foundry_local_client.py Updated docstring examples to use as_agent
python/packages/azurefunctions/agent_framework_azurefunctions/_app.py Updated docstring examples to use as_agent
python/samples/* (150+ files) Comprehensive update of all sample code to use as_agent
python/samples/getting_started/agents/azure_ai/azure_ai_provider_methods.py Removed obsolete get_agent_by_details_example function and updated main() accordingly

@dmytrostruk dmytrostruk added this pull request to the merge queue Jan 16, 2026
Merged via the queue into microsoft:main with commit 5687e13 Jan 16, 2026
35 checks passed
alliscode pushed a commit to alliscode/agent-framework that referenced this pull request Jan 16, 2026
* Renamed create_agent to as_agent

* Override for as_agent

* Added override
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking change Introduces changes that are not backward compatible and may require updates to dependent code. documentation Improvements or additions to documentation lab Agent Framework Lab python

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants