mirror of
https://github.com/CopilotKit/CopilotKit.git
synced 2026-09-14 16:26:20 +08:00
4670d25a78
Brings the Google ADK showcase back to parity with the langgraph-python north-star across the 14 issues catalogued in PR #4792's TL;DR. Four independent classes of bug fixed; all 36 demos now route, terminate, and render correctly against real Gemini. 1. Universal Gemini infinite tool loop ADK's LlmAgent does not naturally terminate after a tool result with Gemini 2.5-flash — every backend or frontend tool fired forever. Lifted the (orphaned) `simple_after_model_modifier` from agents/main.py into shared_chat.stop_on_terminal_text without the SalesPipelineAgent name-gate; wired it as `after_model_callback=` into every registered LlmAgent (22 dedicated agents plus the build_simple_chat_agent / build_thinking_chat_agent factories). simple_after_model_modifier is kept as a thin alias so the existing test file keeps resolving. 2. Stale @ag-ui/client trapped on deprecated event names ag_ui_adk v0.6.1 emits the canonical REASONING_* events but the integration's package.json pinned `@ag-ui/client: ^0.0.43` which under npm's pre-1.0 caret rule resolves to strictly 0.0.43 — a version that only knows the deprecated THINKING_* names. Every Gemini response tripped the runtime's Zod discriminator. Bumped to ^0.0.53 and regenerated the lockfile. 3. Frontend agent IDs out of sync with backend mounts page.tsx for hitl-in-chat / frontend-tools-async / prebuilt-popup declared underscored agent IDs that didn't appear in the runtime's agent map, so useAgent threw "Agent not found after runtime sync" and the React tree crashed. Renamed to the dashed form that matches the registry. MCP Apps had the same class of bug at the route level — copilotkit-mcp-apps/route.ts pointed HttpAgent at /mcp_apps but the FastAPI mount is /mcp-apps; fixed to dash. 4. A2UI ops in deprecated v0.8 flat shape tools/generate_a2ui.py:build_a2ui_operations_from_tool_call, tools/search_flights.py, and agents/a2ui_fixed_agent.py emitted `{type: "create_surface", surfaceId, ...}` (flat). The @ag-ui/a2ui-middleware matcher only walks the v0.9 nested keys (`{createSurface: {surfaceId, ...}}`), so every op was grouped under the fallback "default" surface and the renderer threw `Catalog not found: default` or `Component 'undefined' is missing an 'id'`. Rewrote to v0.9 nested shape with `version: "v0.9"` and `updateDataModel` using `path` + `value` (matching copilotkit.a2ui Python helper). Three follow-on fixes in agents/main.py and beautiful_chat_agent.py that surfaced once the structural fix landed: - _AGENT_NAME_TO_CATALOG_ID table + _resolve_pinned_catalog_id helper: Gemini hallucinated catalog IDs because the schema for catalogId was unconstrained; the north-star hardcodes CUSTOM_CATALOG_ID per agent file, mirrored here with a name to id table so one shared generate_a2ui dispatches per demo. - Tightened parametersJsonSchema for components.items to require id + component AND explicitly declare the optional text / label / value / children / child / data props. Gemini's structured-output path drops fields not in the schema even with default additionalProperties: true, which produced [{}, {}, {}]. - Hard-requirements prompt prefix with a concrete PieChart example ported from langgraph-python's _GENERATE_A2UI_PROMPT_HEADER, plus _sanitize_a2ui_components / _has_root_component validators and _unstringify_json_fields to round-trip Gemini's quirk of emitting "data": "[{...}]" as a JSON string instead of an actual array. Windows note: the integration's tools/ symlink does not materialize on Windows worktrees (git stores it as mode 100644). The local copies under showcase/integrations/google-adk/tools/ are kept byte-identical to the canonical sources under showcase/shared/python/tools/. On Linux/macOS where the symlink works, only the shared/ copy is authoritative.
50 lines
1.5 KiB
JSON
50 lines
1.5 KiB
JSON
{
|
|
"name": "@copilotkit/showcase-google-adk",
|
|
"version": "0.1.0",
|
|
"private": true,
|
|
"scripts": {
|
|
"dev": "concurrently \"next dev --turbopack\" \"cd src && PYTHONPATH=.. python -m uvicorn agent_server:app --host 0.0.0.0 --port 8000 --reload\"",
|
|
"build": "next build",
|
|
"start": "next start",
|
|
"lint": "next lint",
|
|
"test:e2e": "playwright test"
|
|
},
|
|
"dependencies": {
|
|
"@ag-ui/client": "^0.0.53",
|
|
"@copilotkit/a2ui-renderer": "1.57.1",
|
|
"@copilotkit/react-core": "1.57.1",
|
|
"@copilotkit/runtime": "1.57.1",
|
|
"@copilotkit/shared": "1.57.1",
|
|
"@copilotkit/voice": "1.57.1",
|
|
"@hashbrownai/core": "0.5.0-beta.4",
|
|
"@hashbrownai/react": "0.5.0-beta.4",
|
|
"@json-render/core": "0.18.0",
|
|
"@json-render/react": "0.18.0",
|
|
"@radix-ui/react-checkbox": "^1.3.3",
|
|
"@radix-ui/react-separator": "^1.1.8",
|
|
"class-variance-authority": "^0.7.1",
|
|
"clsx": "^2.1.1",
|
|
"lucide-react": "^1.14.0",
|
|
"next": "^15.5.15",
|
|
"openai": "^5.9.0",
|
|
"radix-ui": "^1.4.3",
|
|
"react": "^19.0.0",
|
|
"react-dom": "^19.0.0",
|
|
"react-markdown": "^10.1.0",
|
|
"recharts": "^2.15.0",
|
|
"remark-gfm": "^4.0.1",
|
|
"tailwind-merge": "^3.5.0",
|
|
"zod": "^3.24.0"
|
|
},
|
|
"devDependencies": {
|
|
"@playwright/test": "^1.50.0",
|
|
"@tailwindcss/postcss": "^4.0.0",
|
|
"@types/node": "^22.0.0",
|
|
"@types/react": "^19.0.0",
|
|
"concurrently": "^9.1.0",
|
|
"postcss": "^8.5.0",
|
|
"tailwindcss": "^4.0.0",
|
|
"typescript": "^5.7.0"
|
|
}
|
|
}
|