POST /execute on your runtime whenever the kernel assigns your executor as a proposer or finalizer in a task round. Your handler receives all the context needed to produce a candidate — the task inputs, the execution profile, the full task contract, and an optional knowledge seed from the Knowledge Store — and returns a structured output with evidence.
Request body — ExecuteRequest
Unique identifier for the task. Stable across all execution attempts for this task.
Unique identifier for this specific execution attempt. Use this together with
attempt_id for idempotency checks.The task type string for this execution. Must match one of the
task_types values your runtime advertises on GET /capabilities. The kernel will not call your runtime with a task type you did not declare.Merged task inputs. Contains the task-level
prompt field and any key-value pairs from the run’s shared_inputs. Your runtime reads agent instructions from inputs.prompt and any domain-specific fields from the remaining keys.Execution profile name (for example,
"default" or "fast"). Use this to switch between model configurations, sampling parameters, or compute budgets. Must match one of the profiles declared in your /capabilities response.The full
TaskContract for this task. Includes output_schema (the JSON Schema your candidate_output must satisfy), budget (cost limits per stage), and assignment metadata. Your runtime may inspect output_schema to shape the output correctly before returning.Indicates the role this execution plays in the round:
"explore"— propose a candidate output. This is the default proposer stage."verify"— you are acting as a verifier; produce a candidate to cross-check against the assigned candidate. (Most runtimes use/verifyfor this role instead.)"finalize"— produce the authoritative final output after quorum is reached.
Attempt identifier for deduplication. If your runtime receives the same
attempt_id twice (for example, due to a network retry), you may return a cached result rather than re-executing.Optional knowledge seed injected from the Knowledge Store. Contains prior decision records and evidence that matched this task type. Use the seed to skip redundant exploration or to bias the output toward known-good answers. The kernel falls back to a fresh
explore call if the seed bundle exceeds size limits.Response body — ExecuteResponse
A JSON object that must validate against
task_contract.output_schema. The kernel rejects candidates that fail schema validation before they enter the voting round.Inline evidence payloads attached to this candidate. Each item is an object with:
mime(string) — MIME type of the evidence content (e.g."text/plain","application/json")content(string) — the evidence payload, serialised to a string
External evidence references. Each item is an
ArtifactRef with the following fields:| Field | Type | Description |
|---|---|---|
uri | string | Artifact URI (URL or content-addressed reference) |
digest | string | sha256:<hex> content hash |
size_bytes | number | Byte size of the artifact |
mime | string | MIME type |
created_at | number | Unix timestamp in milliseconds |
producer | string | Producer identifier, e.g. "swarm-runtime/swarm-model-v1" |
Example request and response
Stage semantics
Thestage field tells your runtime what role it plays in the current round:
| Stage | Role | What to do |
|---|---|---|
explore | Proposer | Generate a fresh candidate from inputs; return your best answer with evidence |
verify | Cross-checker | Re-derive a candidate independently to check it against the assigned candidate (used when /verify is not the primary verification path) |
finalize | Finalizer | Produce the authoritative output after quorum; may incorporate prior round evidence |
candidate_output must validate against output_schema. The kernel checks schema compliance before accepting the candidate into the round. Return a 400 status if your runtime cannot produce a compliant output so the kernel can retry or reassign.Minimal Rust handler
The following is a simplified version of the handler fromapps/wattswarm-runtime: