Prerequisites
- Rust toolchain — stable channel, installed via rustup. The workspace uses a standard
cargobuild. - PostgreSQL — WattSwarm uses PostgreSQL as its source of truth for the event log, projections, leases, votes, and decision memory. In local development the default connection is
postgres://postgres:postgres@127.0.0.1:55432/wattswarm. If you run Postgres directly (not via Docker), adjust theWATTSWARM_PG_URLenvironment variable to match your instance. - The WattSwarm repo — clone it and
cdin:
If you want PostgreSQL managed for you with zero configuration, the Docker Quickstart spins up a full stack (PostgreSQL on port
55432, kernel, runtime, and worker) with a single docker compose up command.Steps
Build the WattSwarm binary
Compile all workspace binaries in release mode. This produces You can skip the build step and use
wattswarm, wattswarm-runtime, and related tools under target/release/.cargo run --bin wattswarm -- <args> throughout this guide if you prefer incremental dev builds. Both approaches produce identical behavior.Start the reference runtime
Open a dedicated terminal and start You should see:Leave this terminal running for the rest of the guide.
wattswarm-runtime. This binary exposes the four HTTP endpoints the kernel calls during task execution: /health, /capabilities, /execute, and /verify.The reference runtime echoes your task inputs back as candidate output — it is not a real AI agent. Its purpose is to give you a working end-to-end flow so you can observe the full kernel lifecycle (propose → verify → vote → finalize) before wiring up a real model endpoint. See Building a Runtime to replace it with your own executor.
Bring the node up
In a second terminal, initialize the node. The Expected output:WattSwarm auto-bootstraps a
--state-dir flag sets the directory where WattSwarm stores startup_config.json, node_state.json, and node_seed.hex. The --store flag is a logical identifier for the local PostgreSQL store binding.local:<node_id> network and org on first start, so no prior network configuration is needed for local development.Register the executor
Tell the kernel where to find the reference runtime you started in Step 2. The name Expected output:You can register as many executors as you like. Each is identified by name and base URL and stored in the kernel’s local executor registry. To verify the registration is reachable, run:
rt is used later to select this executor when running a task.Create a task contract
Save the following JSON as Then submit the contract to the kernel:Expected output:
task.json in your working directory. This is the boundary object between your application and the WattSwarm kernel — it describes what the task is, what a valid response looks like, and the stage budgets that gate execution.task.json
Run the real task flow
Trigger the complete kernel execution chain. This command drives the task through every lifecycle stage: The
TASK_CREATED → TASK_CLAIMED(propose) → CANDIDATE_PROPOSED → TASK_CLAIMED(verify) → EVIDENCE_AVAILABLE → VERIFIER_RESULT_SUBMITTED → VOTE_COMMIT → VOTE_REVEAL → DECISION_COMMITTED → DECISION_FINALIZED.--executor flag names the registered executor to use. The --profile flag maps to the profile declared in the runtime’s capabilities (default is always available on the reference runtime). The command blocks until the task reaches a terminal state and then prints a JSON result summary.Fetch the decision
Once the task is finalized, read the committed and finalized candidate IDs from the kernel’s decision memory:You will see output similar to:Both
committed and finalized fields being populated confirms the task completed the full consensus cycle. The candidate ID links back to the output the reference runtime produced during the execute call — in this case "default::Summarize the benefits of swarm coordination for multi-agent systems." echoed through the answer field.What to expect
Aftertask run-real completes, the structured result printed to stdout looks like this:
answer value reflects the reference runtime’s echo behavior: it concatenates your --profile value with the inputs.prompt string. When you replace the reference runtime with a real agent executor, this field will contain your model’s actual response.
Next steps
Build a Runtime
Replace the echo executor with a real model endpoint by implementing
/health, /capabilities, /execute, and /verify.Docker Quickstart
Run the full stack — PostgreSQL, kernel, runtime, and worker — with a single
docker compose up command.Multi-Agent Runs
Orchestrate multiple agents in parallel using the run queue, with quorum and aggregation policies applied across all results.
P2P Networking
Connect nodes over Iroh QUIC, gossip events, and sync decisions across a decentralized swarm.