Expose metadata from A2AAgent and seal AIAgentMetadata (#3417)

This commit is contained in:
westey
2026-01-27 19:05:24 +00:00
committed by GitHub
parent e82d9f5e45
commit e6ce398b41
3 changed files with 131 additions and 1 deletions
@@ -26,6 +26,8 @@ namespace Microsoft.Agents.AI.A2A;
/// </remarks>
public sealed class A2AAgent : AIAgent
{
private static readonly AIAgentMetadata s_agentMetadata = new("a2a");
private readonly A2AClient _a2aClient;
private readonly string? _id;
private readonly string? _name;
@@ -211,6 +213,13 @@ public sealed class A2AAgent : AIAgent
/// <inheritdoc/>
public override string? Description => this._description;
/// <inheritdoc/>
public override object? GetService(Type serviceType, object? serviceKey = null)
=> base.GetService(serviceType, serviceKey)
?? (serviceType == typeof(A2AClient) ? this._a2aClient
: serviceType == typeof(AIAgentMetadata) ? s_agentMetadata
: null);
private async ValueTask<A2AAgentSession> GetA2ASessionAsync(AgentSession? session, AgentRunOptions? options, CancellationToken cancellationToken)
{
// Aligning with other agent implementations that support background responses, where
@@ -12,7 +12,7 @@ namespace Microsoft.Agents.AI;
/// telemetry, and logging purposes.
/// </remarks>
[DebuggerDisplay("ProviderName = {ProviderName}")]
public class AIAgentMetadata
public sealed class AIAgentMetadata
{
/// <summary>
/// Initializes a new instance of the <see cref="AIAgentMetadata"/> class.