-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Description
Is your feature request related to a problem? Please describe.
Yes. I am trying to implement a flow where an ADK agent can dynamically skip the LLM summarization step based on user input (e.g., a user asking to "skip summarization").
I discovered that I can successfully stop the LLM from summarizing by setting tool_context.actions.skip_summarization = True within the tool function itself. While this successfully prevents the final LLM summarization call, it results in no final response being returned to the user via stream_query. The stream ends without yielding the tool's output to the client.
Describe the solution you'd like
When tool_context.actions.skip_summarization is set to True, the agent should automatically stream the raw tool output (e.g., the string returned by the python function) back to the user as a final response event.
Describe alternatives you've considered
The only current workaround to see the data is adding a print() statement inside the tool function. This only prints to stdout on the server side and does not help send the data back to the client application. Of course, one can also instruct the root agent to just pass the result verbatim, but that will increase latency.
skip_summarization_feature_request.py
Additional context
Here is a minimal reproduction showing the tool configuration that results in zero events returned in the stream when the flag is set:
from typing import Dict
# --- Core ADK Imports ---
from google.adk.agents import Agent
from google.adk.tools import agent_tool, ToolContext
from vertexai.preview.reasoning_engines import AdkApp
# --- 1. The Tool ---
def get_weather(
tool_context: ToolContext,
skip_summary: bool = False
) -> str:
"""Gets the weather.
Args:
skip_summary (bool): Set to True to return the raw, final string "sunny".
"""
print(f"Tool called. LLM set skip_summary={skip_summary}")
to_return = "Super Duper Very Sunny!!!"
if skip_summary:
print("Tool: Setting skip_summarization=True")
tool_context.actions.skip_summarization = True
#print(to_return) uncomment to print the output, since otherwise nothing is returned.
return to_return
# --- 2. The Agent Setup ---
root_agent = Agent(
name="weather_bot",
model="gemini-2.5-pro",
instruction="You are a weather bot.",
tools=[
get_weather,
]
)