← Harness Engineering From First Principles

Delegation Without Unbounded Autonomy

Give delegated tasks explicit scopes, acceptance checks and budget shares; test scope violations.

A parent agent working on the transient-retry bug from Chapter 13 decides to delegate: “Investigate how retries are configured and report back.” The child agent is capable and diligent. It reads the configuration, then the scheduler, then the worker. It notices that a test is missing, writes one, runs the suite, finds a failure, and fixes it. To be thorough, it delegates two sub-investigations of its own. It spends three times what the parent expected. It returns: “Done. Retry configuration documented, a bug fixed, tests passing.”

None of that was malicious, and much of it may even have been correct. But the parent asked for an investigation and got edits. It budgeted one child and got three. It expected a report it could check and got a claim it cannot. Delegation without bounds turns one supervised agent into a tree of unsupervised ones. Each node inherits whatever authority the harness gives it and spends whatever budget it can reach.

This chapter treats delegation as the harness-level operation it is. A delegation assigns bounded work to another agent while the delegator keeps responsibility for integration and outcome. The engineering question is what must travel with the assignment so that “bounded” is enforced rather than requested.

Evidence status. Draft manuscript. Formal scope-violation study (§19.7) has not run. The educational delegation demonstration D19-DELEGATE-01 is implemented and executed (examples/pi-harness-lab/src/delegation.ts; test/delegation.test.ts, 14/14 pass offline with scripted children). It admits bounded assignments, enforces tool/grant/depth/budget scope, binds results to assignment and source version, and accepts deliverables only through parent-side evidence checks. Delegation is implemented in this book’s code as an educational mechanism; the formal study, live-model behaviour, and any ecosystem duplication check remain open. Project 01 is a single worker under a supervisor, and it is REJECTED for offline acceptance (REVIEW-02). Agensh and Agent Framework facts are DOCUMENTED or OBSERVED via the R01 dossier (static inspection; no execution). Pi facts come from R02 (Established for the inspected 1.6.0 artifact; TEST NOT RUN). The budget arithmetic below (§19.4) is executed through the hierarchical reservation rules, not hypothetical.

19.1 Why delegate at all

Delegation has three legitimate motivations, and each implies a different contract.

Context isolation. A sub-task gets a fresh, small context instead of inheriting the parent’s growing one. This is Chapter 7’s spend and attention argument applied to agents: a child investigating configuration does not need forty turns of parent history.

Capability separation. A sub-task runs with a narrower tool surface than its parent: read-only investigation for a parent that can edit. This is least capability per task (Chapter 11), arrived at by structure rather than by prompt.

Parallelism. Independent sub-tasks can run at once (Chapter 20).

There is also an illegitimate motivation: delegation as a way to obtain more budget, more attempts or more authority than the parent was given. A delegation contract exists mainly to make that impossible.

Could the same results be achieved without a second agent? Often, yes. A read-only sub-task can be a fresh Pi episode run by the host, in the episode-per-state design of Chapter 13 §13.2, with no agent-to-agent delegation at all. The distinction matters. In host-orchestrated decomposition, the host decides that a sub-task exists, and its scope is host code. In agent-initiated delegation, a model decides, at runtime, to create work for another model. The second is more flexible and much harder to bound, because the scope itself is model-written. This chapter covers both, and argues that agent-initiated delegation is acceptable only when the harness, not the delegating model, turns the requested scope into an enforced one.

19.2 The delegation contract

A delegated task carries seven elements. Each one answers a question the opening example left open. The contract below is the admission and acceptance half of the design, executed in D19-DELEGATE-01; the broker enforcement half (out-of-process grants, §19.3) remains proposed.

