Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Comments

Close side panel

feat: Add progressive streaming for run_async via ProgressiveTool (partial progress + final result)#2698

Closed
ac-machache wants to merge 1 commit intogoogle:maingoogle/adk-python:mainfrom
ac-machache:feature/nonlive-runner-streaming-toolsac-machache/adk-python:feature/nonlive-runner-streaming-toolsCopy head branch name to clipboard
Closed

feat: Add progressive streaming for run_async via ProgressiveTool (partial progress + final result)#2698
ac-machache wants to merge 1 commit intogoogle:maingoogle/adk-python:mainfrom
ac-machache:feature/nonlive-runner-streaming-toolsac-machache/adk-python:feature/nonlive-runner-streaming-toolsCopy head branch name to clipboard

Conversation

@ac-machache
Copy link
Contributor

Linked Issue

Closes: #2014

Summary

This PR introduces progressive streaming support for non-live runs (run_async).

  • Tools can now emit intermediate progress updates as partial function_response events.
  • Only the final function_response is injected back into the model.
  • Intermediate results are surfaced to the user/runner only, not used by the model for reasoning.
  • Live runner behavior remains unchanged (live mode continues to inject intermediates into the model loop).
  • Existing non-progressive tools remain unaffected.

Rationale

Users need progress visibility for long-running tools during run_async, without switching to the live APIs.
This feature mirrors live runner ergonomics while remaining opt-in and ensuring model reasoning is unchanged (only final outputs affect the model).

New API

  • google.adk.tools.progressive_function_tool.ProgressiveFunctionTool (abstract base)
  • google.adk.tools.progressive_tool.ProgressiveTool (convenience wrapper)

Supported patterns:

  • Async generator: each yield → partial; last yield → final
  • Async coroutine with optional progress or progress_callback: injected reporter emits partials; return value → final

Changes

  • src/google/adk/flows/llm_flows/base_llm_flow.py
    • _postprocess_handle_function_calls_async updated to handle progressive tools (stream partials + final).
  • src/google/adk/flows/llm_flows/functions.py
    • Added iter_progressive_function_calls_async(...) to stream partials and yield a final function_response.
  • src/google/adk/tools/progressive_function_tool.py
    • New abstract base class for progressive tools.
  • src/google/adk/tools/progressive_tool.py
    • Wrapper to support async generators or injected progress callbacks.
    • Excludes progress params from function schema (_ignore_params).
  • src/google/adk/tools/__init__.py
    • Export ProgressiveTool.

Backward Compatibility

  • No behavior changes for existing tools or live runs.
  • Non-progressive tools continue to return only a single final result.
  • Progressive streaming is opt-in.

Testing Plan

Unit Tests (added)

  • Tools: tests/unittests/tools/test_progressive_tool.py

    • Streams partial + final results
    • Final equals last yield
    • Error → converted to final
    • Multiple progressive tools in one turn
    • Non-progressive tool unaffected
    • Callback style (progress, progress_callback)
    • Direct run_async returns last yield
  • Flows: tests/unittests/flows/llm_flows/test_progressive_flow.py

    • Flow emits partial then final with ProgressiveTool
    • Subclass of ProgressiveFunctionTool supported
    • Fallback path works for non-progressive tools
  • Functions: tests/unittests/flows/llm_flows/test_functions_progressive_unit.py

    • Progressive iteration streams + final
    • Error handling converts to final
    • Parallel merge of function response events

Commands:

# Run only progressive tool/flow tests
pytest -q tests/unittests/tools/test_progressive_tool.py \
         tests/unittests/flows/llm_flows/test_progressive_flow.py \
         tests/unittests/flows/llm_flows/test_functions_progressive_unit.py
  

Manual End-to-End (E2E)

Minimal script with InMemoryRunner + ProgressiveTool(export_report) (async generator).

Observed output (truncated):

Partial events:

{"status": "started", "country": "Germany"}
{"status": "progress", "percent": 20}
...
{"status": "progress", "percent": 100}
{"status": "completed", "url": "https://example.com/germany.pdf"}

Model Reply

The report for Germany has been exported and can be accessed at https://example.com/germany.pdf

Documentation

No user-facing docs changed in this PR.
A follow-up PR to adk-docs will add a short usage guide for ProgressiveTool.

@adk-bot adk-bot added bot triaged core [Component] This issue is related to the core interface and implementation labels Aug 23, 2025
@adk-bot adk-bot requested a review from Jacksunwei August 23, 2025 10:59
@ac-machache ac-machache marked this pull request as ready for review August 23, 2025 11:00
@hangfei
Copy link
Collaborator

hangfei commented Nov 5, 2025

Could you fix the merge conflicts?

@sandangel
Copy link

hi @hangfei
I resolved the merge conflict in this PR, could you help me take a look and merge this soon to release in 1.19?
I'm kind of really need this feature.

Warm regards

https://github.com/google/adk-python/pull/3564/files

@shanmukhaditya
Copy link

Hello @hangfei any update on when this PR will get merged?

@ryanaiagent
Copy link
Collaborator

Hi @ac-machache , I am closing this pull request for now due to the lack of recent updates regarding the requested changes. Please feel free to reopen this (or submit a new PR) once you have had a chance to address the feedback.
Thank you for your contribution.

@ryanaiagent ryanaiagent added the request clarification [Status] The maintainer need clarification or more information from the author label Feb 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core [Component] This issue is related to the core interface and implementation request clarification [Status] The maintainer need clarification or more information from the author

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Master issue: [Streaming Tools] support streaming intermediate results for tools for non-streaming case

7 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.