SIGN IN SIGN UP

.NET: Add A2AAgentOptions and align A2AAgent constructors with ChatClientAgent pattern (#5954)

* .NET: Add A2AAgentOptions and align A2AAgent constructors with ChatClientAgent 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 #5870.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Address PR review comments

- 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>

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
S
SergeyMenshykh committed
dd1e615dad51221f7a35f2c73b391664b463da41
Parent: f390595
Committed by GitHub <noreply@github.com> on 5/20/2026, 10:05:24 AM