Skip to content

Chat API

The Chat API manages conversations and message streaming. All endpoints are mounted under /api/chat (e.g., /api/chat/conversations).

MethodPathDescription
GET/api/chat/conversationsList conversations
POST/api/chat/conversationsCreate a conversation
GET/api/chat/conversations/{id}Get a conversation
PUT/api/chat/conversations/{id}Update a conversation
DELETE/api/chat/conversations/{id}Delete a conversation
GET/api/chat/conversations/{id}/modeGet conversation mode
PATCH/api/chat/conversations/{id}/modeSet conversation mode
GET/api/chat/conversations/{id}/execution-modeGet execution mode
PUT/api/chat/conversations/{id}/execution-modeSet execution mode
POST/api/chat/conversations/{id}/approval-responseSubmit approval response
GET/api/chat/conversations/{id}/check-insList open check-ins
DELETE/api/chat/conversations/{id}/check-insCancel all open check-ins
DELETE/api/chat/conversations/{id}/check-ins/{check_in_id}Cancel one check-in
POST/api/chat/messages/streamSend a message (streaming SSE)
POST/api/chat/messages/injectInject a message into a conversation
POST/api/chat/messages/truncateTruncate messages
POST/api/chat/welcomeGenerate a welcome message
GET/api/chat/sessions/{session_id}/streamRemote session SSE stream

GET /api/chat/conversations

Returns all conversations.


POST /api/chat/conversations

Creates a new conversation.


GET /api/chat/conversations/{id}

Returns a single conversation by ID.


PUT /api/chat/conversations/{id}

Updates a conversation (e.g., title).


DELETE /api/chat/conversations/{id}

Permanently deletes a conversation and its messages.


POST /api/chat/messages/stream

Sends a message and returns the response as a stream of Server-Sent Events (SSE). The connection stays open until the full response is delivered.

Each event in the stream uses standard SSE format. The following event types are emitted:

event: token
data: {"content": "def reverse_linked_list"}
event: tool_use
data: {"tool": "write_file", "input": {"path": "solution.py"}}
event: tool_result
data: {"tool": "write_file", "output": {"success": true}}
event: done
data: {"message_id": "msg_01j9abc123", "input_tokens": 120, "output_tokens": 245, "total_tokens": 365}
event: error
data: {"code": "rate_limit", "message": "Provider rate limit reached. Retry in 30s."}

POST /api/chat/messages/inject

Injects a message into a conversation without triggering an agent response. Useful for programmatically adding context or instructions.


POST /api/chat/messages/truncate

Truncates messages in a conversation.


POST /api/chat/welcome

Generates a welcome message for a new conversation.


GET /api/chat/conversations/{id}/mode
PATCH /api/chat/conversations/{id}/mode

Get or set the conversation mode for a specific conversation.


GET /api/chat/conversations/{id}/execution-mode
PUT /api/chat/conversations/{id}/execution-mode

Get or set the execution mode (e.g., autonomous vs. approval-required) for a conversation.


POST /api/chat/conversations/{id}/approval-response

Submit an approval or rejection for a pending action within a conversation.


GET /api/chat/conversations/{id}/check-ins
DELETE /api/chat/conversations/{id}/check-ins
DELETE /api/chat/conversations/{id}/check-ins/{check_in_id}

List the conversation’s open check-ins (armed or queued behind the room), soonest first, or cancel one or all of them.

{
"check_ins": [
{
"check_in_id": "chk_3f2a9c1b7e04",
"agent_id": "adam-dev",
"due_at": "2026-09-30T17:36:37+00:00",
"delay_minutes": 14,
"waiting_on": "CI run for PR #2077",
"estimate_basis": "runs take 15–18 min; 4 elapsed, 2/6 jobs done",
"status": "pending",
"source": "agent",
"sequence": 1
}
]
}

status is pending (armed) or delivering (due, waiting for the room). source is agent (the agent scheduled it), fallback (a backup armed because the agent ended waiting without one) or system (armed by the daemon, e.g. after a restart interrupted work). Cancelling returns {"cancelled": {...}} for one (404 if it isn’t open in this conversation) or {"cancelled": <count>} for all.

Changes are announced on /ws/events as chat.check_in.changed with {conversation_id, agent_id?}.