mirror of
https://github.com/CopilotKit/CopilotKit.git
synced 2026-09-14 16:26:20 +08:00
f1d5d80c00
## What & why The **"Frontend Tools"** demo (`setThemeColor`) silently fails in `examples/integrations/adk`: asking "set the theme to green" makes the agent reply *"I can only help with proverbs or the weather"* and nothing recolors. **Root cause:** the ADK agent's tools are static `[set_proverbs, get_weather]`. `ag_ui_adk` only injects a run's forwarded client tools (the frontend-registered `setThemeColor`) into the LLM's tool set when the agent's `tools` include an **`AGUIToolset`** placeholder — it swaps that for a `ClientProxyToolset` wired to `input.tools`. Without it, `gemini-2.5-flash` never sees `setThemeColor` and declines. (No CopilotKit ADK example currently includes `AGUIToolset`, and the docs don't mention it.) ## Change ```python from ag_ui_adk import ADKAgent, add_adk_fastapi_endpoint, AGUIToolset ... tools=[set_proverbs, get_weather, AGUIToolset()], ``` Agent-side only; no prompt change needed. ## Testing Verified **live** (real Gemini key) via the identical change in `examples/integrations/adk-angular` (same `agent/main.py` + `ag_ui_adk` adapter): "Set the theme to green" now recolors the panel; before the fix the agent refused. Because the fix is agent-side and framework-agnostic, and `setThemeColor` was already confirmed forwarded in the run body, the React `adk` frontend + this agent behaves identically. ## Related - Companion to CopilotKit/CopilotKit#6097 (the new `adk-angular` example carries the same fix). - Discovered while validating #6097 by live-comparing Angular vs React ADK behavior. 🤖 Generated with [Claude Code](https://claude.com/claude-code)