You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(live): Run non-blocking tools in a background task
This change introduces logic to identify and execute tools that are non-blocking in a separate asyncio task. The function now returns immediately for these tools, and the tool's response is sent back through the LiveRequestQueue when the background task completes.
Co-authored-by: Liang Wu <wuliang@google.com>
PiperOrigin-RevId: 945327698
This sample provides a minimal agent to demonstrate non-blocking tool execution in ADK Live mode (`adk web` / `run_live`).
6
+
7
+
When a tool declaration is configured with `response_scheduling` set to `WHEN_IDLE`, `SILENT`, or `INTERRUPT`, it indicates to the model that response handling can occur asynchronously.
8
+
9
+
## Sample Inputs
10
+
11
+
-`Please start a slow background task for data processing, and then let's keep talking.`
12
+
13
+
*Triggers `slow_background_task` which sleeps for 10 seconds. While it runs, continue speaking to the agent.*
14
+
15
+
## Reproduction Instructions
16
+
17
+
1. Run the sample via `adk web`:
18
+
```bash
19
+
uv run adk web contributing/samples/live/live_non_blocking_tool_agent
20
+
```
21
+
1. Open the ADK web interface and start a Live Session with the agent.
22
+
1. Trigger the tool by saying: *"Please start a slow background task and keep talking with me."*
23
+
1. Continue speaking to the agent while the background task runs in console (`[Tool] Starting slow background task...`).
24
+
25
+
### Expected Behavior
26
+
27
+
The model should continue conversing and generating audio/transcription responses immediately while the tool executes in the background. The tool result is delivered later per the `response_scheduling` mode.
0 commit comments