Skip to content

Thread history does not work with Copilotkit AG-UI + LangGraph FastAPI self-hosted? #1

@bobbyo

Description

@bobbyo

Chats do not reload when given a a previous threadId.

Details/Repro

This repo uses[the new AG-UI interface,

from ag_ui_langgraph import add_langgraph_fastapi_endpoint

However, it does not support thread history.

Try here:

Either use the setThreadId frrom const { threadId: copilotKitThreadId, setThreadId: copilotKitSetThreadId } = useCopilotContext();

or just run a chat, put <h1> threadId {threadId} </h1> in the code from the hook above, and force the threadId on the chat component without restarting the fastAPI server.

const earlierThreadId = "<UUID copied from chat here>";
...

<CopilotSidebar  threadId={earlierThreadId } ... 

Suggestion / feature request: include showing history works as a standard thing in your demos

Since thread history comes up as a problem so often, and it is essential for pretty much any product use of these components, please add a simple component to show that it does work in new demos. Make it collapsible if you like, but something to show history works.
All it needs to do is allow restarting a new chat + keeping track of the thread IDs it has seen so far, and reloading them from the back end. That would be enough to demo that it works. E.g. a prettier version of my hack of your demo where I tried to force in thread IDs via the react hooks and the chat component props--it just remembered the threadIds it had seen, and allowed randomly generating new UUIDs like CopilotKit internals do for a new fresh chat.

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions