Skip to content

.NET: [BREAKING] Renamed CreateAIAgent/GetAIAgent to AsAIAgent - #3222

Merged
Dmytro Struk (dmytrostruk) merged 10 commits into
microsoft:mainfrom
dmytrostruk:dotnet-as-agent-rename
Jan 15, 2026
Merged

.NET: [BREAKING] Renamed CreateAIAgent/GetAIAgent to AsAIAgent#3222
Dmytro Struk (dmytrostruk) merged 10 commits into
microsoft:mainfrom
dmytrostruk:dotnet-as-agent-rename

Conversation

@dmytrostruk

Copy link
Copy Markdown
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 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.

// Beforevaragent=chatClient.CreateAIAgent(options);// Aftervaragent=chatClient.AsAIAgent(options);

Impacted Classes:

  • Microsoft.Agents.AI
    • ChatClientExtensions - CreateAIAgent → AsAIAgent
  • Microsoft.Agents.AI.OpenAI
    • OpenAIChatClientExtensions - CreateAIAgent → AsAIAgent
    • OpenAIResponseClientExtensions - CreateAIAgent → AsAIAgent
    • OpenAIAssistantClientExtensions - GetAIAgent (metadata overloads only) → AsAIAgent
  • Microsoft.Agents.AI.AzureAI
    • AzureAIProjectChatClientExtensions - GetAIAgent (AgentRecord/AgentVersion overloads) → AsAIAgent
  • Microsoft.Agents.AI.AzureAI.Persistent
    • PersistentAgentsClientExtensions - GetAIAgent (Response/PersistentAgent overloads) → AsAIAgent
  • Microsoft.Agents.AI.Anthropic
    • AnthropicClientExtensions - CreateAIAgent → AsAIAgent
    • AnthropicBetaServiceExtensions - CreateAIAgent → AsAIAgent
  • Microsoft.Agents.AI.A2A
    • A2AClientExtensions - GetAIAgent → AsAIAgent
    • A2AAgentCardExtensions - GetAIAgent → AsAIAgent

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.

CopilotAI review requested due to automatic review settings January 14, 2026 21:12
@dmytrostrukDmytro Struk (dmytrostruk) added .NET Usage: [Issues, PRs], Target: .Net breaking change Usage: [PRs], Target: all PRs that introduce changes that are not backward compatible labels Jan 14, 2026

CopilotAI 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

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 AsAIAgent naming
  • 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
FileDescription
ChatClientExtensions.csRenamed CreateAIAgent → AsAIAgent for local wrapper methods
ChatClientBuilderExtensions.csUpdated calls to use AsAIAgent
OpenAIResponseClientExtensions.csRenamed CreateAIAgent → AsAIAgent for local wrapper methods
OpenAIChatClientExtensions.csRenamed CreateAIAgent → AsAIAgent for local wrapper methods
OpenAIAssistantClientExtensions.csRenamed GetAIAgent → AsAIAgent for metadata-based wrapper methods only
AzureAIProjectChatClientExtensions.csRenamed GetAIAgent → AsAIAgent for AgentRecord/AgentVersion overloads
PersistentAgentsClientExtensions.csRenamed GetAIAgent → AsAIAgent for Response/PersistentAgent overloads
AnthropicClientExtensions.csRenamed CreateAIAgent → AsAIAgent for local wrapper methods
AnthropicBetaServiceExtensions.csRenamed CreateAIAgent → AsAIAgent for local wrapper methods
A2AClientExtensions.csRenamed GetAIAgent → AsAIAgent
A2AAgentCardExtensions.csRenamed GetAIAgent → AsAIAgent
A2ACardResolverExtensions.csUpdated call to use AsAIAgent
AzureAgentProvider.csUpdated 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 GetAgentRecordByName at 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 other GetAIAgent overloads in this file.

@markwallace-microsoftMark Wallace (markwallace-microsoft) added the documentation Usage: [Issues, PRs], Target: documentation in the code base and learn docs label Jan 14, 2026
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking changeUsage: [PRs], Target: all PRs that introduce changes that are not backward compatibledocumentationUsage: [Issues, PRs], Target: documentation in the code base and learn docs.NETUsage: [Issues, PRs], Target: .Net

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

@dmytrostruk@SergeyMenshykh@westey-m@markwallace-microsoft