Skip to content

CodeAgentRegistration

Namespace AgentPrism · Assembly AgentPrism.Core.dll

A code-defined agent registration. Use one of two forms: declarative CodeAgentRegistration.Definition or CodeAgentRegistration.Factory, which gives full control.

public sealed class CodeAgentRegistration

objectCodeAgentRegistration

object.GetType(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()

The declarative definition, or null when CodeAgentRegistration.Factory is used.

public AgentDefinition? Definition { get; }

AgentDefinition?

A short description.

public string? Description { get; }

string?

The name displayed in the UI.

public string? DisplayName { get; }

string?

The factory that creates the agent, or null when CodeAgentRegistration.Definition is used.

public Func<IServiceProvider, AIAgent>? Factory { get; }

Func<IServiceProvider, AIAgent>?

The agent name.

public string Name { get; }

string

Creates a declarative registration. The definition passes through the AgentPrism compiler, which validates tools and the model.

public static CodeAgentRegistration FromDefinition(AgentDefinition definition)

definition AgentDefinition

The agent definition.

CodeAgentRegistration

The registration.

ArgumentNullException

definition is null.

FromFactory(string, Func<IServiceProvider, AIAgent>, string?, string?)

Section titled “ FromFactory(string, Func<IServiceProvider, AIAgent>, string?, string?)”

Creates a factory-based registration. The caller fully controls how the agent is built. AgentPrism only exposes it in the catalog and wraps it with run recording.

public static CodeAgentRegistration FromFactory(string name, Func<IServiceProvider, AIAgent> factory, string? description = null, string? displayName = null)

name string

The agent name.

factory Func<IServiceProvider, AIAgent>

The factory that creates the agent.

description string?

A short description.

displayName string?

The name displayed in the UI.

CodeAgentRegistration

The registration.

ArgumentException

name is empty.

ArgumentNullException

factory is null.