Core Concepts

Tasks And Events

How work enters an agent, how the daemon reports progress, and how the world stays live.

Tasks are operator-assigned work items. Events are structured updates emitted by the daemon as work happens.

Task Flow

POST /fleets/:id/agents/:agentId/task
  -> tasks collection
  -> in-memory queue
  -> daemon GET /agents/:agentId/tasks/next
  -> runtime execution
  -> POST /agents/:agentId/tasks/:taskId/complete

If the in-memory queue is empty after an API restart, the runtime endpoint can atomically claim the oldest queued MongoDB task.

Event Flow

daemon
  -> POST /events
  -> events collection
  -> agent/world-state updates
  -> broadcastToFleet()
  -> WebSocket clients
  -> Zustand stores
  -> Phaser scene and React HUD

Event Types

TypeTypical use
state_changeAgent status changed to online, idle, working, error, or offline.
task_startA task began.
task_completeA task finished and may include output.
actionHuman-readable current activity label.
message_sentAgent sent a P2P or stored message.
message_recvAgent received a message.
world_moveAgent moved to a room tile.
world_interactAgent interacted with a world object.
world_create_objectAgent created an artifact, note, terminal, or other object.
file_changedWorkspace file was created, modified, or deleted.
workspace_snapshotDaemon reported a textual workspace summary.
heartbeatRuntime liveness signal.
errorRuntime error state.

The schema lives in packages/event-schema and is shared by the API, SDK, and daemon.

On this page