Agent

The agent endpoints let you send messages to the AI agent and receive responses. You can use the synchronous chat endpoint or the streaming endpoint for real-time events.

POST/agent/chatAuthenticated

Send a message and receive a complete response.

ParameterTypeRequiredDescription
messagestringYesThe message to send to the agent
session_idstringNoResume an existing session
modelstringNoOverride the LLM model
systemstringNoOverride the system prompt
max_tokensnumberNoToken generation limit
toolsstring[]NoTool IDs to enable for this request
curl -X POST http://127.0.0.1:7741/agent/chat \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"message": "Summarize my open GitHub issues"}'
200Response
{
  "ok": true,
  "data": {
    "response": "You have 3 open issues...",
    "tokensIn": 256,
    "tokensOut": 128,
    "sessionId": "a1b2c3d4"
  }
}
POST/agent/streamAuthenticated

Send a message and stream agent events via Server-Sent Events.

ParameterTypeRequiredDescription
messagestringYesThe message to send to the agent
session_idstringNoResume an existing session
modelstringNoOverride the LLM model
systemstringNoOverride the system prompt
max_tokensnumberNoToken generation limit
toolsstring[]NoTool IDs to enable for this request

The response is a text/event-stream. Each event has a type field:

Event TypeData FieldsDescription
text_deltacontentStreaming text chunk
tool_callid, name, argumentsAgent invoking a tool
tool_resulttoolCallId, result, isErrorTool execution result
thinkingcontentExtended thinking output
compactionbeforeTokens, afterTokensContext window was compacted
turn_completetokensIn, tokensOutAgent finished its turn
donesessionIdStream complete
errormessageError occurred
curl -N -X POST http://127.0.0.1:7741/agent/stream \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"message": "Hello"}'
GET/agent/listAuthenticated

List all active agent sessions.

200Response
{
  "ok": true,
  "data": [
    {
      "id": "a1b2c3d4",
      "model": "claude-sonnet-4-20250514",
      "status": "active",
      "created_at": "2026-03-03T10:00:00Z",
      "message_count": 12
    }
  ]
}
POST/agent/spawnAuthenticated

Spawn a new agent session with an initial prompt.

ParameterTypeRequiredDescription
promptstringYesInitial prompt for the new session
modelstringNoLLM model override
toolsstring[]NoTool IDs to enable
200Response
{
  "ok": true,
  "data": {
    "session_id": "e5f6g7h8"
  }
}