# TraconA2AExtensions

> Tracon documentation. Tracon is a .NET package family that adds a control
> plane on Microsoft Agent Framework, published as NuGet packages that run
> inside your own ASP.NET Core application.
>
> Page: https://tracon.dev/api/tracon.tracona2aextensions/
> Summary: TraconA2AExtensions: Extensions that connect the HTTP endpoint that publishes Tracon agents over A2A.

<div class="api-provenance">Namespace Tracon · Assembly <code>Tracon.AspNetCore.dll</code></div>

Extensions that connect the HTTP endpoint that publishes Tracon agents
over A2A.

```csharp
public static class TraconA2AExtensions
```

<dl class="api-relations"><dt>Inheritance</dt><dd><a href="https://learn.microsoft.com/dotnet/api/system.object">object</a> ← <a href="/api/tracon.tracona2aextensions/">TraconA2AExtensions</a></dd><dt>Inherited Members</dt><dd><a href="https://learn.microsoft.com/dotnet/api/system.object.gettype">object.GetType()</a>, <a href="https://learn.microsoft.com/dotnet/api/system.object.memberwiseclone">object.MemberwiseClone()</a>, <a href="https://learn.microsoft.com/dotnet/api/system.object.tostring">object.ToString()</a>, <a href="https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object)">object.Equals(object?)</a>, <a href="https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals(system-object-system-object)">object.Equals(object?, object?)</a>, <a href="https://learn.microsoft.com/dotnet/api/system.object.referenceequals">object.ReferenceEquals(object?, object?)</a>, <a href="https://learn.microsoft.com/dotnet/api/system.object.gethashcode">object.GetHashCode()</a></dd></dl>

## Fields

### <a id="Tracon_TraconA2AExtensions_DefaultPattern"></a> DefaultPattern

Default path prefix.

```csharp
public const string DefaultPattern = "/tracon/a2a"
```

#### Field Value

 [string](https://learn.microsoft.com/dotnet/api/system.string)

## Methods

### <a id="Tracon_TraconA2AExtensions_MapTraconA2A_Microsoft_AspNetCore_Routing_IEndpointRouteBuilder_System_String_"></a> MapTraconA2A\(IEndpointRouteBuilder, string\)

Publishes the agents registered via `UseA2A` over A2A.

```csharp
public static IEndpointConventionBuilder MapTraconA2A(this IEndpointRouteBuilder endpoints, string pattern = "/tracon/a2a")
```

#### Parameters

`endpoints` [IEndpointRouteBuilder](https://learn.microsoft.com/dotnet/api/microsoft.aspnetcore.routing.iendpointroutebuilder)

The application's routing builder.

`pattern` [string](https://learn.microsoft.com/dotnet/api/system.string)

Path prefix. Default is `/tracon/a2a`.

#### Returns

 [IEndpointConventionBuilder](https://learn.microsoft.com/dotnet/api/microsoft.aspnetcore.builder.iendpointconventionbuilder)

The endpoint's convention builder.

#### Remarks

Each exposed agent is mapped to its own sub-path: `{pattern}/{agent}`.
The A2A protocol models a single server as a single agent identity;
multiple agents cannot share the SAME `.well-known/agent-card.json`
path. Each agent's card is published at its own sub-path
(`{pattern}/{agent}/.well-known/agent-card.json`).

Applies the SAME three-layer protection as `MapTracon` —
settings are inherited from there.

If an exposed agent carries a tool that requires approval the
application STILL fails — but not synchronously from this method,
rather through [Tracon.A2AApprovalGuardFilter](/api/tracon/): the check waits in
the background until the SQL schema is ready (so this method itself
does not crash with "no such table" against an empty database, the same
pattern), completes by the first request, and no request can
get ahead of it.

```csharp
app.MapTracon();
app.MapTraconA2A();
```

#### Exceptions

 [ArgumentNullException](https://learn.microsoft.com/dotnet/api/system.argumentnullexception)

`endpoints` is [null](https://learn.microsoft.com/dotnet/csharp/language-reference/keywords/null).

 [ArgumentException](https://learn.microsoft.com/dotnet/api/system.argumentexception)

`pattern` is empty.

 [InvalidOperationException](https://learn.microsoft.com/dotnet/api/system.invalidoperationexception)

`UseA2A` or `MapTracon` has not been called first, or
this is called while remote access is enabled.
