Skip to main content
Running your first task teaches you the complete WattSwarm lifecycle: you define a task contract, submit it to the kernel, trigger the real execution chain through a registered executor, and read back the finalized decision value and evidence summary.

Prerequisites

Before you start, make sure you have:
  • The wattswarm binary built (cargo build --bin wattswarm)
  • wattswarm-runtime built and running (cargo run --bin wattswarm-runtime -- --listen 127.0.0.1:8787)
  • A node started with wattswarm node up
  • The rt executor registered (wattswarm executors add rt http://127.0.0.1:8787)
If any of these steps are unfamiliar, follow the Quick Start guide first, then return here.

Creating a Task Contract

A task contract is the boundary object between your application and the WattSwarm kernel. It is a JSON document that tells the kernel what work to do, what a valid answer looks like, how much compute budget to allocate across execution stages, and when the task expires. Create a file called task.json in your working directory:
task.json

Field reference

The output_schema field is what vp.schema_only.v1 (the default verification policy) validates against. Make sure every required field your executor returns is declared here, or verification will fail.The acceptance.verifier_policy.policy_hash value must be the actual SHA-256 hash of the policy definition. When using task run-real, the kernel resolves this automatically. If you are submitting a raw task contract, run wattswarm executors check <name> to retrieve the correct hash for your runtime’s registered policies.

Submit the Task

Submit the task contract to the kernel’s local event log:
The kernel stores the contract and emits a TASK_CREATED event. At this point the task exists but has not been executed yet.

Run the Task

Trigger the full execution chain using a registered executor:
task run-real drives the complete lifecycle sequence internally:
The command blocks until the task reaches a terminal state and then prints the result as JSON.

Watch for Completion

If you want to poll the task state separately (for example, when running in compose where the worker drives execution asynchronously), use:
The output shows the current state, whether a candidate has been committed, and whether the task has been finalized:

Fetch the Decision

Once the task is finalized, retrieve the full decision record:
The decision output includes:

Understanding the decision output

The full decision memory — including quorum_result_json and reason_details — is persisted to the knowledge store for future reuse. Tasks of the same task_type can benefit from seed bundles drawn from previous decisions.

Using the UI Console

If you prefer a visual interface, all of the above steps are available through the built-in kernel console. Start the UI server:
Then open http://127.0.0.1:7788/ in your browser. The recommended operation order on the console matches the CLI workflow above:
  1. Node → UP
  2. Executors → ADD (name rt, base URL http://127.0.0.1:8787)
  3. Executors → CHECK
  4. Task → SAMPLE (optionally apply a preset)
  5. Task → SUBMIT
  6. Task → RUN-REAL
  7. Task → WATCH / DECISION
The Task panel also includes a built-in TaskContract Minimal Reference snippet and preset helpers for common task shapes (swarm / arbitrage / security).