Skip to content

AgentDefinitionValidator

Namespace AgentPrism · Assembly AgentPrism.Core.dll

Validates an AgentDefinition without saving it or calling a model.

public sealed class AgentDefinitionValidator

objectAgentDefinitionValidator

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

Validation is valuable only when it does what the real compilation path, AgentDefinitionCompiler, would do. Because the compiler throws on its first error, this type runs every check independently and in order, gathers all findings, then calls AgentDefinitionCompiler.Compile last to find remaining structural errors, such as reasoning effort or compaction settings.

The compiled AI.AIAgent is discarded. No runs row is opened and no token is spent.

AgentDefinitionValidator(IModelProviderRegistry, IToolRegistry, AgentSkillCatalog, IAgentCatalog, AgentDefinitionCompiler, IOptions<AgentPrismOptions>, IMcpToolRefresher?)

Section titled “ AgentDefinitionValidator(IModelProviderRegistry, IToolRegistry, AgentSkillCatalog, IAgentCatalog, AgentDefinitionCompiler, IOptions<AgentPrismOptions>, IMcpToolRefresher?)”

Initializes an agent-definition validator.

public AgentDefinitionValidator(IModelProviderRegistry models, IToolRegistry tools, AgentSkillCatalog skills, IAgentCatalog catalog, AgentDefinitionCompiler compiler, IOptions<AgentPrismOptions> options, IMcpToolRefresher? mcpRefresher = null)

models IModelProviderRegistry

The model provider registry.

tools IToolRegistry

The tool registry.

skills AgentSkillCatalog

The skill catalog.

catalog IAgentCatalog

The agent catalog used to validate the call graph.

compiler AgentDefinitionCompiler

The actual compiler run when independent validation passes.

options IOptions<AgentPrismOptions>

The options that provide AgentPrismValidationOptions.McpTimeout.

mcpRefresher IMcpToolRefresher?

When registered, refreshes the MCP tool list after a missing tool name is found. When null, AgentPrism.Mcp is not registered and missing tool names are reported directly as errors.

ArgumentNullException

A required dependency is null.

ValidateAsync(AgentDefinition, CancellationToken)

Section titled “ ValidateAsync(AgentDefinition, CancellationToken)”

Validates a definition without saving it or calling a model.

public ValueTask<AgentValidationReport> ValidateAsync(AgentDefinition definition, CancellationToken cancellationToken = default)

definition AgentDefinition

The definition to validate.

cancellationToken CancellationToken

The cancellation token.

ValueTask<AgentValidationReport>

The report containing all findings.

ArgumentNullException

definition is null.