Skip to main content
The run command group manages the WattSwarm multi-agent orchestration queue. Unlike task run-real, which drives a single task synchronously, the run queue lets you define a set of agents as a RunSubmitSpec, submit the spec to PostgreSQL, and have a long-running worker process execute each step concurrently. Runs are durable: they survive restarts and support cancel, retry, and result queries at any point. All run subcommands accept a --pg-url flag to override the PostgreSQL connection string. You can also set the connection permanently via the WATTSWARM_PG_URL environment variable.

run init

Initialise the run queue schema in PostgreSQL. Synopsis
Description Creates the runs, run_steps, and run_events tables (and supporting indexes) in the target PostgreSQL database if they do not already exist. Call this once before submitting your first run. The Docker Compose setup runs run init automatically on container startup. Example

run submit

Submit a RunSubmitSpec JSON file to the run queue. Synopsis
Arguments Flags Description Parses the spec file, creates a run record and one run_step row per agent, and prints the resulting run record as JSON. The shared_inputs object in the spec is merged into each agent’s TaskContract.inputs before the step is stored. Example

Sample run-spec.json


run kickoff

Move a run and all its steps to QUEUED so the worker can pick them up. Synopsis
Arguments Description Transitions the run from PENDING to QUEUED and updates all run_steps accordingly. The worker loop picks up queued steps on its next poll interval. Use --kickoff on run submit to combine submission and kickoff in a single command. Example

run watch

Poll a run until it reaches a terminal state. Synopsis
Arguments Description Reads the current run view from PostgreSQL and prints the run state, step statuses, and aggregation progress as pretty-printed JSON. The command returns immediately with the current snapshot — it does not block in a continuous poll loop. Run it repeatedly or in a shell loop to track progress. Example

run result

Fetch the final decision and per-step conclusions for a completed run. Synopsis
Arguments Description Returns the runs.result_json payload as pretty-printed JSON. The result includes final_decision, final_answer, and per-step conclusion records. The result is available once the run reaches the FINALIZED state. Example

run events

Stream events for a run. Synopsis
Arguments Flags Description Returns the most recent run_events rows for the run as pretty-printed JSON, ordered by creation time. Use this to diagnose step failures, observe aggregation policy decisions, and trace re-explore triggers. Example

run cancel

Cancel an active run. Synopsis
Arguments Description Requests cancellation of the run. In-flight steps finish their current execution attempt; no new steps are claimed after the cancellation is applied. The run transitions to CANCELLED. Example

run retry

Retry a failed run. Synopsis
Arguments Description Resets failed steps to QUEUED and moves the run back to an active state so the worker can re-execute them. Retry uses exponential backoff via RETRY_WAIT → QUEUED transitions. Example

run worker

Start the long-running run queue worker process. Synopsis
Flags Additional worker flags Description run worker is a long-running process that continuously claims run_steps in QUEUED or RETRY_WAIT state, executes them by driving the full WattSwarm task lifecycle against the registered executor, and updates step and run status until each step reaches a terminal state (FINALIZED, FAILED, or CANCELLED). You must run at least one worker process for any run to make progress. The Docker Compose setup starts a dedicated worker container automatically.
Writing rows directly into the runs table is not sufficient for execution. Runs require valid run_steps rows and at least one active worker process claiming them.
Examples