# AgentDecoratorPipeline

> 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.agentdecoratorpipeline/
> Summary: AgentDecoratorPipeline: Applies every registered IAgentDecorator to an agent, in the same order Tracon.CompositeAgentCatalog uses.

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

Applies every registered [IAgentDecorator](/api/tracon.iagentdecorator/) to an agent, in the
same order [Tracon.CompositeAgentCatalog](/api/tracon/) uses.

```csharp
public static class AgentDecoratorPipeline
```

<dl class="api-relations"><dt>Inheritance</dt><dd><a href="https://learn.microsoft.com/dotnet/api/system.object">object</a> ← <a href="/api/tracon.agentdecoratorpipeline/">AgentDecoratorPipeline</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>

## Remarks

A caller that compiles an agent OUTSIDE the catalog (a parameterized run,
which bypasses `CompiledAgentCache` and therefore the catalog's own
`ResolveAsync`) must still apply this same pipeline by hand - otherwise
the agent runs undecorated: no run recording, no telemetry, no tool-approval
gate.

## Methods

### <a id="Tracon_AgentDecoratorPipeline_Apply_Microsoft_Agents_AI_AIAgent_Tracon_AgentDescriptor_System_Collections_Generic_IEnumerable_Tracon_IAgentDecorator__"></a> Apply\(AIAgent, AgentDescriptor, IEnumerable<IAgentDecorator\>\)

Applies every decorator, ordered from innermost to outermost.

```csharp
public static AIAgent Apply(AIAgent agent, AgentDescriptor descriptor, IEnumerable<IAgentDecorator> decorators)
```

#### Parameters

`agent` AIAgent

The compiled agent.

`descriptor` [AgentDescriptor](/api/tracon.agentdescriptor/)

The catalog summary of the agent.

`decorators` [IEnumerable](https://learn.microsoft.com/dotnet/api/system.collections.generic.ienumerable\-1)<[IAgentDecorator](/api/tracon.iagentdecorator/)\>

The registered decorators.

#### Returns

 AIAgent

The decorated agent.

#### Exceptions

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

 [TraconAgentSourceException](/api/tracon.traconagentsourceexception/)

A decorator threw while decorating the agent.
