Skip to main content

Agents API

Create and manage AI agents, invoke conversations, and retrieve interaction history Base path: /api/v1/agents Endpoint count: 3

List agents

GET /api/v1/agents/
Retrieve the tenant’s AI agents with cursor-based pagination, status filtering, and free-text name search. Each row carries the agent configuration plus live conversation-derived counters (active_conversations, conversation_count, total_tokens, last_active_at).
string
Opaque cursor for the next page (from previous response meta.pagination.cursor)
integer
Number of items per page (1–200, default 25)
string
Sort field; prefix with ’-’ for descending (e.g. ‘-created_at’). Defaults to newest first.
string (enum: active|draft|paused|archived)
Filter by agent status
Free-text search across the agent name

Send a chat message to an agent

POST /api/v1/agents/{id}/chat
Proxy a chat message to the agent runtime, returning the full response in a single 200 reply. The runtime returns { data: { response, conversation_id, tokens_used }, meta }. Use POST /chat/stream for incremental token streaming.
string
required
Agent identifier (Devotel agent_xxx id). Path also accepts the alias :agentId for back-compat.
string
required
User message to send to the agent.
object[]
Optional conversation history to seed the agent (additive on top of any persisted state).
string
Existing conversation id to append onto. When omitted, a new conversation is created.

Stream a chat response from an agent (SSE)

POST /api/v1/agents/{id}/chat/stream
Server-Sent Events stream of an agent turn. The response Content-Type is text/event-stream. The runtime emits six event types: status, token, tool_start, and tool_end are progress frames that may arrive zero or more times, and the stream terminates with exactly one response or error frame. The terminal response event carries data: { "response": "...", "tokensUsed": <number>, "promptTokensUsed": <number>, "completionTokensUsed": <number>, "apiCallsUsed": <number>, "escalated": <boolean>, "conversation_id": "..." }; a terminal error event carries data: { "code": "...", "message": "..." }. The connection persists until the agent completes or the rate-limit window is exhausted (20/min per tenant). See the API reference for the full per-event payload shapes.
string
required
Agent identifier.
string
required
User message to send to the agent.
object[]
Optional conversation history to seed the agent (additive on top of any persisted state).
string
Existing conversation id to append onto. When omitted, a new conversation is created.