Skip to content

Chat Sessions

Chat sessions are persistent conversation threads between a user and an agent. Each session captures the full exchange — messages, tool calls, model responses, and token usage — so you can resume, review, and export your work.

A session belongs to a single user within an organization and is optionally scoped to a project. It records:

  • The model used for the conversation
  • A running count of messages and tokens
  • A timeline of events stored for replay and analysis

Sessions are created automatically when you start a conversation in the CLI or Studio. You can also save, load, and manage sessions explicitly.

Every interaction within a session is recorded as a typed event. Events are stored in order and include metadata like the model, role, tool name, and token counts.

Event typeWhat it captures
User messageText sent by the user
Agent responseModel-generated reply
Tool callTool invocation and its result
Generation startBeginning of a model inference call
Generation endCompletion of inference with token counts
HeartbeatKeepalive signal during long-running events

Events are stored in ClickHouse for efficient querying and are partitioned by month.

ActionWhat happens
CreateSession is created when you start a conversation
UpdateMessage and token counts increment as the conversation grows
TitleAn AI-generated title is produced from the first message
ArchiveSession is soft-deleted and hidden from listings
DeleteSession and all its events are permanently removed

Sessions can be managed from the CLI or the API:

  • CLI: Use /save, /load, /sessions, /delete, /export, and /clear during a conversation. See Chat & Sessions for the full command reference.
  • API: Sessions are available at GET /api/v1/user/session and scoped to the authenticated user.

Sessions can be associated with a project. When scoped to a project, sessions appear in that project’s context and their events contribute to project-level analytics. Unscoped sessions live at the organization level.