Common Patterns
Sessions are created automatically when you run an agent without a session_id, or explicitly with POST /api/agents/{id}/sessions. To continue a conversation, pass the session_id from the start event of a previous run. Retrieve message history with GET /api/sessions/{id}/messages to display conversation context.Every route on this page accepts the service role key or a signed-in user’s access token. An end user can read and delete only their own sessions; anyone else’s session, or one your backend created without a
user_id, answers 404. See Which key for which route.GET /api/sessions/
Get a session by ID.string
required
Session ID
GET /api/sessions//messages
Get assembled chat messages for a session. Each assistant message includes its retrieved_context (knowledge-base chunks fetched during the run) so you can surface citations alongside replies.string
required
Session ID
GET /api/sessions//runs
List all agent runs within a session.string
required
Session ID
GET /api/sessions//runs//retrieved-context
Get the retrieved context (knowledge-base chunks fetched during retrieval) for a single run within a session. Useful for debugging RAG behavior: you can see which chunks the agent saw before generating a given turn, separate from the assembled/messages view.
string
required
Session ID
string
required
Run ID (the
run_id of an agent_run belonging to this session)DELETE /api/sessions/
Delete a session and all its runs.string
required
Session ID
Error Responses
Errors return{"error": "<message>"}.