Skip to main content
A run is a higher-level coordination unit that fans out a shared task to multiple agents simultaneously, collects their individual conclusions as run steps, and then applies an aggregation policy to produce a single final_decision. Runs build on top of individual task contracts — each agent step maps to one full task lifecycle internally — but you manage the whole group through a single run_id rather than tracking separate task_id values. Use runs when you need parallel exploration across different agents, models, or prompts and want the kernel to handle quorum, tie-breaking, and null-outcome recovery for you automatically.

The Run Spec Format

Define your run in a run-spec.json file. The minimal required fields are run_id, agents, and shared_inputs. Everything else defaults to sensible values.
run-spec.json

Run spec field reference

shared_inputs semantics

shared_inputs is the run-level business context that every agent receives. When it is a JSON object, the kernel merges its key-value pairs directly into each agent step’s TaskContract.inputs. It then injects prompt and agent_id from the agent spec, overwriting any same-named keys that were already in shared_inputs. For example, with the run spec above, analyst-a receives this inputs object:
The kernel forwards inputs as-is to the runtime /execute endpoint. URL and path values in shared_inputs are references only — WattSwarm does not auto-fetch remote pages or read local files on your behalf.

CLI Workflow

1

Initialize the run queue schema

Run this once per PostgreSQL database to create the runs, run_steps, and run_events tables:
If you are using Docker Compose, this runs automatically on container startup.
2

Submit the run spec and kick it off

Submit the spec and immediately move all steps to QUEUED state in one command:
Without --kickoff, the run and its steps are created in CREATED state. You can kickoff separately when ready:
3

Start a worker process (if not using compose)

The run queue requires at least one active worker process to claim and execute steps. If you are not using the Docker Compose setup (which starts a worker automatically), run:
The worker continuously polls for QUEUED or RETRY_WAIT steps, claims them with FOR UPDATE SKIP LOCKED, executes each step as a full task lifecycle, and advances the step to SUCCEEDED or FAILED.
4

Watch the run for completion

Poll the run status and per-step counts:
5

Fetch the final decision

Once the run status is FINALIZED, retrieve the aggregated result:
The result JSON contains final_decision, per-step conclusions, and aggregation metadata including resolution_paths and null_resolution for monitoring.
6

View the run event stream

Inspect the full sequence of run-level events for debugging or audit:
This returns up to 50 events by default. Pass --limit <n> to change the page size.

Aggregation Policies Explained

WattSwarm’s aggregation layer collects the final_decision from each completed step and applies your configured policies to resolve ties and null outcomes.

Tie resolvers (tie_policy.chain)

Tie resolvers run in order when two or more candidate values are equally represented across agent steps.

STOCHASTIC

Deterministic pseudo-random tie break derived from a hashed seed. No agent can predict or influence the outcome, but the result is reproducible given the same inputs. This is the default tie resolver.

CONFIDENCE_WEIGHTED

Sums the confidence field (or answer_confidence / decision_confidence) from each step’s output per candidate value and chooses the value with the unique highest total. Requires your executor to return a numeric confidence.

REPUTATION_WEIGHTED

Sums agent_reputation_units per candidate value and chooses the value with the unique highest total. Reputation scores are drawn from the local knowledge store. Useful when agents have a track record in the knowledge base.

REEXPLORE

Re-queues all terminal steps, injects an _aggregation_signal into each step’s inputs (NEED_MORE_EVIDENCE), and starts another execution round. Emits RUN_TIE_REEXPLORE_TRIGGERED. Subject to max_tie_iterations and no_new_evidence_rounds guards.

Null resolvers (null_policy.chain)

Null resolvers run independently of the tie chain when no consensus is reached at all (empty result set or quorum null).

Cancel and Retry

To cancel a running or queued run:
To retry a failed run (resets failed steps back to QUEUED):

Worker process required. Writing rows directly into the runs table is not sufficient for execution. The queue requires valid run_steps rows and at least one active run worker process. If you are using Docker Compose, the worker container handles this automatically. For standalone setups, keep a run worker process running alongside the kernel.