# AgentServiceAnnotation Constructors

- Package: [Aspire.Hosting.AgentFramework.DevUI](/reference/api/csharp/aspire.hosting.agentframework.devui.md)
- Type: [AgentServiceAnnotation](/reference/api/csharp/aspire.hosting.agentframework.devui/agentserviceannotation.md)
- Kind: `Constructors`
- Members: `1`

An annotation that tracks an agent service backend referenced by a DevUI resource.

## AgentServiceAnnotation(IResource, string?, IReadOnlyList<AgentEntityInfo>)

- Name: `Constructor(IResource, string?, IReadOnlyList<AgentEntityInfo>)`

Initializes a new instance of the [AgentServiceAnnotation](/reference/api/csharp/aspire.hosting.agentframework.devui/agentserviceannotation.md) class.

```csharp
public class AgentServiceAnnotation
{
    public AgentServiceAnnotation(
        IResource agentService,
        string? entityIdPrefix = null,
        IReadOnlyList<AgentEntityInfo>? agents = null)
    {
        // ...
    }
}
```

## Parameters

- `agentService` (`IResource`)
  The agent service resource.
- `entityIdPrefix` (`string?`) `optional`
  An optional prefix to add to entity IDs from this backend to avoid conflicts. If not specified, the resource name will be used as the prefix.
- `agents` ([IReadOnlyList<AgentEntityInfo>](/reference/api/csharp/aspire.hosting.agentframework.devui/agententityinfo.md)) `optional`
  Optional list of agents declared by this backend. When provided, the aggregator builds the entity listing directly from these declarations instead of querying the backend's `/v1/entities` endpoint.
