This sample demonstrates how to handle failures, timeouts, and partial results from downstream agents in multi-agent workflows using ADK.
adk web contributing/samples/agent_tool_resilienceThen in the web UI, select agent_tool_resilience from the dropdown and try:
- Simple query: "What is quantum computing?"
- Complex query: (very detailed research request) as "Research quantum computing applications in healthcare, finance, cryptography, logistics, weather prediction, drug discovery, and machine learning. For each domain, provide: historical context, current state-of-the-art, technical challenges, recent breakthroughs in 2024, comparison with classical approaches, economic impact, and future roadmap for the next 10 years."
- Timeout scenario: Set timeout to 5 seconds in
agent.pyand use a complex query
- Timeout Protection: Custom
TimeoutAgentToolwrapper adds timeout handling to sub-agents - Automatic Retry:
ReflectAndRetryToolPluginhandles retries with structured guidance - Dynamic Fallback: Coordinator agent routes to alternative agents when primary fails
- Error Recovery: Specialized agent provides user-friendly error analysis
- Normal Operation: Primary agent handles the query successfully
- Timeout Scenario: Primary times out → Fallback agent is automatically tried
- Failure Scenario: Primary fails → Retry → Fallback → Error recovery agent provides guidance
The sample includes:
coordinator_agent- Routes requests and handles errorsresearch_agent_primary- Primary agent with timeout protection (5s)research_agent_fallback- Fallback agent with longer timeout (60s)error_recovery_agent- Analyzes failures and provides recommendations