Element Question it answers Enforced by
Objective and deliverable type What exactly must come back? The parent’s acceptance check (below)
Scope Which data, tools and effects may the child use? The host’s construction of the child episode, and the broker (Chapters 11–12)
Authority Which permissions does the child hold? The broker, through grants attenuated from the parent’s (§19.3)
Budget share How much of which resources may the child spend? The hierarchical ledger (§19.4)
Deadline By when, including time to stop? The supervisor’s deadline hierarchy (Chapter 17 §17.3)
Acceptance check How will the parent decide that the deliverable is usable? Parent-side evaluator, independent of the child’s report
Effect policy Which external operations are allowed, and how are uncertain effects resolved? External broker: operation-bound authorization, idempotency/reconciliation and explicit compensation rules

Three of these deserve more comment.

Scope is constructed, not described. “Investigate configuration; do not edit” written in a child’s prompt is Chapter 1’s prompt-as-policy. The scope is enforced when the host constructs the child’s Pi session with only read tools. R02 records that sessions accept explicit tool selection by literal name (C01, C02), so a child created without an edit tool cannot edit through Pi’s tool route. As Chapter 11 showed, in-process code is still bounded only by the process’s own rights. A child that must not touch user files needs a worker that lacks those rights, not just a missing tool.

The deliverable type is checkable. “Report back” is not a deliverable type. “A list of claims, each citing fixture file ID, digest and line range” is one. A typed deliverable lets the parent run Chapter 8’s provenance checks and Chapter 14’s path checks on what comes back. An untyped one leaves the parent with prose to trust.

The acceptance check belongs to the parent. The child’s summary, “done, tests passing”, is a claim from a component about its own work. Project 01’s history shows what such claims are worth when unchecked. Worker summaries reporting fractional model calls and zero bytes were accepted until reconciliation against observed events was added (RER-02, Chapter 4). The parent must verify the deliverable against evidence it can inspect itself: supervisor-observed calls, independently resolved sources and authenticated runner receipts. The recorder and receipt sink must be outside the child’s write authority. A child-authored log, or a digest the child can recompute, is not an independent witness. Protect the runner and evaluator definitions too; a child must not edit what certifies its work.

19.3 Authority can only narrow

When a parent delegates, the child should receive at most the parent’s authority, and normally less. Security engineering calls this attenuation. A delegated permission may be restricted further, but it can never be widened.

The reason is Chapter 11’s confused deputy, applied once more. If a child can request authority the parent lacks, for example by asking the broker for a broader grant on the parent’s behalf, then any parent can obtain any authority by delegating to a child that asks for it. The rule that closes this is simple to state and must be enforced by the broker. A grant to a delegated principal is valid only if it is a subset of a grant held by its delegator, and only for the delegated task’s run, scope and expiry. Chapter 12’s approval-binding fields (principal, run, operation, target, preconditions, policy revision, expiry, uses, scope) apply unchanged, with one addition: the delegation chain. Every grant records the chain of principals from the human or policy that originated it to the agent that holds it, so that the broker can check the subset relation at every link.

Set inclusion is only the non-consumable part of attenuation. Suppose a parent holds one permitted use: copying uses = 1 to two children creates two uses. The broker must atomically reserve or debit child uses and cost from the same parent allowance; each use consumes the shared balance once. Rate limits share a defined window and counter, not a fresh counter per child. Child expiry cannot exceed parent expiry; its remaining depth must decrease; revoking an ancestor denies every descendant’s new operation. These constraints require broker enforcement outside child control, plus OS isolation where ambient process rights could bypass the broker (Chapter 11). Tool selection alone controls only the Pi tool route.

Approvals need particular care. A human who approved a parent’s patch did not approve a child’s different patch, even if the child is “helping”. In Chapter 12’s terms, an approval binds to an operation digest. A child operation is a different operation. Delegation never transfers approvals. It can only carry the requirement for one, which the child must obtain for its own operation.

The comparison with an existing system is instructive. R01’s inspection of Agensh found that it launches Pi’s native RPC process and translates a subset of ACP. It does not implement another model or tool loop (R01-MICROSOFT.md R01-C04; OBSERVED, static inspection). It starts Pi with --no-approve, and relies on a non-root child and outer supervision (R01-C07). R01’s limitation is explicit: “neither proves isolation”. The design choice to rely on outer supervision, not on the agent’s own restraint, is the same choice this chapter makes. Agensh’s documented large-team experiments used Copilot, not Pi (R01-C11), so they say nothing about Pi delegation at scale.

