Motivation
Some problems cannot be solved in a single pass. Fraud signal correlation, compliance gap analysis, and document confidence scoring all require iterative convergence — the agent must test something, observe the outcome, and decide whether to try again.
Standard one-shot agents cannot model this. The Validation Loop Pattern gives agents a structured skeleton for problems where the answer must be earned through iteration rather than computed in a single step.
Structure
- generate_hypothesis() — form the next thing to test based on prior steps
- run_validation() — invoke a tool, rule engine, LLM, or external system
- evaluate_observation() — interpret the raw result and return a confidence dict
- should_continue() — return CONTINUE, FINALIZE, ESCALATE, or FAIL
- Record the step and repeat, or terminate
- finalize() / escalate() / fail() — produce the final output