#Using latest CopilotKit Beta release + AgUI 0.0.19 Errors

1 messages · Page 1 of 1 (latest)

tiny ledge
#

Hey!

I am using LangGraph + NextJS I updated to latest versions:

1.50.0-beta.1

And ag-ui: 0.0.19

Issues:

  1. I am seeing bunch of re-rendering for all hooks that are rendering tools (e.g useRenderToolCall - each time new stream event is in)

  2. Interrupts are not eagerly fetched

  3. Each time when run is finished or I have interrupt I see:

[ { "code": "invalid_type", "expected": "string", "received": "undefined", "path": [ "messages", 2, "id" ], "message": "Required" }, { "code": "invalid_type", "expected": "string", "received": "undefined", "path": [ "messages", 3, "id" ], "message": "Required" }, { "code": "invalid_type", "expected": "string", "received": "undefined", "path": [ "messages", 5, "id" ], "message": "Required" } ]
  1. Using useCoAgent with init state outputs unexpected message in state.messages (before user even wrote anything) - seems like this message is only shown in the frontend:
{
    "id": "coagent-state-render-chatAgent",
    "role": "assistant",
    "content": "",
    "name": "coagent-state-render"
}
#

FYI @plucky obsidian @thorn wedge

uneven estuaryBOT
#

This solution has been AI generated

From our repo, these symptoms map to version alignment, message schema, and UI-only state-render behavior. Some re-renders are expected for streaming hooks; the message.id errors point to missing IDs; and the "coagent-state-render" message is added by the state-render mechanism for UI rendering only.

1) Version alignment (CopilotKit + AG-UI)

Please ensure all CopilotKit packages are on matching latest versions to avoid mismatches with ag-ui 0.0.19:

npm update @copilotkit/react-core @copilotkit/react-ui @copilotkit/runtime

2) Re-renders with useRenderToolCall

useRenderToolCall updates on each stream event by design (it wraps action state). To mitigate excessive re-renders, stabilize the tools mapping and callbacks:

const toolRenderers = useMemo(() => ({ MyTool }), []);
useRenderToolCall({ tools: toolRenderers });
// Also wrap renderers in React.memo/useCallback where applicable

3) Interrupts not eagerly fetched

We don’t have a repo-side bug matching this. Streaming/state hooks may race with fetches. Ensure only one state/interrupt fetch runs per stream and avoid concurrent state updates that re-trigger fetches.

4) Zod error: messages[*].id is required

Our message schemas require an id. Ensure every message (user/assistant/tool) you construct or pass through has a string id:

const message = { id: "unique_id", role: "assistant", content: "..." };

If your backend emits messages, verify it includes id for each message before the client parses/validates.

#

5) useCoAgent shows an unexpected assistant message

The message with name: "coagent-state-render" is produced by the state-render hook for intermediate UI rendering and is frontend-only. If you don’t want it in your chat list, filter it on render:

const visible = state.messages.filter(m => m.name !== "coagent-state-render");

References:

Was this helpful?

If this solution worked for you, please click on the appropriate option below to help us improve:

plucky obsidian
#

Hi @tiny ledge, thanks for reporting this. I've flagged engineering to take a look at this.

uneven estuaryBOT
#

Thank you for your feedback! Our team will provide additional assistance. 🔄