19.4 Budget shares and the hierarchical ledger

A child’s budget is carved out of the parent’s, and never added to it. The hierarchical ledger extends Chapter 17’s ledger with one invariant, executed in D19-DELEGATE-01 through the shared SpendLedger (reserve at delegation, reconcile at terminal, hold on unknown; the broker-side atomic guarantees of §19.3 remain proposed):

Conservation. At every moment, the parent’s own spend, plus the sum of its children’s spend, plus the unspent reservations still held for children, never exceeds the parent’s budget. The same rule applies recursively to every child.

This is an invariant of one authoritative host ledger, outside child write authority, with atomic admission/reservation/reconciliation across the whole tree. All model requests, retries and effect charges must pass it; independent parent and child counters cannot enforce conservation. At the root, count each descendant’s committed spend once, plus remaining reservations, not both a child’s allocation and its internal spends. At each node, its child suballocations subdivide its existing reservation; they do not add a second root charge. Available balance is ceiling minus committed consumption minus outstanding holds. Reserve-before-dispatch and the billed-unit bounds of Chapter 17 remain assumptions.

Reservations matter because children spend concurrently and report late. A parent that grants a child a 25,000-token share reserves 25,000 at the moment of delegation. It releases the unspent part only when the child reaches a terminal state and its actual spend is reconciled. A parent that counts only what children have reported will overcommit whenever a child is still running.

Hypothetical numbers; arithmetic shown. The run budget is 120,000 tokens. The parent keeps 30,000 for its own reasoning and integration, and a 15,000 reserve for retries and the final evaluation. It delegates three read-only investigations at 25,000 each:

30,000 (parent) + 3 × 25,000 (children) + 15,000 (reserve) = 30,000 + 75,000 + 15,000 = 120,000. ✓

Each child is governed by Rule P (Chapter 17) against its own share, so each admits only bounded requests that fit its share, under Chapter 17’s assumptions. Suppose child 1 finishes at 18,000, child 2 at 24,100, and child 3 times out with usage unknown. Then:

  • Child 1 releases 25,000 − 18,000 = 7,000 to the parent’s pool.
  • Child 2 releases 25,000 − 24,100 = 900.
  • Child 3’s 25,000 reservation stays held. Its true spend is unknown, and Chapter 17’s USAGE_UNKNOWN rule forbids assuming it was less.

The 7,900 is released in the accounting ledger, but child 3’s unknown usage blocks new root admissions until reconciled: another child or the parent may not spend from that root’s exposed balance while the provider-side exposure is unknown. Its held 25,000 is an accounting commitment, not a proven ceiling on actual billing, nor a measured lower bound on actual consumption. Termination prevents new local requests; it does not disclose consumption already billed. Release only after safe reconciliation, for example against authoritative final usage/billing. After that, the parent may use its own remaining share, reserve and released capacity. Conservation protects ledger allocations; it does not by itself guarantee a provider invoice.

What about the opening example’s grandchildren? Depth is part of scope. A child given no delegation capability cannot delegate. A child allowed to delegate does so from its own share, under the same conservation rule. Thus the whole tree’s admitted reservations are bounded by the root ledger, however deep it grows, provided every route is mediated. Actual consumption inherits Chapter 17’s conditional billed-unit bounds. A maximum depth is a separate, simple bound, worth enforcing anyway, because unbounded depth multiplies coordination overhead even inside a fixed budget.

Cancellation and revocation

The proposed cancellation transition first closes admission for the delegation and its descendants. Pending work never dispatched can release its hold once that fact is established. Running models receive cooperative abort, then supervisor termination if necessary. In-flight tools and external effects are reconciled separately: revocation refuses new broker operations but cannot retract an effect already committed elsewhere. The effect policy binds each operation ID, approval, preconditions, idempotency key and reconciliation/compensation rule (Chapters 10–12). Compensation is a newly authorized operation, not promised rollback.

