harness
v1.9.12Thin durable turn loop that wires session-manager, context-manager, and llm-router into an agent loop; spawns sub-agents as child sessions.
Install
iii call compose::add worker=harness@1.9.12Run in your project with the iii engine running. Exact versions are immutable and digest-pinned.
skill doc
Orchestrating a fan-out run (opt-in guidance)
This is not part of any system prompt. The built-in identity prompts teach
the tools and nothing else; how to structure a multi-agent run
is the operator's choice. To use this guidance, paste it (or the parts that
fit) into the task prompt you give a top-level agent, or pass it via
harness::send / harness::spawn options.system_prompt (the default
enrich strategy appends it to the built-in identity). A worker could also
serve it mechanically by observing the harness::hook::on-pre-generate hook, the way
web::inject-guidance serves its own guidance — the harness itself ships no
such hook.
The invariant this pattern lives by:
The parent chooses and initializes a shared-state medium, observes it, and directly spawns workers. Workers only perform their assignments and update that medium. Changes to the medium notify the parent through its observers. Observers never decide to spawn workers.
1. Own the run
You — the top-level agent — own the whole control plane. Pick ONE shared medium for this run and initialize it before anything starts:
- a state scope named after the run (keys written with
state::set), - a database table (rows via
database::execute), - or any other observable medium the deployment offers.
Pin the medium's exact name once and use that identical string everywhere: in
every worker task and in every observer's args and filters. A gate watching results_v2
while workers write results never fires.
2. Arm notifications first
Observe with harness::observe before any producer starts — events do not
replay, so a write that lands before its observer is armed is lost to it.
- Completion: one wake on the medium's change function
(
state::on-changedfiltered on the run's scope,database::on-row-changedwith the run's table as args). Define completion YOUR way, per medium: astate::barriercondition over the N expected keys (skips until every arrival is in, then wakes you once with all of them), a wake per row change that you count yourself, or a completion key the last writer sets. - Deadline: a
harness::on-timerwake (args{ "in_ms": <ms> }) so silence becomes a notification instead of an eternal park. Alifecycle.expires_in_mson the completion wake does the same from the other side — an expired unfired wake wakes you with a notice. Set it to how long the work should take: a one-shot wake without one expires after 10 minutes.
3. Spawn workers directly
harness::spawn each worker yourself — no observer ever starts an agent. Each
task must be fully self-contained: the exact inputs inline, the exact medium
destination to write, and the status vocabulary this run uses (e.g. write
{ "status": "pending" | "running" | "done" | "error", ... } — the format is
YOURS to define; the platform does not prescribe one). Workers are LEAF
agents by capability: they cannot spawn, remove observers, or message
sessions; they may arm wakes for themselves. Pass options: { orchestrator: true } only for a sub-coordinator,
and hand it this same discipline in its task.
4. Wake, decide, act
Your observers wake you with the medium's events. On each wake you hold the
full control plane again: read the medium, judge progress, respawn a failed
item, extend the deadline, or finish. Worker failures reach you through the
medium (an error status the worker managed to record) or through your
deadline catching the silence — nothing is injected into your session on a
worker's behalf. harness::status { session_id: <child> } answers a direct
health question about a specific worker.
5. Tear down
Standing observers outlive the run until you remove them. At the end,
harness::unobserve { id } everything you observed, and clear the run's
medium if the deployment expects it. Give any deliberately-standing observer
a lifecycle bound up front so a forgotten teardown cannot fire forever.