Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

First workflow

A workflow is a durable, multi-step execution with compensation. Recipes are named, validated workflow definitions.

1. List recipes

zerg recipe-list

2. Inspect a recipe

zerg recipe-show incident-analysis

A recipe declares steps, their task/agent bindings, and compensation behavior.

3. Run it

zerg recipe-run incident-analysis --payload '{"alert_id":"42"}'

Or start a workflow directly:

curl -X POST http://127.0.0.1:21434/api/v1/workflows/start \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "code-review",
    "payload": {},
    "objective": "Review the diff for bugs",
    "token_budget": 50000,
    "time_budget_ms": 600000
  }'

Response: { "workflow_id": "wf-...", "status": "started" }.

4. Inspect progress

zerg workflow show <workflow-id>
zerg workflow tree <workflow-id>
zerg workflow lineage <workflow-id>

The tree shows steps; lineage shows the execution history.

5. Pause, resume, cancel

Pause is a gate: events arriving while paused are parked and resumed deliberately. Cancel triggers compensation for completed steps.

zerg workflow cancel <workflow-id>

6. Schedule it

zerg schedule add "Run the nightly code-review workflow" --name nightly-review --cron "0 2 * * *"
zerg schedule list
zerg schedule pause <job-id>

Schedules are validated at create time (day/month impossibility is refused); times are interpreted in UTC unless your deployment config says otherwise.

Verify

zerg workflow show reports a terminal status. The event stream shows workflow.* transitions. A deliberate failure runs the compensation chain; the runbook documents the retry/compensation semantics.

Next

Workflows and scheduler Production runbook Events