🐛 Bug: Both invocation_id and new_message are None with google adk framework
♻️ Reproduction Steps
create an agent with adk and connect with copilotkit and then in between of the conversation we are getting the error "Both invocation_id and new_message are None."
## Error Type
Console Error
## Error Message
**Both invocation_id and new_message are None.**
at useChat.useAsyncCallback[runChatCompletion].next (<anonymous>:null:null)
Next.js version: 16.0.6 (Turbopack)
Error trace:
NFO:ag_ui_adk.event_translator:⏭️ Final response event received. Closing active stream.
INFO:ag_ui_adk.event_translator:🏁 Streaming completed via final response
INFO:__main__:=== POST / ===
INFO:__main__:Response: 200
INFO: 127.0.0.1:63409 - "POST / HTTP/1.1" 200 OK
WARNING:google_adk.google.adk.runners:App name mismatch detected. The runner is configured with app name "my_agent", but the root agent was loaded from "C:\New\POC_CopilotKit\adkbasic\my_agent\.venv\Lib\site-packages\google\adk\agents", which implies app name "agents".
ERROR:ag_ui_adk.adk_agent:Background execution error: Both invocation_id and new_message are None.
Traceback (most recent call last):
File "C:\HCL\POC_CopilotKit\adkbasic\my_agent\.venv\Lib\site-packages\ag_ui_adk\adk_agent.py", line 1232, in _run_adk_in_background
async for adk_event in runner.run_async(**run_kwargs):
...<55 lines>...
return
File "C:\HCL\POC_CopilotKit\adkbasic\my_agent\.venv\Lib\site-packages\google\adk\runners.py", line 443, in run_async
async for event in agen:
yield event
File "C:\HCL\POC_CopilotKit\adkbasic\my_agent\.venv\Lib\site-packages\google\adk\runners.py", line 382, in _run_with_trace
raise ValueError('Both invocation_id and new_message are None.')
ValueError: Both invocation_id and new_message are None.
INFO:ag_ui_adk.adk_agent:Skipping tool result batch for thread d124b9d2-416a-4d72-a8a6-3012de02933a - no matching pending tool calls
WARNING:google_adk.google.adk.runners:App name mismatch detected. The runner is configured with app name "my_agent", but the root agent was loaded from "C:\New\POC_CopilotKit\adkbasic\my_agent\.venv\Lib\site-packages\google\adk\agents", which implies app name "agents".
16:36:20 - LiteLLM:INFO: utils.py:3419 -
LiteLLM completion() model= gpt-5.1; provider = openai
INFO:LiteLLM:
LiteLLM completion() model= gpt-5.1; provider = openai
16:36:21 - LiteLLM:INFO: utils.py:3419 -
LiteLLM completion() model= gpt-5.1; provider = openai
INFO:LiteLLM:
LiteLLM completion() model= gpt-5.1; provider = openai
INFO:ag_ui_adk.adk_agent:Detected ToolCallEndEvent with id: call_LQ36nj88BNXfrPnm5Zai6WAU
INFO:ag_ui_adk.adk_agent:Detected ToolCallResultEvent with id: call_LQ36nj88BNXfrPnm5Zai6WAU
INFO:ag_ui_adk.event_translator:⏭️ Final response event received. Closing active stream.
INFO:ag_ui_adk.event_translator:🏁 Streaming completed via final response
✅ Expected Behavior
the agent should communicate without any interruption.
❌ Actual Behavior
the agent interpreted in between of the conversation.
𝌚 CopilotKit Version
Γö£ΓöÇΓöÇ @copilotkit/[email protected]
Γö£ΓöÇΓöÇ @copilotkit/[email protected]
Γö£ΓöÇΓöÇ @copilotkit/[email protected]
📄 Logs (Optional)
## Error Type
Console TypeError
## Error Message
Failed to fetch
at Generator.next (<anonymous>:null:null)
at new Promise (<anonymous>:null:null)
Next.js version: 16.0.6 (Turbopack)
## Error Type
Console TypeError
## Error Message
Failed to fetch
at Generator.next (<anonymous>:null:null)
at new Promise (<anonymous>:null:null)
Next.js version: 16.0.6 (Turbopack)
## Error Type
Console Error
## Error Message
Both invocation_id and new_message are None.
at useChat.useAsyncCallback[runChatCompletion].next (<anonymous>:null:null)
Next.js version: 16.0.6 (Turbopack)
The bug "Both invocation_id and new_message are None" in the CopilotKit + ADK (Google ADK framework) integration appears to stem from a compatibility issue between CopilotKit runtime version 1.10.6 and the current Google ADK library, where google.adk.runners._run_with_trace now expects invocation_id and new_message parameters that are not being passed. The "app name mismatch" warning indicates a mismatch between the app_name used in the CopilotKit route handler and the one set in the ADK agent, potentially disrupting the session state or traceability.
Fixing the Integration
• Update Dependencies: Ensure you're using the latest versions of google.adk and ag-ui-adk packages. Run uv add --upgrade ag-ui-adk google-adk (or equivalent with your package manager) to pull the newest releases, as older versions may not provide these required parameters or have invocation_id/new_message handling.
• Align App Name and User ID: Match the app_name and user_id exactly between your CopilotKit API route handler and the ADKAgent setup in your ADK backend. For example:
- In your CopilotKit
route.tsor equivalent:const handler = goal({ app_name: "demo_app", user_id: "demo_user" }); - In your ADK backend (e.g.,
main.py):adk_agent = ADKAgent( adk_agent=agent, app_name="demo_app", user_id="demo_user", # ... )
A mismatch can cause the runner to lose context mid-conversation.
• Alternative Approaches:
- If updates don't resolve it, check for a newer CopilotKit runtime version (beyond 1.10.6) in the changelog or issue tracker for ADK-related fixes.
- Migrate to AG-UI's recommended ADK integration patterns, as supported by ADK Quickstart Documentation. Ensure Next.js Turbopack compatibility by testing without it (e.g., switch to webpack if issues persist).
Note: This is derived from ADK integration documentation, as source code analysis found no custom CopilotKit adapter code for Google ADK. Confidence: Medium – requires cross-verification with latest ADK releases and CopilotKit updates, as the error originates in Google's library.
Documentation References:
- ADK Quickstart – Covers setting up the backend agent and CopilotKit route.
- ADK Troubleshooting – General ADK issues (update library versions and state handling tips).
Was this helpful?
If this solution worked for you, please click on the appropriate option below to help us improve:
👋 Thanks for your feedback!
I've escalated this issue to our development team. Someone from our team will review your request and provide additional assistance shortly.
If this is blocking production, please book a meeting with us at https://cal.com/nathan-tarbert-copilotkit/15min
Addressed with https://github.com/ag-ui-protocol/ag-ui/pull/780. Can be verified once version 0.3.5 of the ag-ui-adk has been published.
resolved