| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
…ientAgent pattern Adds a new A2AAgentOptions class (Id, Name, Description, Clone) and an options-based constructor on A2AAgent, mirroring ChatClientAgent/ChatClientAgentOptions. The existing parameter-based constructor is preserved for backward compatibility and now delegates to the options-based one. Extension methods are extended with options-based overloads: - A2AClientExtensions.AsAIAgent(IA2AClient, A2AAgentOptions, ...) - A2AAgentCardExtensions.AsAIAgent(AgentCard, A2AAgentOptions, ...) - A2ACardResolverExtensions.GetAIAgentAsync(A2ACardResolver, A2AAgentOptions, ...) For card-based creation, user-supplied options override values from the agent card; Name and Description fall back to card values when not set. Options are cloned when stored on the agent to prevent post-construction mutation, matching the ChatClientAgent pattern. Resolves microsoft#5870. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Note
Copilot was unable to run its full agentic suite in this review.
Adds an A2AAgentOptions type and updates A2AAgent/extension method creation paths to use an options-based construction pattern (matching ChatClientAgentOptions), enabling callers to override agent Id/Name/Description during agent creation (including card-based flows).
Changes:
Copilot reviewed 9 out of 9 changed files in this pull request and generated 5 comments.
Show a summary per file| File | Description |
|---|---|
| dotnet/src/Microsoft.Agents.AI.A2A/A2AAgentOptions.cs | New options object to carry agent identity fields and support cloning. |
| dotnet/src/Microsoft.Agents.AI.A2A/A2AAgent.cs | Adds options-based constructor + stores cloned options for immutability. |
| dotnet/src/Microsoft.Agents.AI.A2A/Extensions/A2AClientExtensions.cs | Adds AsAIAgent(..., A2AAgentOptions, ...) overload. |
| dotnet/src/Microsoft.Agents.AI.A2A/Extensions/A2ACardResolverExtensions.cs | Adds GetAIAgentAsync(..., A2AAgentOptions, ...) overload. |
| dotnet/src/Microsoft.Agents.AI.A2A/Extensions/A2AAgentCardExtensions.cs | Adds AsAIAgent(..., A2AAgentOptions, ...) overload with merge behavior. |
| dotnet/tests/.../A2AAgentTests.cs | Adds tests for options ctor, null handling, and mutation isolation. |
| dotnet/tests/.../Extensions/A2AClientExtensionsTests.cs | Adds tests for options-based agent creation from a client. |
| dotnet/tests/.../Extensions/A2ACardResolverExtensionsTests.cs | Adds tests for card resolver creation with override + fallback behavior. |
| dotnet/tests/.../Extensions/A2AAgentCardExtensionsTests.cs | Adds tests for card-based creation with override + fallback behavior. |
Sorry, something went wrong.
- Add Throw.IfNull(client) in A2AClientExtensions.AsAIAgent - Add Throw.IfNull(card) in A2AAgentCardExtensions.AsAIAgent - Clarify httpClient docs in A2ACardResolverExtensions.GetAIAgentAsync: it applies to the created A2A client, not to card discovery - Rename test methods from GetAIAgent_* to AsAIAgent_* to match the API under test Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
| Back | FazBrowse Home | New Git URL |
Closes #5870.
Adds a new A2AAgentOptions class (Id, Name, Description) and options-based overloads on A2AAgent and the AsAIAgent / GetAIAgentAsync extension methods, mirroring the ChatClientAgent / ChatClientAgentOptions pattern.
This enables callers to supply a custom agent Id / Name / Description when creating an agent via A2ACardResolver.GetAIAgentAsync or AgentCard.AsAIAgent. For card-based creation, user-supplied values override the card; Name and Description fall back to card values when not set.
All existing public APIs are preserved.