adk-web icon indicating copy to clipboard operation
adk-web copied to clipboard

Tool Results Not Displaying in Web UI Main Chat - LLM Summarization Override Issue

Open ashd1710 opened this issue 6 months ago • 1 comments

Problem Summary When using Google Cloud ADK Web UI, tool function results are not displaying in the main chat interface despite functions executing successfully. Results are only visible in the debugging Events tab, creating poor user experience for production applications. Expected Behavior Tool function results should display directly in the main chat interface where users can see formatted outputs from their agents. Actual Behavior -Tool functions execute correctly (verified in Events tab) -Main chat shows generic responses or function call acknowledgments -Detailed tool results hidden in debugging Events tab -Users must navigate to Events → Individual function calls to see actual results

Environment ADK Version: 1.3.0+ Python Version: 3.12 Deployment: Google Cloud Run Browser: Chrome, Safari (tested multiple)

Root Cause Analysis After investigation, discovered the issue relates to ADK's default LLM summarization behavior overriding detailed tool results. The system automatically passes tool outputs through LLM summarization instead of displaying raw formatted results.

Reproduction Steps

  1. Create agent with custom tool that returns formatted data
  2. Deploy with ADK Web UI (adk web)
  3. Query agent that triggers tool
  4. Observe: Main chat shows summarized/generic response
  5. Check Events tab: Full tool results visible there

Code Example pythonfrom google.adk.agents import Agent from google.adk.tools import tool

@tool def stock_analysis_tool(query: str) -> str: """Returns formatted stock analysis""" return """ 📊 Stock Analysis Results

AAPL - Apple Inc.
Price: $196.58
P/E Ratio: 30.86
Analysis: Strong fundamentals with solid growth prospects
"""

class FinancialAgent(Agent): def init(self): super().init( name="financial_agent", model="gemini-1.5-flash", tools=[stock_analysis_tool] )

agent = FinancialAgent() Expected: Users see the formatted stock analysis in main chat Actual: Users see "I found some stock information for you" (summarized) Solution/Workaround Discovered Method 1: Tool Context with skip_summarization pythonfrom google.adk.tools import ToolContext

@tool def stock_analysis_tool(query: str, tool_context: ToolContext = None) -> str: """Returns formatted stock analysis""" if tool_context: tool_context.actions.skip_summarization = True

return formatted_results

Method 2: Agent Configuration pythonclass FinancialAgent(Agent): def init(self): super().init( name="financial_agent", model="gemini-1.5-flash", tools=[stock_analysis_tool], instruction="Display tool results exactly as returned without modification." )

Impact on Developers Production Applications: Poor user experience with hidden results Developer Confusion: Results work in direct calls but not Web UI Documentation Gap: skip_summarization not well documented Debugging Overhead: Developers think tools are broken when they work fine

Suggested Improvements

  1. Documentation Enhancement Add clear examples of skip_summarization usage Document difference between Events tab (debugging) vs main chat (user-facing) Include troubleshooting guide for tool result display issues

  2. Web UI Enhancement Add toggle for "Show Raw Tool Results" in Web UI Better visual indication when results are summarized vs raw Option to configure default summarization behavior per agent

  3. Error Messaging When summarization occurs, show indicator in UI Provide hint about Events tab for debugging Better developer feedback about result processing

Additional Context This issue was discovered while building a financial analysis platform for the Google Cloud ADK Hackathon (#adkhackathon). The platform provides institutional-grade investment analysis, and users expect to see detailed formatted financial data, not AI-summarized versions.

Files That Could Benefit from Updates docs/tools.md - Add skip_summarization examples docs/web-ui.md - Clarify Events tab vs main chat usage examples/ - Include tool result display examples Web UI components - Add raw result display options

ashd1710 avatar Jun 23 '25 15:06 ashd1710

I have the same problem!!! Please fix this bug. Skip_summarization should display the response of function.

Tyrooon avatar Jun 25 '25 08:06 Tyrooon