Language

A2AAgentCardExtensions.AsAIAgent Method

Definition

Overloads

Name Description
AsAIAgent(AgentCard, HttpClient, A2AClientOptions, ILoggerFactory)

Retrieves an instance of AIAgent for an existing A2A agent.

AsAIAgent(AgentCard, A2AAgentOptions, HttpClient, A2AClientOptions, ILoggerFactory)

Retrieves an instance of AIAgent for an existing A2A agent.

AsAIAgent(AgentCard, HttpClient, A2AClientOptions, ILoggerFactory)

Retrieves an instance of AIAgent for an existing A2A agent.

public static Microsoft.Agents.AI.AIAgent AsAIAgent(this A2A.AgentCard card, System.Net.Http.HttpClient? httpClient = default, A2A.A2AClientOptions? options = default, Microsoft.Extensions.Logging.ILoggerFactory? loggerFactory = default);
static member AsAIAgent : A2A.AgentCard * System.Net.Http.HttpClient * A2A.A2AClientOptions * Microsoft.Extensions.Logging.ILoggerFactory -> Microsoft.Agents.AI.AIAgent
<Extension()>
Public Function AsAIAgent (card As AgentCard, Optional httpClient As HttpClient = Nothing, Optional options As A2AClientOptions = Nothing, Optional loggerFactory As ILoggerFactory = Nothing) As AIAgent

Parameters

card
A2A.AgentCard

The A2A.AgentCard to use for the agent creation.

httpClient
HttpClient

The HttpClient to use for HTTP requests.

options
A2A.A2AClientOptions

Optional A2A.A2AClientOptions controlling protocol binding preference. When not provided, defaults to preferring HTTP+JSON first, with JSON-RPC as fallback.

loggerFactory
ILoggerFactory

The logger factory for enabling logging within the agent.

Returns

An AIAgent instance backed by the A2A agent.

Remarks

This method can be used to access A2A agents that support the Curated Registries (Catalog-Based Discovery) discovery mechanism.

Applies to

AsAIAgent(AgentCard, A2AAgentOptions, HttpClient, A2AClientOptions, ILoggerFactory)

Retrieves an instance of AIAgent for an existing A2A agent.

public static Microsoft.Agents.AI.AIAgent AsAIAgent(this A2A.AgentCard card, Microsoft.Agents.AI.A2A.A2AAgentOptions agentOptions, System.Net.Http.HttpClient? httpClient = default, A2A.A2AClientOptions? clientOptions = default, Microsoft.Extensions.Logging.ILoggerFactory? loggerFactory = default);
static member AsAIAgent : A2A.AgentCard * Microsoft.Agents.AI.A2A.A2AAgentOptions * System.Net.Http.HttpClient * A2A.A2AClientOptions * Microsoft.Extensions.Logging.ILoggerFactory -> Microsoft.Agents.AI.AIAgent
<Extension()>
Public Function AsAIAgent (card As AgentCard, agentOptions As A2AAgentOptions, Optional httpClient As HttpClient = Nothing, Optional clientOptions As A2AClientOptions = Nothing, Optional loggerFactory As ILoggerFactory = Nothing) As AIAgent

Parameters

card
A2A.AgentCard

The A2A.AgentCard to use for the agent creation.

agentOptions
A2AAgentOptions

Configuration options that control the agent's identity. When provided, non-null values override the corresponding values from the agent card.

httpClient
HttpClient

The HttpClient to use for HTTP requests.

clientOptions
A2A.A2AClientOptions

Optional A2A.A2AClientOptions controlling protocol binding preference. When not provided, defaults to preferring HTTP+JSON first, with JSON-RPC as fallback.

loggerFactory
ILoggerFactory

The logger factory for enabling logging within the agent.

Returns

An AIAgent instance backed by the A2A agent.

Remarks

This method can be used to access A2A agents that support the Curated Registries (Catalog-Based Discovery) discovery mechanism. When agentOptions is provided, any non-null values override the corresponding values from the A2A.AgentCard.

Applies to