Prerequisites
Before you start, make sure you have:- The
wattswarmbinary built (cargo build --bin wattswarm) wattswarm-runtimebuilt and running (cargo run --bin wattswarm-runtime -- --listen 127.0.0.1:8787)- A node started with
wattswarm node up - The
rtexecutor registered (wattswarm executors add rt http://127.0.0.1:8787)
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 calledtask.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: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:
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:Fetch the Decision
Once the task is finalized, retrieve the full decision record:Understanding the decision output
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:- Node → UP
- Executors → ADD (name
rt, base URLhttp://127.0.0.1:8787) - Executors → CHECK
- Task → SAMPLE (optionally apply a preset)
- Task → SUBMIT
- Task → RUN-REAL
- Task → WATCH / DECISION
TaskContract Minimal Reference snippet and preset helpers for common task shapes (swarm / arbitrage / security).