Running reservations remain held until safe final accounting. Late results are quarantined as evidence, not allowed to restart a terminal child or release money twice. Unknown effect completion or unconfirmed termination blocks conflicting follow-up work; the parent records UNKNOWN effect state or unconfirmed cleanup and escalates. It cannot label the operation cancelled merely because a timer expired.

19.5 Seven kinds of information that must not be confused

Delegation is where the book’s distinctions about state are most easily lost, because state crosses agent boundaries. Seven kinds of information are in play, and each has a different owner and a different standing.

Kind Example in the opening Owner Standing
Local agent state Child’s Pi session history The child’s runtime Conversation; not a record of effects (Chapter 9)
Durable task state Journal entries: delegation issued, reservation, child terminal Host Authoritative for “what happened to the task”
Shared evidence Fixture excerpts with digests, test-runner outputs Evidence store, written by tools and runners Checkable; cited by ID (Chapter 8)
Model-generated beliefs “Retry configuration documented; bug fixed” The child model Claims, to be verified
Verified outcomes Parent’s acceptance check result Parent-side evaluator Judgment, with evidence references (Chapter 15)
Authorized actions Broker grants held by the child; effects executed Broker The only route to effects (Chapters 11–12)
Proposed plans Child’s intended sub-delegations The child model Proposals; become delegations only if the host admits them

The failure the opening illustrates is a row-crossing error. The child’s belief (“bug fixed”) was treated as a verified outcome. Its proposed plan (sub-investigations) became authorized actions without admission. And its local state (a session that edited files) stood in for durable task state (no journal of which effects happened). A delegation contract is mostly a set of rules for moving information between rows. Beliefs move to verified outcomes only through the parent’s acceptance check. Plans move to actions only through admission and the broker. Local state contributes to the task record only through the journal.

19.6 Worked example: bounded investigation of the retry bug

This section is an executed educational demonstration, D19-DELEGATE-01 (examples/pi-harness-lab/src/delegation.ts; test/delegation.test.ts, 14/14 pass offline with scripted children). The host-side contract below is the implemented one, reusing the Batch 01–04 mechanisms (authority gate, spend ledger, event journal, claim evaluation) rather than a second framework:

// Implemented in examples/pi-harness-lab/src/delegation.ts (D19-DELEGATE-01, executed).
interface Delegation {
  delegationId: string;   // unique assignment identity; replay protection
  parentRunId: string;
  parentTaskId: string;
  childId: string;
  objective: string;
  deliverable: "cited-claims-v1";            // typed, checkable by the parent
  tools: ToolName[];      // constructed scope: the child's only tools
  grants: string[];       // each a subset of a parent grant (attenuation)
  maxDepth: number;       // this child may not delegate (0)
  budgetShare: number;    // reserved from the parent ledger at admission
  baseSha256: string;     // source version the assignment binds
  effectPolicy: "read-only-no-external-effects";
}
// A result carries claims, artifacts, asserted grants and spend.
// Acceptance is a separate parent-side step (accept()), never implied
// by submission. A child's "approved: true" field is not a type member
// and buys nothing.

The parent proposes delegating “Find where the maximum retry count is configured and which function enforces it”. The host admits the delegation only if (executed checks):

  • the tools requested are a subset of the parent’s;
  • every asserted grant is held by the parent (attenuation);
  • the budget share fits under conservation (reserved in the ledger);
  • the depth is within limit;
  • no effectful grant is requested.

It then constructs the child’s episode with exactly the assigned tools. Scope is enforced by construction, and a child that touches anything else is refused at submission, not at review.

The child returns the three claims from the opening narrative — two supported, one an over-reading inference:

  1. max_attempts in retry-config, with its digest.
  2. execute_with_retry in worker, lines 12–16, with its digest.
  3. “execute_with_retry enforces max_attempts”.

