WebSocket chat
Endpoint
token query parameter. The WebSocket connection stays open for the lifetime of a conversation session; you can send multiple turns on the same connection.
Message frames
Send a user turn:subscribe to attach to a thread that is still streaming; the server replies with turn_status:
thread_id is stable across sessions. Pass the same thread_id on every turn to keep messages in one continuous conversation. Use session_key to resume a specific thread when opening a new WebSocket connection. After a page reload, call history and check turn_active before re-subscribe.Thread management endpoints
Create a thread
Creating a thread returns athread_id for routing turns and a session_key for resuming the thread across WebSocket reconnections.
Get message history
Retrieve paginated message history for a specific thread.turn_active (boolean). When turn_active is true, re-open the chat WebSocket and send {"type":"subscribe","thread_id":"..."} to resume streaming. Use the standard limit and offset query parameters to page through long threads.
Rename or pin a thread
Send aPATCH request with a title to rename a thread, or set pinned: true to pin it to the top of the session list.
Polish endpoint
The polish endpoint accepts a single prompt and returns a refined version in one shot — useful for improving user messages before sending them to an agent.{"text": "...refined text..."}. You can optionally pass default_model to override the agent’s default for this one call.
Fork a thread
POST /api/agents/{id}/threads/{thread_id}/fork copies a conversation into a new thread up to a chosen assistant reply. The original thread is unchanged. Send assistant_turns_from_end: 1 to fork from the latest reply, or pass a message_id. The agent must be running.
Files and knowledge citations
Thread list and history include generated files (for example after the agent writes a file or takes a desktop screenshot) and knowledge-base sources when the reply used your documents. Click a citation in the web UI to preview the document in chat.Run trajectory
GET /agents/{id}/threads/{thread_id}/trajectory* exposes the same ledger as the chat trajectory drawer: paginated event summaries, a single full event, aggregated metrics, a live SSE stream, and an export. Use these when you need an audit of turns and tool calls without scraping the chat UI.

