Skip to main content

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.
Response:
Two request headers are recognized:
  • X-Request-ID — adopted (after sanitization) as the request id for log correlation and echoed back in the X-Request-ID response 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.
Events (fields with null values are omitted from each payload):
On failure a {"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.
Response:

POST /conversations/{id}/messages

Send a message. Prior history is assembled automatically.
Response:
Errors: 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.
Events:
On failure an 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.
Response:

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.
Populating 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.