Validation Loop Pattern
Это содержимое пока не доступно на вашем языке.
Purpose
Section titled “Purpose”Ensure quality by verifying results and retrying if they don’t meet criteria. Prevents low-quality outputs from proceeding.
Structure
Section titled “Structure”[action] → [check] → success → [next] ↓ failure → [fix] → [increment-iteration] → [action]Implementation
Section titled “Implementation”Action Node
Section titled “Action Node”{ "type": "agent-directive", "id": "do-work", "directive": "Complete the task. Iteration: {{current_iteration}}", "completionCondition": "Task completed with quality standards met", "inputSchema": { "type": "object", "properties": { "result": { "type": "string" }, "quality_check_passed": { "type": "string", "enum": ["yes", "no"] } }, "required": ["result", "quality_check_passed"] }, "connections": { "success": "check-quality" }}Check Node
Section titled “Check Node”{ "type": "condition", "id": "check-quality", "condition": { "operator": "eq", "left": { "contextPath": "quality_check_passed" }, "right": "yes" }, "connections": { "true": "next-step", "false": "fix-issues" }}Fix Node
Section titled “Fix Node”{ "type": "agent-directive", "id": "fix-issues", "directive": "Fix issues found in iteration {{current_iteration}}. Previous result: {{result}}", "connections": { "success": "increment-iteration" }}Iteration Counter
Section titled “Iteration Counter”Using expression node:
{ "type": "expression", "id": "increment-iteration", "expressions": ["current_iteration = current_iteration + 1"], "connections": { "default": "do-work" }}With Max Iterations
Section titled “With Max Iterations”Add check before retry:
{ "type": "condition", "id": "check-max-iterations", "condition": { "operator": "lt", "left": { "contextPath": "current_iteration" }, "right": 5 }, "connections": { "true": "do-work", "false": "escalate-to-user" }}Numeric Quality Check
Section titled “Numeric Quality Check”For measurable quality:
{ "inputSchema": { "properties": { "quality_score": { "type": "number", "minimum": 0, "maximum": 10 } }, "required": ["quality_score"] }}{ "condition": { "operator": "gte", "left": { "contextPath": "quality_score" }, "right": 8 }}Real Example
Section titled “Real Example”From development-flow.json:
{ "id": "verify-step-implementation", "directive": "Verify step {{current_step_name}} implementation:\n- Expected: {{expected_outcome}}\n- Check actual matches expected", "inputSchema": { "properties": { "step_verified": { "type": "string", "enum": ["yes", "no"] }, "verification_evidence": { "type": "string" } }, "required": ["step_verified", "verification_evidence"] }}Related Patterns
Section titled “Related Patterns”- Step Verification - Verify specific steps
- Escalation - Handle repeated failures