Skip to main content

Validation

Validation finds errors before they cause cost. An LLM can return malformed JSON. A prompt can refer to a field that does not exist. With no validation, these errors occur deep in your workflow. They often occur after the workflow has already sent expensive API calls.

Agent Actions finds these errors with multiple validation layers. The layers start with schema analysis and end with runtime output validation.

Validation Types​

TypeWhenPurpose
Schema AnalysisBefore executionAnalyze field dependencies and schemas
Schema ValidationAfter LLM responseValidate output structure
GuardsBefore a downstream action runsFilter or skip a record. The guard uses semantic conditions on the upstream output.
AI ExpectationsAfter schema validationDeterministic checks and semantic checks that an LLM judges. Agent Actions observes and reports the results.
Expectation RepairWhen an expectation failsGenerate the output again and validate it again until the suite passes. If the attempts are exhausted, the result is a verdict, a tombstone or a halt.

Schema Analysis​

To analyze the field dependencies of your workflow before you run it, use the schema command:

bash
BASH
agac schema -w workflow

The command shows the input schema and the output schema of each action. Thus you can find field reference errors before the workflow sends API calls.

What It Shows​

InformationDescription
Action and TypeEach action and its kind (llm, tool)
InputThe fields that the action requires from upstream actions or from the source data
OutputThe fields that the action produces for downstream actions

To show a data-flow tree, add --verbose. The tree lists the fields that each action expects and produces. To show machine-readable output, add --json.

Dependency Validation​

When Agent Actions loads the workflow configuration, it validates the dependencies. Thus Agent Actions refuses a cycle before any action runs (Circular dependency detected: action_a -> action_b -> action_a):

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

Vendor Compatibility​

The supported features are different for each vendor. This table lists some of the vendors. For all vendors, see Vendor Support:

VendorJSON ModeBatchToolsVision
OpenAI✅✅ (not with base_url)✅✅
Anthropic✅✅✅✅
Gemini✅✅✅✅
Groq✅✅✅❌
Ollama✅✅✅✅

Schema Validation​

Schema validation finds structural errors. It cannot verify that the content is semantically correct. A response might match your schema and still contain incorrect information. Guards and expectations find these errors.

For the details of how to define a schema, see Schemas.

Validation Errors​

Error Categories​

A preflight issue about vendor support or about file paths has a category in its error context:

CategoryExamples
vendorUnsupported features
pathMissing files

Runtime Error Format​

This example shows the validation output when Agent Actions finds problems at runtime:

text
TXT
SchemaValidationError: Input schema validation failed for UDF 'add_answer_text'
at target_word_counts -> correct_answer_words: 18 is not of type 'string'

The message gives the name of the tool, the path to the field that failed and the reason. Thus you can fix the issue quickly. The context of the error also has function, validation_type, error_path, failed_value and schema_constraint.

Learn More​

  • Output Validation Pipeline - Validation in multiple layers, with guards and expectations
  • AI Expectations - Deterministic checks and LLM-judged semantic checks with expect:, and the repair loop that generates the output again when a check fails
  • Troubleshooting - Debug errors, trace the data lineage, and find common fixes