tl  tr
  Home | Tutorials | Articles | Videos | Products | Tools | Search
Interviews | Open Source | Tag Cloud | Follow Us | Bookmark | Contact   
 Generative AI > Google Gemini API > ADK Agent Chaining with Output Validation

ADK Agent Chaining with Output Validation

Author: Venkata Sudhakar

In multi-agent pipelines, one agent may produce output that the next agent relies on. If the first agent makes an error or returns incomplete data, downstream agents amplify the mistake. Output validation agents act as checkpoints - they inspect the result, flag issues, and either correct or reject it before passing forward. ShopMax India uses this pattern in the pricing pipeline to prevent incorrect prices reaching customers.

The pattern involves a producer agent, a validator agent, and a corrector agent arranged as a sequential pipeline. The validator checks for completeness, range validity, and business rule compliance. If validation fails, the corrector retries with adjusted instructions.

The below example shows the ShopMax India pricing pipeline with output validation.


Running the chained pipeline with validation,


It gives the following output,

Pricing output: {"product": "Sony WH-1000XM5", "price": 29990, "margin_pct": 18}
Validation passed - publishing price

# If margin were 55% (out of range):
Validation failed: margin_pct 55 exceeds maximum 50%
Corrected output: {"product": "Sony WH-1000XM5", "price": 28500, "margin_pct": 22}

For high-stakes pipelines at ShopMax India, add a third audit agent that logs all validation failures to Cloud Logging with severity WARNING. This creates a trail for monthly pricing accuracy reviews and helps identify which product categories trigger the most correction cycles.


 
  


  
bl  br