-
Notifications
You must be signed in to change notification settings - Fork 880
Description
I have a feeling this is a me issue as copilotkit was working in their example with the existing "proverbs_agent" but when I followed the documentation to use @ag-ui/client by itself this is what I found and eventually how I got it to work.
Problem Description
The @ag-ui/client JavaScript SDK fails to communicate with agents built using ag-ui-adk Python package, resulting in RUN_ERROR events and failed agent execution.
"use client";
import { useEffect } from "react";
import { HttpAgent } from "@ag-ui/client";
const agent = new HttpAgent({
url: "http://localhost:8000/",
});
export default function AgUi() {
useEffect(() => {
const fetchData = async () => {
const result = await agent.runAgent({
messages: [
{
id: "msg-1",
role: "user",
content: "Hello!",
},
],
});
console.log(result.newMessages);
};
fetchData();
}, []);
}
Error Details
Client-Side Error
AGUIError: Cannot send event type 'RUN_FINISHED': The run has already errored with 'RUN_ERROR'. No further events can be sent.
Server-Side Error
ValueError: Both invocation_id and new_message are None.
App Name Mismatch Warning
App name mismatch detected. The runner is configured with app name "proverbs_app", but the root agent was loaded from ".../google/adk/agents", which implies app name "agents".
Package Versions
@ag-ui/client: 0.0.38ag-ui-adk: 0.3.1ag-ui-protocol: 0.1.9
Expected Behavior
The AG-UI client should successfully communicate with ADK agents built using ag-ui-adk.
Actual Behavior
The client fails immediately after sending a request, with the agent returning RUN_ERROR due to missing invocation_id and new_message fields.
Request Format Used
{
"threadId": "test-thread",
"runId": "test-run",
"state": {},
"messages": [
{
"id": "msg-1",
"role": "user",
"content": "Hello!"
}
],
"tools": [],
"context": [],
"forwardedProps": {}
}Workaround
Direct HTTP/SSE calls to the ADKAgent work correctly, bypassing the AG-UI client entirely. This suggests the issue is specifically with the AG-UI client protocol implementation.
Root Cause
There appears to be a protocol mismatch between the event format expected by @ag-ui/client and the format generated by ag-ui-adk. The server-side error indicates that required fields (invocation_id and new_message) are not being properly passed from the client to the agent.
Additional Context
- The ADKAgent itself works correctly when called directly via HTTP/SSE
- The streaming response format is valid and contains proper event types
- The issue occurs specifically when using the
@ag-ui/clientHttpAgent class