adk-docs icon indicating copy to clipboard operation
adk-docs copied to clipboard

feat: Add documentation for early exit mechanism to SequentialAgent using escalate action #2999

Open tommyhutcheson opened this issue 2 months ago • 0 comments

Summary

Adds documentation for the early exit mechanism in SequentialAgent using the exit_sequence tool.

Related Python PR: google/adk-python#2999

Changes

New Section: "Early Exit with exit_sequence"

  • Explains when to use early exit (validation failures, empty results, blocking conditions)
  • Usage example showing how to call exit_sequence from a tool
  • Practical example: Search → Analysis → Report pipeline
  • Cross-reference to LoopAgent's exit_loop for consistency

Corrected Implementation Details:

  • Clarified that exit_sequence is supported in both async and live streaming modes
  • Documented that escalate action provides immediate termination in live mode
  • Noted that task_completed() remains available for natural completion signals

Documentation Structure

The new section is placed between "How it works" and "Full Example: Code Development Pipeline" to maintain logical flow:

  1. Introduction and use cases
  2. Basic usage with code example
  3. Practical pipeline example
  4. Live mode support note
  5. Comparison to LoopAgent

Key Updates

  • Added import examples showing exit_sequence alongside other tools
  • Included practical search pipeline demonstrating early exit on empty results
  • Cross-referenced LoopAgent documentation for consistent patterns
  • Clarified behaviour in both async and live modes

Fixes documentation gap for feature introduced in google/adk-python#2999

tommyhutcheson avatar Sep 22 '25 19:09 tommyhutcheson