Repository navigation
Conversation
A live tool that declares `input_stream: LiveRequestQueue` only got one when it was an async generator, so a tool that reads the user's audio or video and answers with a single value failed with a missing-argument TypeError. Create the stream from the signature alone, on both the per-call and the non-blocking launch path. `is_generator` keeps its current meaning, so teardown and stop_streaming are unchanged.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Please ensure you have read the contribution guide before creating a pull request.
Link to Issue or Description of Change
Problem:
A live tool that declares
input_stream: LiveRequestQueuereceives that stream only when it is an async generator. A tool that watches the user's audio or video and answers with a single value gets no stream, so the call fails withTypeError: describe_scene() missing 1 required positional argument: 'input_stream'and the model is told the tool failed with an internal error. ANON_BLOCKINGtool never gets a stream either. The model cannot supply the argument itself, becauseinput_streamis always excluded from the function declaration.Solution:
Decide whether to create the stream from the signature alone, which is what
_new_input_streamalready checks, instead of fromis_generator. Both launch paths now register it:_launch_function_call_liveand_launch_non_blocking_call_live.is_generatorkeeps its current meaning. Teardown,stop_streamingandwait_for_tool_callsread it to decide whether a call runs until stopped, and a tool that returns once still finishes on its own, so none of that changes. Each call still gets its own queue, and the entry is still retired in the call'sfinally, so a finished call stops collecting the user's input.Testing Plan
Unit Tests:
Five tests, all failing before the change and passing after:
tests/unittests/flows/llm_flows/tools/test_live_caller.pytest_plain_tool_declaring_an_input_stream_receives_onetest_non_blocking_tool_declaring_an_input_stream_receives_onetest_parallel_plain_calls_each_get_their_own_streamtests/unittests/streaming/test_live_tool_shutdown.pytest_tool_that_returns_once_still_receives_live_input— a fullrun_liveturn: the tool reads what the user sends while it runs and answers once.test_finished_tool_stops_receiving_live_input— after the answer, 25 more audio chunks are sent and the call is no longer registered, so its queue is not left growing for the rest of the session.Wider regression run over the live and tool-calling suites:
The one error and two excluded modules are environment gaps in my local venv, present before this change and unrelated to it:
test_live_streaming_configs.py::test_streaming_default_model_when_not_specifiedneeds thepytest-mockmockerfixture, andtest_audio_transcriber.py/test_rearranger.pyimportanthropic, which I do not have installed. CI covers all three.Before the change, with only the tests applied:
Manual End-to-End (E2E) Tests:
The two
run_livetests above drive the real runner, live request queue and background-tool registry against the in-repo mock live connection, so no API key or model endpoint is involved. The agent is:Before the change the model receives
{'error': 'Invokingdescribe_scene()failed with an internal error.'}; after it,{'scene': 'described'}.I have not run this against a real Gemini Live endpoint, so the device-level audio path is unverified. The failure and the fix are both in how ADK builds the call arguments, which the mock connection exercises in full.
Checklist
Additional context
pyink25.12,isort8.0.1,ruff0.15.17 andscripts/compliance_checks.pyare clean on the three changed files.The docs describe this parameter under streaming tools (runner live guide). Once this lands I will open an adk-docs PR to say that any live tool may declare it, not only async generators.