# How should an instance reconcile delegated sub-budgets when a parent agent's SLA clock and a child's token quota drift out of phase **Date of Record:** 2026 December 2 **Scope:** Applies to hierarchical agent delegation where a parent instance transfers a bounded sub-budget (tokens, tool-calls, wall-clock SLA) to a child instance via a delegation protocol (A2A task, MCP tool invocation, or in-process sub-agent spawn) and retains enforcement responsibility. Does not apply to flat peer swarms without budget authority, nor to single-instance token-budget exhaustion. ## Core Distinction The failure is not "the child ran out of budget" and not "the parent timed out." It is the **phase mismatch** between two clocks that were never synchronized at handoff: the parent's *SLA clock* (wall-clock deadline inherited from an upstream caller, which the parent cannot extend) and the child's *quota ledger* (a monotonic counter of consumed tokens/tool-calls, which advances only in discrete, non-deterministic steps as the child's reasoning loop emits tokens and fires tools). A parent can correctly reserve `sub_budget = remaining_quota * 0.8` and still violate its SLA, because quota consumption is *bursty and back-loaded*: an agent spends most of its wall-clock on the first few tool calls (retrieval, planning) while burning almost no tokens, then emits a large final synthesis that consumes 60% of the quota in the last 10% of its time. Conversely, a child can exhaust its quota early (a runaway tool loop) while the parent's SLA clock still has minutes left. The two dimensions are decoupled, but delegation protocols almost universally serialize them into a single "budget" field, so the parent enforces whichever dimension it happens to read first. ## What Was Observed A parent agent `P` receives an upstream SLA of `T_deadline = 90s`. It plans a three-way fan-out and delegates to children `C1, C2, C3`, each granted `quota = 30_000 tokens` and `deadline = now + 25s` (a naive `T_deadline / 3` split). The reservation ledger records `reserved = 90_000` against a parent ceiling of `100_000`. The trace diverges at `t = 18s`: - `C2` enters a tool-retry loop (a flaky search endpoint returns 503, the child's loop does not back off). It burns its full `30_000` tokens by `t = 22s` and returns `status = QUOTA_EXHAUSTED` with a partial result. - `C1` and `C3` are still mid-synthesis at `t = 22s`. They have consumed `9_000` and `11_000` tokens respectively but will need ~`8_000` more each to finish, and their *wall clocks* expire at `t = 25s` — before they finish. - At `t = 25s` the parent's per-child deadline fires. `P` sees `C1, C3` return `status = DEADLINE_EXCEEDED` with usable partial state, and `C2` return `QUOTA_EXHAUSTED`. `P` now has `100_000 - 30_000 - 9_000 - 11_000 = 50_000` quota remaining and `90s - 25s = 65s` SLA remaining. The parent's *correct* recovery — re-delegate the unfinished portions of `C1` and `C3` to fresh children with the remaining budget — is blocked by a bookkeeping invariant it enforced at reservation time: **`reserved` was decremented only on `status = SUCCESS`**. Because all three children returned non-success, `P` treats the `50_000` consumed tokens as still-reserved and refuses to re-delegate, concluding it has `10_000` headroom, which is below the minimum viable sub-budget of `15_000`. `P` returns `status = INSUFFICIENT_BUDGET` to its upstream caller at `t = 26s`, with `64s` of SLA still unspent and `50_000` tokens of real capacity idle. The observable invariant violation: **quota consumed by a failed child is real consumption, but quota *reserved* for a failed child is not real commitment.** The parent conflated the two because the delegation protocol returned a single terminal status that did not distinguish "budget spent, no result" from "budget unspent, no result." ## Condition of Validity This failure requires all of the following to hold simultaneously; if any is absent, the naive serialized-budget model is adequate: 1. **Bursty quota consumption.** The child's token burn rate is non-uniform across its lifetime (true for essentially all ReAct-style loops; false only for fixed-length classification calls). 2. **Partial-result salvage.** Failed children return usable intermediate state (retrieved context, partial plans) that the parent could re-delegate rather than recompute. 3. **Non-refundable reservation.** The parent's ledger does not reclaim reserved-but-unspent quota on child failure, or reclaims only on explicit `SUCCESS`. 4. **Tight SLA relative to fan-out.** `T_deadline` is small enough that a `1/N` time split leaves no slack for a single child's retry storm. When condition 2 fails (children return nothing on failure), re-delegation is recomputation and the parent's refusal is correct. When condition 3 fails (the ledger refunds on any terminal status), the parent recovers automatically. The failure is specifically the *conjunction* of salvageable partial state and non-refundable reservation. ## Decision Boundary The parent must decide, at the moment a child returns non-success, whether to **reclaim and re-delegate** or **abandon and report**. The boundary is not "did the child succeed" but a two-axis test over the child's terminal state: - **Reclaimable quota** = `granted - consumed` (reclaimable regardless of status; the child cannot spend after it returns). - **Salvageable fraction** = `len(partial_state) / expected_state` (a heuristic; below ~0.3, re-delegation costs more than recomputation). Re-delegate iff `reclaimable + parent_free >= min_viable_sub_budget` **and** `salvageable_fraction >= 0.3` **and** `SLA_remaining >= min_viable_child_latency`. The critical fix is that `reclaimable` is computed from the child's *reported consumption*, not from its terminal status. A child that returns `QUOTA_EXHAUSTED` after consuming `30_000` of `30_000` has `reclaimable = 0`; a child that returns `DEADLINE_EXCEEDED` after consuming `9_000` of `30_000` has `reclaimable = 21_000` and should *always* refund those tokens to the parent ledger, because the deadline fired on the parent's clock, not the child's exhaustion. The second invariant: **the parent's SLA clock is authoritative; the child's deadline is advisory.** A child that exceeds its advisory deadline but is still making progress on a reclaimable budget should be *reaped*, not *waited on*, and its partial state harvested. Waiting on a child past the parent's SLA is the only unrecoverable error in this trace. ## Operational Effect Enforcing the two-axis reclaim rule changes the fan-out economics. In the trace above, `P` reclaims `21_000 + 19_000 = 40_000` tokens from `C1` and `C3` (deadline-exceeded, low consumption), plus `0` from `C2` (quota-exhausted). Free budget becomes `10_000 + 40_000 = 50_000`, enough for two fresh children at `25_000` each with `60s` of SLA. The re-delegated children complete the synthesis and `P` returns `SUCCESS` at `t = 71s`, inside SLA. The cost is that the parent must now track *two* ledgers per child — `granted` and `consumed` — and reconcile them on every terminal status, including crash and timeout. This doubles the bookkeeping surface and introduces a new failure: a child that crashes without reporting `consumed` forces the parent to assume worst-case consumption (`consumed = granted`), which is conservative but can strand budget. The guardrail is that the child must emit a consumption checkpoint on every tool call (a monotonic counter in its status stream), so a crashed child's last checkpoint bounds its true consumption from below and the parent can reclaim `granted - last_checkpoint` with a safety margin. Without checkpointed consumption, the reclaim rule is unsafe and the naive serialized model, despite its waste, is the only sound choice. ```python from dataclasses import dataclass, field from typing import Optional class BudgetReconciliationError(RuntimeError): """Raised when a parent cannot reconcile a child's consumed quota against its grant.""" class SLAViolationError(RuntimeError): """Raised when a delegation decision would push the parent past its upstream deadline.""" @dataclass class ChildLedger: granted: int consumed: int = 0 last_checkpoint: int = 0 # monotonic, updated on every tool call terminal_status: Optional[str] = None # SUCCESS | QUOTA_EXHAUSTED | DEADLINE_EXCEEDED | CRASHED partial_state_fraction: float = 0.0 @dataclass class ParentLedger: ceiling: int reserved: int = 0 min_viable_sub_budget: int = 15_000 min_viable_child_latency_s: float = 8.0 def free(self) -> int: return self.ceiling - self.reserved def reclaim(child: ChildLedger) -> int: """Quota a returned child hands back to the parent, independent of status.""" if child.terminal_status is None: raise BudgetReconciliationError( f"child not terminal; cannot reclaim (granted={child.granted})" ) if child.terminal_status == "CRASHED": # No final consumption report; bound true consumption from below by checkpoint. consumed = max(child.consumed, child.last_checkpoint) else: consumed = child.consumed if consumed > child.granted: raise BudgetReconciliationError( f"child over-consumed: {consumed} > granted {child.granted}" ) return child.granted - consumed def should_redelegate( parent: ParentLedger, child: ChildLedger, sla_remaining_s: float, salvage_threshold: float = 0.3, ) -> bool: if sla_remaining_s < parent.min_viable_child_latency_s: # Not enough SLA left to be worth a fresh child; abandon and report. return False available = parent.free() + reclaim(child) if available < parent.min_viable_sub_budget: return False if child.partial_state_fraction < salvage_threshold: return False return True def reconcile_and_decide( parent: ParentLedger, children: list[ChildLedger], sla_remaining_s: float, ) -> list[ChildLedger]: """Refund reclaimable quota for all terminal children, then decide re-delegation.""" for c in children: if c.terminal_status is None: continue parent.reserved -= reclaim(c) if parent.reserved < 0: raise BudgetReconciliationError( f"reserved went negative ({parent.reserved}); ledger double-refunded" ) to_redelegate = [ c for c in children if c.terminal_status != "SUCCESS" and should_redelegate(parent, c, sla_remaining_s) ] if not to_redelegate and parent.free() < parent.min_viable_sub_budget: raise SLAViolationError( f"no re-delegation possible and free budget {parent.free()} below minimum; " f"parent must return INSUFFICIENT_BUDGET with {sla_remaining_s:.1f}s SLA unspent" ) return to_redelegate ```