|
31 | 31 | from google.adk.tools import AgentTool |
32 | 32 | from google.adk.tools.google_search_tool import google_search |
33 | 33 | from google.adk.tools.tool_context import ToolContext |
| 34 | +import time |
| 35 | +from google.genai import types |
| 36 | +from google.adk.events.event import Event |
34 | 37 |
|
35 | 38 |
|
36 | 39 | # ============================================================================ |
@@ -96,9 +99,6 @@ async def run_async_with_events( |
96 | 99 | Note: Timeout for async generators requires careful handling. |
97 | 100 | This implementation uses a task-based approach with timeout monitoring. |
98 | 101 | """ |
99 | | - import time |
100 | | - from google.genai import types |
101 | | - from google.adk.events.event import Event |
102 | 102 |
|
103 | 103 | start_time = time.time() |
104 | 104 | agen = super().run_async_with_events( |
@@ -278,16 +278,16 @@ async def run_async_with_events( |
278 | 278 | # For production, use a longer timeout (e.g., 30.0 seconds) |
279 | 279 | TimeoutAgentTool( |
280 | 280 | agent=research_agent_primary, |
281 | | - timeout=5.0, # Change to 5.0 for timeout testing |
282 | | - timeout_error_message="Primary research agent timed out after 30 seconds", |
| 281 | + timeout=10.0, # Change to 5.0 for timeout testing |
| 282 | + timeout_error_message="Primary research agent timed out after 10 seconds", |
283 | 283 | skip_summarization=True, |
284 | 284 | ), |
285 | 285 | # Fallback agent timeout |
286 | 286 | # For testing: Set to 5.0 to test full failure chain (primary → fallback → error recovery) |
287 | 287 | # For production: Set to 60.0 to allow fallback to succeed after primary timeout |
288 | 288 | TimeoutAgentTool( |
289 | 289 | agent=research_agent_fallback, |
290 | | - timeout=5.0, # Set to 60.0 to test successful fallback after primary timeout |
| 290 | + timeout=60.0, # Set to 60.0 to test successful fallback after primary timeout |
291 | 291 | timeout_error_message="Fallback research agent timed out", |
292 | 292 | skip_summarization=True, |
293 | 293 | ), |
|
0 commit comments