-
Notifications
You must be signed in to change notification settings - Fork 1k
.NET: [BREAKING] Renamed CreateAIAgent/GetAIAgent to AsAIAgent #3222
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
base: main
Are you sure you want to change the base?
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 to rename extension methods that create local wrapper agents from CreateAIAgent/GetAIAgent to AsAIAgent, following the naming convention where As* indicates a lightweight conversion/wrapping operation without side effects. Methods that perform server-side operations (create/retrieve agents from remote services) retain their original CreateAIAgent/GetAIAgent names.
Changes:
- Renamed local wrapper methods across all agent client extension classes to use
AsAIAgentnaming - Updated all test files to use the new method names
- Updated all sample files to use the new method names
Reviewed changes
Copilot reviewed 92 out of 92 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| ChatClientExtensions.cs | Renamed CreateAIAgent → AsAIAgent for local wrapper methods |
| ChatClientBuilderExtensions.cs | Updated calls to use AsAIAgent |
| OpenAIResponseClientExtensions.cs | Renamed CreateAIAgent → AsAIAgent for local wrapper methods |
| OpenAIChatClientExtensions.cs | Renamed CreateAIAgent → AsAIAgent for local wrapper methods |
| OpenAIAssistantClientExtensions.cs | Renamed GetAIAgent → AsAIAgent for metadata-based wrapper methods only |
| AzureAIProjectChatClientExtensions.cs | Renamed GetAIAgent → AsAIAgent for AgentRecord/AgentVersion overloads |
| PersistentAgentsClientExtensions.cs | Renamed GetAIAgent → AsAIAgent for Response/PersistentAgent overloads |
| AnthropicClientExtensions.cs | Renamed CreateAIAgent → AsAIAgent for local wrapper methods |
| AnthropicBetaServiceExtensions.cs | Renamed CreateAIAgent → AsAIAgent for local wrapper methods |
| A2AClientExtensions.cs | Renamed GetAIAgent → AsAIAgent |
| A2AAgentCardExtensions.cs | Renamed GetAIAgent → AsAIAgent |
| A2ACardResolverExtensions.cs | Updated call to use AsAIAgent |
| AzureAgentProvider.cs | Updated call to use AsAIAgent |
| Test files (13 files) | Updated all method calls from CreateAIAgent/GetAIAgent to AsAIAgent |
| Sample files (47 files) | Updated all method calls from CreateAIAgent/GetAIAgent to AsAIAgent |
Comments suppressed due to low confidence (1)
dotnet/src/Microsoft.Agents.AI.AzureAI/AzureAIProjectChatClientExtensions.cs:199
- The XML documentation comment is misleading. The method at line 208 retrieves an existing server-side agent (as evidenced by the call to
GetAgentRecordByNameat line 225), it does not create a new agent. The comment should say 'Retrieves an existing server side agent' or similar to match the actual behavior and be consistent with otherGetAIAgentoverloads in this file.
Motivation and Context
Related ADR: https://github.com/microsoft/agent-framework/blob/main/docs/decisions/0011-create-get-agent-api.md
This PR renames extension methods that create local wrapper agents from CreateAIAgent/GetAIAgent to AsAIAgent, following naming conventions where As* indicates a lightweight conversion/wrapping operation without side effects.
Methods that perform server-side operations (create/retrieve agents from remote services) keep their original names.
Impacted Classes:
Contribution Checklist