Skip to main content

Validation

What happens when an LLM returns malformed JSON, or a prompt references a field that doesn't exist? Without validation, these errors surface deep in your agentic workflow—often after expensive API calls have already been made.

Agent Actions catches these problems through multiple validation layers, from schema analysis through runtime output validation.

Validation Types​

TypeWhenPurpose
Schema AnalysisBefore executionAnalyze field dependencies and schemas
Schema ValidationAfter LLM responseValidate output structure
GuardsAfter validationFilter or skip based on semantic conditions
AI ExpectationsAfter schema validationDeterministic + LLM-judged semantic checks, observed and reported
Expectation RepairOn expectation failureRegenerate and re-validate until the suite passes, or exhaust into a verdict, tombstone, or halt

Schema Analysis​

Use the schema command to analyze your workflow's field dependencies before running:

bash
BASH
agac schema -a workflow

This shows input/output schemas for each action, helping you catch field reference errors before making API calls.

What It Shows​

InformationDescription
Input FieldsFields the action requires from upstream actions or source data
Output FieldsFields the action produces for downstream actions
DependenciesWhich actions feed into each action
Schema SourcesWhere each schema is defined

Dependency Validation​

The workflow executor validates dependencies at runtime:

yaml
YAML
# ERROR: Circular dependency
actions:
- name: action_a
dependencies: [action_b] # Input source
- name: action_b
dependencies: [action_a] # Circular!

Vendor Compatibility​

Feature support varies by vendor:

VendorJSON ModeBatchToolsVision
OpenAI✅✅✅✅
Anthropic✅✅✅✅
Google✅✅✅✅
Groq✅✅✅❌
Ollama✅✅✅✅

Schema Validation​

Schema validation catches structural errors but can't verify semantic correctness. A response might match your schema but still contain incorrect information—that's where guards and expectations come in.

For schema definition details, see Schemas.

Validation Errors​

Error Categories​

CategoryExamples
templateMissing variables, syntax errors
contextMissing fields, type mismatches
dependencyCircular deps, missing actions
vendorUnsupported features
pathMissing files
schemaOutput doesn't match schema

Runtime Error Format​

Here's what validation output looks like when problems are found at runtime:

text
TXT
SchemaValidationError: Input schema validation failed for tool 'add_answer_text'
at target_word_counts -> correct_answer_words: 18 is not of type 'string'
[Context: function=add_answer_text, validation_type=input,
error_path=target_word_counts -> correct_answer_words,
failed_value=18, schema_constraint={'type': 'string'}]

The error context shows exactly what field failed and why, helping you fix issues quickly.

Learn More​