The parent’s acceptance check runs Chapter 8’s provenance resolution on each claim against parent-held evidence — executed in accept(), which returns per-claim verdicts rather than a single score. The cited excerpts exist in the evidence store, so the path condition of Chapter 14 holds, and the digests match. Claims 1 and 2 are supported. Claim 3 is unsupported: nothing in the cited lines reads the limit. The parent accepts claims 1 and 2, rejects claim 3 with that reason, and records all three, the evidence references and the child’s reconciled spend in the journal. Reproduce it with npm --prefix examples/pi-harness-lab test (D19 suite: supported/unsupported arbitration, forged-approval, cross-child, replay, failure, missing, late, stale and conservation cases).

The rejection is not a failure of delegation. It is delegation working. A plausible inference from a capable child was stopped at the boundary, because the parent checked the evidence instead of the prose. (Readers following the fixture will recognize that claim 3 is the same kind of premise error that makes task T4 ambiguous, Chapter 5 §5.6. The fixture’s comments assert more than its code does.)

19.7 Study: scope violations

The chapter brief asks to test scope violations. This study is PROPOSED; EXPERIMENT PENDING.

  • Research question. Do delegation boundaries hold when a child attempts to exceed them?
  • Hypothesis. Every attempt to exceed tools, authority, budget, depth or deadline is refused by the enforcing component, and the parent’s record shows it.
  • Alternative hypothesis. At least one boundary is enforced only by instruction and fails under a scripted adversarial child.
  • Independent variable. The violation type, delivered by a scripted child (a scripted Pi provider):
    • calling a tool not in scope;
    • requesting a grant broader than the parent’s;
    • reusing a parent’s approval for its own operation;
    • spending past its share;
    • delegating beyond the maximum depth;
    • ignoring a deadline;
    • returning claims without independently observed evidence;
    • racing two children for a parent’s single-use grant or final budget share;
    • cancelling pending and running children, then delivering late results;
    • revoking an ancestor during an in-flight effect, with completion unknown;
    • forging the child’s trace or modifying the receipt sink.
  • Dependent variables. Refusal at the expected component; independent canaries for any effect (Chapter 11); the conservation invariant checked at every journal write; and the parent’s acceptance results for evidence-free claims.
  • Controls. A compliant scripted child, whose work must succeed, and the identical violation set run against an “instruction-only” variant where scope is described in the prompt but not constructed. That variant is expected to fail, which confirms the test can detect enforcement.
  • Fixture. The Project 01 synthetic fixture, or a successor, a stub broker with grant subset checking, and a hierarchical ledger.
  • Evaluation. Deterministic. Expected refusals are authored in advance.
  • Failure criteria. Any violation not refused by the enforced variant; any conservation breach; any evidence-free claim accepted.
  • Threats. Scripted children test boundaries, not the rate at which real models attempt violations. Measuring that rate is a separate live study, if it is worth its cost.
  • Status. Formal study not started. Delegation admission, grant narrowing, hierarchical reservation and parent-side acceptance exist as the executed D19-DELEGATE-01 demonstration; the scripted violation battery, the instruction-only ablation arm, and any live-model rate measurement do not.

19.8 Alternatives: how much to delegate, and how much to verify

Two design choices shape every delegating harness, and both have honest alternatives.

Who creates the sub-task? There are three options.

Design Scope is Strength Weakness
No delegation: one agent, one session — Simplest. No merge, no conservation, no chains Context grows (Chapter 7). No per-task capability narrowing
Host-orchestrated decomposition: host code defines sub-tasks (episode per state, Chapter 13) Host code Scope, tools and budget are fixed in advance and reviewable Rigid. Only decompositions the designer anticipated
Agent-initiated delegation: a model proposes sub-tasks at runtime Model-proposed, host-enforced Adapts to the task The proposal itself is untrusted input. Admission must enforce scope, budget and depth

