CopilotKit icon indicating copy to clipboard operation
CopilotKit copied to clipboard

Copilotkit <> ADK set user-id and sessison-id via backend

Open H-Shafiei opened this issue 2 weeks ago • 1 comments

Hi. Thanks for the awesome work you've done. I have some problem understanding how things work.

My setup: I have an ADK agent. I have added the fastapi middleware for ag-ui. On the client I'm using copilotkit in a Nestjs app. I have the copilotkit runtime running with an HTTPAgent linking it to the Agent.

Now I have two main questions:

1- I don't see anywhere explaining what's happening exactly with CopilotRuntime and why it's necessary? In the documentation there is a link for explaining it's concept which is a dead link.

2- ADK has app_id, user_id and session_id and I can send the app_id, user_id but I can't set the session_id. What i want to do is each user have several chat sessions and i want my backend to populate the user_id and session_id based on the frontend's token. For example if the frontend send the token 'XYZ' as it's authentication, the app's backend will populate user_id based on that to the AGUI interface of the ADK agent. I can't see how I can accomplish this? All i can see is that I can send some context data and extract user_id and app_id with that which has 2 problems: first of all I can't set session_id, and second of all I don't want the frontend to do the job. I want the backend to control this

Thanks

H-Shafiei avatar Dec 13 '25 15:12 H-Shafiei

Hi @H-Shafiei - Regarding the session_id, this should be directly populated from the threadID, though I recently realized that the documentation didn't make this clear, so updated it here. If you find this not to be the case, please file an issue on the ag-ui repo which is where ADK-specific issues are tracked.

  • Mark

contextablemark avatar Dec 13 '25 18:12 contextablemark