Two APIs
Engine API
Stateless. Started by
agentctl serve. Port 8090. Takes a message, returns a response. No session management.Conversation API
Stateful. Started by
agent-manager. Port 8100. Manages conversations, history, and SSE streaming. Also serves the widget.Engine API
Base URL:http://localhost:8090
GET /health
POST /invoke
Send a message and get a response.
X-Request-ID— adopted (after sanitization) as the request id for log correlation and echoed back in theX-Request-IDresponse header. Minted automatically when absent.X-Session-ID— carried into the run as the conversation id for tracing metadata (e.g. the Langfuse session).
POST /stream
Same as /invoke but streams Server-Sent Events.
null values are omitted from each payload):
{"type": "error", "detail": "..."} event is emitted.
Conversation API
Base URL:http://localhost:8100
Manages multi-turn conversations with history persisted in SQLite (or Postgres via DATABASE_URL).
POST /conversations
Create a new conversation. The body is optional; session_id and user_id
may be supplied.
POST /conversations/{id}/messages
Send a message. Prior history is assembled automatically.
404 unknown conversation, 429 conversation token budget exceeded.
POST /conversations/{id}/messages/stream
Same as above but streams via SSE. Preferred by the widget. Each event carries
an event: name matching its type; null fields are omitted.
event: error with {"type": "error", "error": "..."} is
emitted before done.
The event schema also declares
tool_started / tool_succeeded /
tool_failed types for per-tool progress; the engine does not emit them yet.GET /conversations/{id}/messages
Retrieve message history for a conversation.
Passing context to plugins
The HTTP layer currently forwards a deliberately small amount of caller context into the run:X-Session-ID(Engine API) becomes the run’s conversation id, visible to tracing.user_id(Conversation API request bodies) is attached to the run context and persisted with the conversation.
run_context.auth_context (scopes, roles, inbound access token)
from request headers is part of the security/context gate that is not wired
up yet — see the roadmap. Hooks such as on_run_start can inject a modified
RunContext in the meantime.