Events API
Canonical reference: docs/api-reference.md (generated endpoint directory) — this page is a task-oriented summary.
Sol uses a Mnesia-backed event sourcing system as its orchestration backbone. The Events API provides read access to the event stream and real-time SSE subscriptions.
List Events
GET /api/v1/events
Query the event store with filters and pagination.
curl -H "Authorization: Bearer $TOKEN" \
"https://sol.example.com/api/v1/events?aggregate=task-123&limit=20"
Query Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
aggregate | string | — | Aggregate ID to read |
user_uuid | string | — | Admin selector for that user’s events (a non-admin is always scoped to their own user_uuid) |
since | integer | 0 | Unix-ms timestamp cursor — only events with timestamp > since (per-user/global reads) |
since_id | string | — | Tuple-cursor tiebreak for since (see below) |
from_seq | integer | 0 | Inclusive aggregate replay cursor (seq >= from_seq; seq 0 included) |
cursor | string | — | Aggregate page cursor "<seq>:<event_id>" from next_cursor; resumes strictly after that row. Do not combine with offset or from_seq (typed 400) |
limit | integer | 50 | Maximum events to return (clamped 1..500) |
offset | integer | 0 | Pagination offset (aggregate reads: max 10001) |
Response:
{
"items": [
{
"id": "evt-1744730000000",
"type": "task.completed",
"aggregate_id": "task-123",
"seq": 42,
"timestamp": 1744730000000,
"data": {
"task_id": "task-123",
"worker_id": "luna-01",
"status": "ok",
"duration_ms": 3200
}
}
],
"limit": 50,
"offset": 0,
"page": 1,
"has_more": true,
"next_cursor": "42:evt-1744730000000"
}
Aggregate reads carry no total/total_pages — an aggregate count
would require walking the whole aggregate, which the indexed read
deliberately avoids. next_cursor is the exact {seq, event_id} pair of
the last row; pass it back as ?cursor=<seq>:<event_id> (offset and
from_seq must be omitted — combining them is a typed 400). This keeps
duplicate-seq rows reachable. A caller-scoped read that would scan past
the server’s bounded index-row cap answers 400
aggregate_scan_limit_exceeded.
The per-user/global (no ?aggregate) reads keep the pagination envelope
with total, total_pages, newest_timestamp and newest_id; pass
newest_timestamp + newest_id back as the next since + since_id.
Tuple cursor: pass since_id=<seq> to get an id-tiebreak
cursor — events sharing the same millisecond are never skipped or
duplicated at page boundaries. Poll with BOTH since + since_id and use
newest_timestamp + newest_id for the next iteration.
Event Structure
Every event in the store follows a consistent schema:
| Field | Type | Description |
|---|---|---|
id | string | Unique event identifier |
type | string | Event type (see below) |
aggregate_id | string | Aggregate root identifier |
seq | integer | Monotonic sequence within aggregate |
timestamp | integer | Unix timestamp (milliseconds) |
data | object | Event payload |
Event Types
Sol defines 102 event types (machine-derived census) across the
categories below. Each validated type is versioned and checked at ingestion
(sol_event_validator). The list here is the common set, not the exhaustive
catalog — the sync stream also carries channel.message_sent,
circuit.*, cluster.*, provider.*, session.* (checkpoint/branch
lifecycle), worker.connected/worker.disconnected, task.assigned/
task.dropped, and workflow.branch_created/workflow.compensation*
events.
Task Events
| Type | Aggregate | Description |
|---|---|---|
task.created | task_id | New task submitted |
task.started | task_id | Task began executing |
task.completed | task_id | Task finished successfully |
task.failed | task_id | Task execution failed |
task.dispatched | task_id | Task sent to a worker |
Model Events
| Type | Aggregate | Description |
|---|---|---|
model.started | model_name | Inference instance started |
model.stopped | model_name | Inference instance stopped |
model.failed | model_name | Inference startup failed |
model.discovered | model_name | Model found during discovery |
model.preparing | model_name | Prepare accepted, rsync running (async) |
model.prepared | model_name | Model files prepared |
model.prepare_failed | model_name | Prepare failed (row reverts to discovered) |
model.start_failed | model_name | Model failed to start |
Worker Events
| Type | Aggregate | Description |
|---|---|---|
worker.spawned | worker_id | Worker process created |
worker.crashed | worker_id | Worker process crashed |
worker.ready | worker_id | Worker announced readiness |
worker.status | worker_id | Worker status change (idle/busy/…) |
worker.task_started | task_id | Worker began a task |
worker.task_completed | task_id | Worker finished a task |
worker.task_failed | task_id | Worker task failed |
worker.spawn_failed | worker_id | Worker spawn failed |
worker.killed | worker_id | Worker killed by operator |
Inference Events
| Type | Aggregate | Description |
|---|---|---|
inference.request | request_id | Inference request received |
inference.complete | request_id | Inference completed |
inference.error | request_id | Inference error |
inference.interrupted | request_id | Inference interrupted |
Scheduler Events
| Type | Aggregate | Description |
|---|---|---|
scheduler.job_created | job_id | Scheduled job created |
scheduler.job_executed | job_id | Job executed |
scheduler.task_dispatched | job_id | Job dispatched a task |
Workflow Events
| Type | Aggregate | Description |
|---|---|---|
workflow.started | workflow_id | Workflow began |
workflow.completed | workflow_id | Workflow finished |
workflow.failed | workflow_id | Workflow failed |
workflow.step_started | workflow_id | Workflow step started |
workflow.compensation_failed | workflow_id | Compensation step failed |
Agent Events
| Type | Aggregate | Description |
|---|---|---|
agent.turn_started | task_id | Agent turn began |
agent.turn_completed | task_id | Agent turn completed |
agent.context_overflow | task_id | Context exceeded limits |
agent.diagnostic | task_id | Agent diagnostic event |
agent.loop_warning | task_id | Possible agent loop detected |
agent.loop_detected | task_id | Agent loop confirmed |
Team Events
| Type | Aggregate | Description |
|---|---|---|
team.created | team_id | Team created |
team.member_joined | team_id | Member joined team |
team.member_left | team_id | Member left team |
team.mail_sent | team_id | Team mail sent |
team.mail_expired | team_id | Team mail row expired (TTL) |
team.destroyed | team_id | Team destroyed |
Memory Events
| Type | Aggregate | Description |
|---|---|---|
memory.decayed | agent_id | Memory importance decayed |
memory.reflected | agent_id | Memory reflection triggered |
Note: there are no
memory.stored/memory.accessed/memory.forgottensync events, and noaudit.*sync events — the audit trail is the append-only JSONL log (sol_audit_log), not the sync-event store. See Audit.
SSE Streaming
Real-time event streaming via Server-Sent Events:
GET /api/v1/sync-events
curl -N -H "Authorization: Bearer $TOKEN" \
https://sol.example.com/api/v1/sync-events
SSE event format:
event: sync_event
data: {"id":"evt-1744730001","aggregate_id":"task-456","seq":7,"type":"task.completed","data":{"task_id":"t-456","status":"ok"},"timestamp":1744730001000}
event: sync_event
data: {"id":"evt-1744730002","aggregate_id":"worker-luna-02","seq":1,"type":"worker.ready","data":{"worker_id":"luna-02"},"timestamp":1744730002000}
Every event is emitted under a single event: sync_event line; the event’s own type (e.g. task.completed, worker.ready) is carried inside the JSON data. Use the categories query parameter to filter which event types you receive. A keep-alive comment (: ping) is sent every 15 seconds.
Event Hooks
Events support pre-commit and post-commit hooks. Hooks are registered programmatically:
Pre-commit hooks can validate or enrich event data before persistence Post-commit hooks trigger side effects (notifications, projections, ZMQ broadcasts)
Event Store
The event store is backed by Mnesia with automatic sequence numbering per aggregate. Key properties:
Events are append-only and immutable Each aggregate maintains a monotonic sequence counter Events are replayable for state reconstruction Projections can be registered for materialized views