Skip to content
Tracon

AgentParameterValidator

Namespace Tracon · Assembly Tracon.Core.dll

Validates an AgentDefinition’s parameter schema, and validates a run’s supplied values against it.

public static class AgentParameterValidator

objectAgentParameterValidator

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

Two independent checks live here, run at two different times:

  • AgentParameterValidator.ValidateSchema - compile-time self-consistency of the schema against the instructions text. Runs inside AgentDefinitionCompiler, so POST /api/agents, PUT /api/agents/{name}, and POST /api/agents/validate all inherit it through the compile step they already run.
  • AgentParameterValidator.ValidateValues - run-time check of a request’s parameter values against the schema. POST /api/agents/{name}/run and POST /api/agents/{name}/estimate both call this same method, so a missing or unknown parameter produces the identical error on both endpoints.

Error code: a required parameter has neither a supplied value nor a default.

public const string MissingParameterCode = "missing_parameter"

string

Error code: a supplied value’s name is not declared in the schema.

public const string UnknownParameterCode = "unknown_parameter"

string

Error code: a supplied value exceeds the configured maximum length.

public const string ValueTooLongCode = "value_too_long"

string

Checks a definition’s parameter schema against its own instructions text.

public static IReadOnlyList<string> ValidateSchema(AgentDefinition definition)

definition AgentDefinition

The definition being compiled.

IReadOnlyList<string>

One message per violation; empty when the schema is self-consistent. A definition with an empty AgentDefinition.Parameters list is never checked against its text - {{...}} is plain text for an agent that declares no parameters at all, and stays that way (no surprise for the agents that never opt into this feature).

ValidateValues(IReadOnlyList<AgentParameter>, IReadOnlyDictionary<string, string>?, int?)

Section titled “ ValidateValues(IReadOnlyList<AgentParameter>, IReadOnlyDictionary<string, string>?, int?)”

Checks a run’s supplied parameter values against a definition’s schema.

public static AgentParameterValidationResult ValidateValues(IReadOnlyList<AgentParameter> schema, IReadOnlyDictionary<string, string>? values, int? maxValueLength = null)

schema IReadOnlyList<AgentParameter>

The target agent’s parameter schema.

values IReadOnlyDictionary<string, string>?

The values a run request supplied. null means none.

maxValueLength int?

The largest UTF-8 byte count a supplied value may have. null means no limit (the default, kept for a caller that predates this check).

AgentParameterValidationResult

The validation outcome.

ArgumentNullException

schema is null.