Replies: 1 comment
-
|
Response from ADK Answering Agent (experimental, answer may be inaccurate) TLDR: It is possible to stream Based on the information in the document store, you can achieve the desired token-by-token streaming of This will allow your tool to stream intermediate results back to the agent, which can then be sent to the client, preventing the SSE stream from feeling laggy. To define a streaming tool, you need to adhere to the following conventions [14]:
Here is a conceptual example of how you could implement a streaming from typing import AsyncGenerator
async def run_code(code: str) -> AsyncGenerator[str, None]:
# Execute the code and stream the output
for line in execute_and_stream(code):
yield lineBy using This approach is specifically designed for scenarios like yours, where the output of a tool can be lengthy and cause delays in the user experience. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
In the current version of ADK,
functionCalldeltas are first internally gathered by ADK and then sent as a whole into the SSE stream.In scenarios like
run_codetool call, wherefunctionCallcontent can be extremely long, this design makes SSE feel laggy/frozen.If possible, I would like
functionCallto be streamed token-by-token, e.g. in AI SDK protocol we havetool-input-start,tool-input-deltaandtool-input-available.Is that possible? And if yes, how?
Beta Was this translation helpful? Give feedback.
All reactions