Skip to content

Streaming tools example in the documentation does not work #3955

Closed
google/adk-web
#382

Description

@alvarossl

Describe the bug
The streaming tool example in https://google.github.io/adk-docs/streaming/streaming-tools/ returns errors on tool invokation.

To Reproduce

Steps to reproduce the behavior:
Run adk create streaming-tool-example
Take the code from the documentation and replace in agent.py file (adding right imports, API key etc)
Run adk web

Error 1 - running the example as is

ValueError: Failed to parse the parameter return_value: AsyncGenerator[str, NoneType] of function monitor_stock_price for automatic function calling.Automatic function calling works best with simpler function signature schema, consider manually parsing your function declaration for function monitor_stock_price.

Error 2 - removing type hinting from the monitor_stock_price function

async def monitor_stock_price(stock_symbol: str) -> AsyncGenerator[str, None]:
with
async def monitor_stock_price(stock_symbol: str):

Running adk web and requesting the agent eg "provide stock price for GOOGL" returns the following error:

Unable to serialize unknown type: <class 'async_generator'>.
TypeError: cannot pickle 'async_generator'

Desktop (please complete the following information):

  • OS: macOS
  • Python version(python -V): Python 3.11.14
  • ADK version(pip show google-adk): 1.21.0 , 1.18.0 (tested both)

Model Information:

  • Are you using LiteLLM: No
  • gemini-2.0-flash-exp

Activity

  1. added
    documentation[Component] This issue is related to documentation, it will be transferred to adk-docs
    on Dec 17, 2025
  2. added theissue type on Dec 17, 2025
  3. alvarossl commented on Dec 18, 2025

    @alvarossl
    Author

    More detail on error 2:

    2025-12-18 11:53:36,801 - ERROR - adk_web_server.py:1509 - Error in event_generator: Unable to serialize unknown type: <class 'async_generator'>
    Traceback (most recent call last):
    File "/opt/anaconda3/envs/agent-conda/lib/python3.11/site-packages/google/adk/cli/adk_web_server.py", line 1499, in event_generator
    async for event in agen:
    File "/opt/anaconda3/envs/agent-conda/lib/python3.11/site-packages/google/adk/runners.py", line 505, in run_async
    async for event in agen:
    File "/opt/anaconda3/envs/agent-conda/lib/python3.11/site-packages/google/adk/runners.py", line 493, in _run_with_trace
    async for event in agen:
    File "/opt/anaconda3/envs/agent-conda/lib/python3.11/site-packages/google/adk/runners.py", line 769, in _exec_with_plugin
    await self.session_service.append_event(
    File "/opt/anaconda3/envs/agent-conda/lib/python3.11/site-packages/google/adk/cli/utils/local_storage.py", line 200, in append_event
    return await service.append_event(session, event)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/opt/anaconda3/envs/agent-conda/lib/python3.11/site-packages/google/adk/sessions/sqlite_session_service.py", line 392, in append_event
    event.model_dump_json(exclude_none=True),
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/opt/anaconda3/envs/agent-conda/lib/python3.11/site-packages/pydantic/main.py", line 528, in model_dump_json
    return self.pydantic_serializer.to_json(
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    pydantic_core._pydantic_core.PydanticSerializationError: Unable to serialize unknown type: <class 'async_generator'>

  4. self-assigned this
    on Jan 9, 2026
  5. llalitkumarrr commented on Jan 9, 2026

    @llalitkumarrr
    Collaborator

    Hello @alvarossl ,

    Thank you for bringing this to our attention. We have reproduced the issue and observed the same error. We are currently investigating it in detail. In the meantime, could you please check if Bidi Streamer meets your requirements?

  6. added
    live[Component] This issue is related to live, voice and video chat
    on Jan 9, 2026
  7. added
    stale[Status] Issues which have been marked inactive since there is no user response
    request clarification[Status] The maintainer need clarification or more information from the author
    on Jan 17, 2026
  8. added
    good first issue[Community] This issue is good for newcomers to participate
    and removed
    request clarification[Status] The maintainer need clarification or more information from the author
    stale[Status] Issues which have been marked inactive since there is no user response
    on Jan 21, 2026
  9. deleted a comment from adk-bot on Jan 21, 2026
  10. morganroux commented on Jan 21, 2026

    @morganroux
    Contributor

    Hello @llalitkumarrr
    Jumping right from the ADK community call, did your team already start working on this ?
    I can have a look as a first issue.

  11. morganroux commented on Jan 25, 2026

    @morganroux
    Contributor

    After investigating, I found the root cause: adk web doesn't call the /run_live endpoint when using text input. As a result, streaming tools are not processed correctly.

    Quick workaround: Using the microphone button and speaking to the agent (instead of typing) triggers the correct /run_live endpoint, which properly showcases the example.

    Proposed solutions:

    1. Documentation update: Clarify that this example currently only works with the live-audio option, and direct users to the bidi-demo sample for reference.

    2. Feature enhancement: I can dig into implementing text-based live streaming in adk web, similar to how it's done in the bidi-demo, to enable the /run_live endpoint for text input.

    What do you think @llalitkumarrr?

  12. llalitkumarrr commented on Feb 5, 2026

    @llalitkumarrr
    Collaborator

    Hello @morganroux ,

    Thank you for taking time to dig deep into this, you are welcome to raise PR with your proposed solution. Our team will review it and merge once all checks are cleared.

  13. ItsMacto commented on Feb 11, 2026

    @ItsMacto
    Contributor

    Hi this PR works to close this issue: #4447

  14. llalitkumarrr commented on Feb 11, 2026

    @llalitkumarrr
    Collaborator

    Hello @ItsMacto ,

    I think this PR needs to be rebased as the branch is currently out of date. Could you please take a look at this?

    @ryanaiagent , could you please guide us on the next steps required to merge this?

  15. ItsMacto commented on Feb 11, 2026

    @ItsMacto
    Contributor

    Hi @llalitkumarrr ,
    Should be up-to-date with main. Thanks

  16. morganroux commented on Feb 14, 2026

    @morganroux
    Contributor

    Hello @ItsMacto @llalitkumarrr @ryanaiagent
    I just finished my PR to solve the issue here on adk-web side.

  17. morganroux commented on Mar 1, 2026

    @morganroux
    Contributor

    @llalitkumarrr can you help me to move my adk-web PR forward please ?

  18. llalitkumarrr commented on Mar 16, 2026

    @llalitkumarrr
    Collaborator

    Hello @rohityan ,

    Please take a look at this.

  19. adk-bot commented on Mar 24, 2026

    @adk-bot
    Collaborator

    This issue has been automatically marked as stale because it has not had recent activity for 7 days after a maintainer requested clarification. It will be closed if no further activity occurs within 7 days.

  20. added
    stale[Status] Issues which have been marked inactive since there is no user response
    request clarification[Status] The maintainer need clarification or more information from the author
    on Mar 24, 2026
  21. adk-bot commented on Mar 31, 2026

    @adk-bot
    Collaborator

    This has been automatically closed because it has been marked as stale for over 7 days.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

documentation[Component] This issue is related to documentation, it will be transferred to adk-docsgood first issue[Community] This issue is good for newcomers to participatelive[Component] This issue is related to live, voice and video chatrequest clarification[Status] The maintainer need clarification or more information from the authorstale[Status] Issues which have been marked inactive since there is no user response

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions