#Why is copilotkit sending the full message list
1 messages · Page 1 of 1 (latest)
This solution has been AI generated
CopilotKit currently sends the full message list from the frontend by design. The server uses threadId to group and persist conversations, but it does not rehydrate history for each request; instead it relies on the client to provide the complete history each time.
Why the full message list is sent
- The runtime forwards the entire CopilotKit chat history to the agent on each invocation to ensure full conversational context.
- This behavior is described in the message management flow where the agent receives the pre-existing chat history rather than reconstructing it server-side.
How threadId currently works
- threadId is a unique identifier used to associate messages with a conversation thread.
- On the server, runners (e.g., InMemoryAgentRunner) store/retrieve messages keyed by threadId, but they primarily persist what the client sends. They do not fetch and rebuild the history for each new request.
Is delta-only sending supported?
- Not at this time. There is no built-in support for sending only delta messages and having the server reconstruct the full history using threadId. The expected contract is that the frontend sends the full messages array on each call.
Implication
- If you need delta-only behavior, you would need to customize the server layer to rehydrate the conversation by threadId before agent execution and adjust the client to send only new messages. Out of the box, CopilotKit does not implement this pattern.
References: Message management docs; InMemoryAgentRunner and BuiltInAgent implementations in the runtime/agent packages.
Was this helpful?
If this solution worked for you, please click on the appropriate option below to help us improve:
Thank you for your feedback! Our team will provide additional assistance. 🔄
I believe the current behavior is by design. That said, I'll check with the team to see if there's any additional context.
I don't know if it intendad but it could allow you to store the message history on frontend and when someone change from thread to thread, it super fast, because no backend call is made.
It like for T3chat of theo, in one video he say that.
So in a way you setup the frontend message history and it needed to be send to the backend so the backend can have the history to have context of the conversation to reply.
Hey @drifting hawk, this is something we are aware of and actively considering adding an option to just send the delta
got it!
yeah that is a fair reason but imagine the user and the agent is having a really long conversation, you can't always let frontend sends the full list(cuase it will be so long). The backend receives the delta messages and can do more things if it wants, like loading history, introducing some memory stuff...