Skip to content

REST API

The incubator exposes REST endpoints under /api/{namespace}/. The default namespace is default.

Base URL: http://localhost:8080/api/default

Get all shared state or a specific key.

Terminal window
# All state
curl http://localhost:8080/api/default/state
# Specific key
curl http://localhost:8080/api/default/state?key=current_phase

Response: { "current_phase": "review", "status": "running" }

Set a state value.

Terminal window
curl -X POST http://localhost:8080/api/default/state \
-H 'Content-Type: application/json' \
-d '{"key": "current_phase", "value": "review"}'

Delete a state key.

Terminal window
curl -X DELETE http://localhost:8080/api/default/state \
-H 'Content-Type: application/json' \
-d '{"key": "temp_value"}'

List events with optional filters.

Terminal window
# All events
curl http://localhost:8080/api/default/events
# With filters
curl "http://localhost:8080/api/default/events?since=10&type=task.complete&limit=50"
Query paramDescription
sinceEvent ID to start from
typeFilter by event type
limitMax events to return

Response: [{ "id": 1, "type": "task.complete", "data": { "task": "auth" }, "timestamp": "..." }]

Publish an event.

Terminal window
curl -X POST http://localhost:8080/api/default/events \
-H 'Content-Type: application/json' \
-d '{"type": "task.complete", "data": {"task": "auth", "status": "done"}}'

List all active claims.

Terminal window
curl http://localhost:8080/api/default/claims

Response: [{ "resource": "file:src/api.ts", "agent_id": "worker-1", "claimed_at": "..." }]

Claim a resource.

Terminal window
curl -X POST http://localhost:8080/api/default/claims \
-H 'Content-Type: application/json' \
-d '{"resource": "file:src/api.ts", "agent_id": "worker-1"}'

Release a claim.

Terminal window
curl -X DELETE http://localhost:8080/api/default/claims \
-H 'Content-Type: application/json' \
-d '{"resource": "file:src/api.ts", "agent_id": "worker-1"}'

List registered agents and their roles.

Terminal window
curl http://localhost:8080/api/default/roles

Register an agent with a role.

Terminal window
curl -X POST http://localhost:8080/api/default/roles \
-H 'Content-Type: application/json' \
-d '{"agent_id": "worker-1", "role": "developer"}'

List messages for an agent.

Terminal window
curl "http://localhost:8080/api/default/messages?agent_id=worker-1"

Send a message.

Terminal window
curl -X POST http://localhost:8080/api/default/messages \
-H 'Content-Type: application/json' \
-d '{"from": "queen", "to": "worker-1", "content": "Focus on the auth module"}'

Issue a control command (halt, pause, resume).

Terminal window
# Halt
curl -X POST http://localhost:8080/api/default/control \
-H 'Content-Type: application/json' \
-d '{"command": "halt", "reason": "Critical bug"}'
# Pause
curl -X POST http://localhost:8080/api/default/control \
-d '{"command": "pause"}'
# Resume
curl -X POST http://localhost:8080/api/default/control \
-d '{"command": "resume"}'

Get current control status.

Terminal window
curl http://localhost:8080/api/default/control

List available dance tools.

Terminal window
curl http://localhost:8080/api/dance

Call a dance tool.

Terminal window
curl -X POST http://localhost:8080/api/dance/make_move \
-H 'Content-Type: application/json' \
-d '{"args": {"from": "e2", "to": "e4"}, "agentId": "player-1", "role": "white"}'