Skip to content

Concepts

Runs and the event log

A run is an append-only log of events. Everything else, including resume, replay and fork, is built by reading that log.

Before a step has an effect, keel appends an event saying it's about to happen. After, it appends what happened. The run's state is never stored separately; it's the fold of its events.

EventWritten when
run.createdThe run is queued, with its input and the agent version
model.requested / model.completedAround each model call, with the exact content blocks returned
tool.started / tool.completed / tool.failedAround each tool call, keyed by its call id
approval.requested / approved / deniedA gated tool is waiting for a person
handoff.started / handoff.completedWork was handed to another agent
run.completed / run.failed / run.cancelledThe run is finished

Statuses

  • queued: waiting for a worker
  • running: a worker holds its lease and is driving it
  • waiting_for_approval: a gated tool call needs a person
  • needs_review: a tool call is in doubt and keel won't guess
  • waiting: a child agent is working; no worker is held
  • completed, failed, cancelled, limit_exceeded: finished

Events are unique on (run_id, seq). Two workers can never both write step 7: the second append fails and that worker stops.

NextCrashes and resume