The book’s position is to prefer the simplest design that the task’s structure requires, and to treat the move from host-orchestrated to agent-initiated delegation as a mechanism to be justified by measurement. Project 08 (Chapter 20) compares agent counts at matched budget. A natural extension compares host-orchestrated and agent-initiated decomposition on the same tasks.

How deeply should the parent verify a child’s deliverable? There are three levels, in increasing cost.

  1. Structural. Check the deliverable’s type and that its citations resolve to recorded evidence. This is cheap and deterministic, and it catches fabricated citations and evidence-free claims.
  2. Support. Also check that each cited excerpt supports its claim: deterministically where the claim is an exact fact (Chapter 3’s oracle), by precedence rules otherwise (Chapter 15). This is what rejected claim 3 in §19.6.
  3. Re-derivation. The parent redoes the child’s work, or a sample of it, independently. This is the most expensive. It can detect relevant evidence omitted by the child; a structural completeness check over a finite declared search scope can also detect omissions. Checking only supplied citations cannot establish completeness.

Level 3 at full scale can consume much of the saving from delegating. Sampled re-derivation, which re-checks a registered fraction of children’s work, is the usual compromise. Its sampling rate is a budget decision, and its detection rate is measurable on seeded omissions. The right level depends on what an undetected omission would cost. For a read-only investigation feeding a human decision, levels 1 and 2 may suffice. For a child whose findings will drive an effect, the parent should sample.

19.9 Failure modes

  • Prompt-described scope. The child “should only read”. Defence: construct the session with only read tools, and back it with worker rights.
  • Authority amplification. A child obtains grants its parent lacks. Defence: subset checking along the delegation chain.
  • Approval laundering. A parent approval reused for a child operation. Defence: approvals bind to operations and never transfer.
  • Reservation-free budgeting. The parent spends money that a running child may still use. Defence: reserve at delegation, release on reconciliation, and hold on unknown usage.
  • Belief accepted as outcome. “Done, tests passing.” Defence: a typed deliverable and a parent-side acceptance check over recorded evidence.
  • Unbounded depth. Children spawn children. Defence: conservation plus a maximum depth.

19.10 What you can build and test now

D19-DELEGATE-01 already implements the core loop: admission with tool, grant, depth and budget checks; scripted children; provenance-based acceptance that rejects the §19.6 claim-3 over-reading without any model judgment; and reservation conservation with unknown-usage holds. Extend it with the full §19.7 violation battery (grant-broader-than-parent, approval reuse, over-spend, over-depth, deadline ignorance, evidence-free claims, single-use races, late results, ancestor revocation, forged traces), the instruction-only ablation arm, and property tests of conservation under random concurrent spends.

19.11 What remains unverified

  • Formal scope-violation study (§19.7), including the ablation arm and any live-model violation-rate measurement.
  • Pi behaviour with many concurrent child sessions in one host process, including resource contention and cancellation interactions (TEST NOT RUN).
  • Whether any existing ecosystem component (Mission Control, Worker) already implements delegated execution with authority attenuation. This must be checked before building, so as not to duplicate it.
  • A broker that enforces grant narrowing outside the delegating process (Chapter 11 rungs 3–5); the demonstration enforces it in host code.

EXPERIMENT PENDING. The formal §19.7 study has not run; D19-DELEGATE-01 is an executed educational demonstration of admission and acceptance, not that study.

Capstone connection. The multi-agent coordination capstone requires the delegation contract, the hierarchical ledger and the §19.7 study to have passed. The reliable-execution capstone reuses the reservation and unknown-usage rules.

A parent with one bounded child integrates one deliverable. A parent with several children running in parallel gets several deliverables back, and they may overlap, contradict each other or edit the same lines. Chapter 20 turns to merging that work, and to deciding between findings that disagree.

Previous: Chapter 18: Reproducibility and Fair Comparisons.

Next: Chapter 20: Merging Parallel Work and Resolving Disagreement.