-
Notifications
You must be signed in to change notification settings - Fork 1k
Python: [BREAKING] Renamed create_agent to as_agent #3249
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this 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()toBaseChatClient.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 |
python/samples/getting_started/agents/azure_ai/azure_ai_provider_methods.py
Show resolved
Hide resolved
* Renamed create_agent to as_agent * Override for as_agent * Added override
Motivation and Context
Related ADR: https://github.com/microsoft/agent-framework/blob/main/docs/decisions/0011-create-get-agent-api.md
This PR renames
BaseChatClientmethod that creates local wrapper agents fromcreate_agenttoas_agent, following naming convention whereas_*indicates a lightweight conversion/wrapping operation without side effects.Contribution Checklist