mirror of
https://github.com/microsoft/agent-framework.git
synced 2026-06-16 21:04:09 +08:00
Expose metadata from A2AAgent and seal AIAgentMetadata (#3417)
This commit is contained in:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user