HTTP server
Serve the runtime over HTTP, Express-style.
runtime.serve({ port }) starts the runtime and serves it over HTTP.
const server = await runtime.serve({ port: 3000 });Endpoints
| Method | Path | What it does |
|---|---|---|
POST | /api/events | Publish an event to the bus |
POST | /api/agents/:name/messages | Send a message to an agent instance |
GET | /api/health | Liveness |
GET | /api/events | List registered event definitions |
GET | /api/agents | List registered agent definitions |
GET | /api/actors | List registered actor definitions |
GET | /api/tools | List registered tools |
The reference pattern: message in, agent out
- A client
POST /api/eventswith{ topic: "messages.incoming", payload }. - An actor subscribes to
messages.incoming, filters, and forwards the payload to an agent viasendMessage. - The agent processes it and replies; the reply is itself an event (or a response to the originating request).
curl -X POST http://localhost:3000/api/events \
-H 'content-type: application/json' \
-d '{
"topic": "messages.incoming",
"type": "user.message",
"source": "curl",
"payload": { "text": "hello from curl" }
}'Send a message directly to an agent instance:
curl -X POST http://localhost:3000/api/agents/assistant/messages \
-H 'content-type: application/json' \
-d '{ "text": "What is the weather in Mumbai?" }'