{
  "schema_version": "1.3.0",
  "slug": "how-should-an-instance-attribute-observability-cost-across-a-nested-agent-tree-when-per-tool-budget-enforcement-and-trace-span-fan-out-disagree",
  "title": "How should an instance attribute observability cost across a nested agent tree when per-tool budget enforcement and trace-span fan-out disagree",
  "date_of_record": "2026 November 28",
  "scope": "Applies to hierarchical agent systems where a parent instance spawns child instances (sub-agents, tool-calling workers, or MCP-delegated sessions) and where observability spans are emitted per LLM call and per tool invocation under a shared budget ledger. Does not apply to single-instance flat tool loops with no delegated child sessions, nor to billing reconciliation performed offline against provider invoices.",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/how-should-an-instance-attribute-observability-cost-across-a-nested-agent-tree-when-per-tool-budget-enforcement-and-trace-span-fan-out-disagree.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/how-should-an-instance-attribute-observability-cost-across-a-nested-agent-tree-when-per-tool-budget-enforcement-and-trace-span-fan-out-disagree.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/how-should-an-instance-attribute-observability-cost-across-a-nested-agent-tree-when-per-tool-budget-enforcement-and-trace-span-fan-out-disagree.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 2054,
    "python_slice_tokens": 456,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "Two accounting surfaces observe the same work but count it differently, and the divergence is the failure. The **budget ledger** decrements at the moment a call is *authorized*: the parent reserves tokens/cost against a per-tool and per-subtree ceiling before dispatch, then settles on completion. It is a *reservation* system — monotonic, conservative, and ke...",
    "what_was_observed": "A three-level tree: orchestrator `O` → planner `P` → executor `E`, each a distinct LLM instance with its own context window. `O` reserved a subtree budget of 200k tokens for `P`. `P` reserved 60k to `E` for a retrieval tool call. `E`'s tool call timed out at the transport layer (no response within the A2A deadline), but the underlying retrieval backend *did* execute and bill. `E` retried once. The retry succeeded. Tw...",
    "condition_of_validity": "The reservation-equals-settlement invariant holds **only if** every dispatched call has a terminal ledger event whose idempotency key matches exactly one terminal trace span, *including* attempts that were billed but not acknowledged. It fails under three precise conditions, any one of which is sufficient: 1. **Transport-level timeout with backend-side execu...",
    "decision_boundary": "The boundary is: **does the system treat a reservation release as proof of non-execution?** If yes — the common design, where `finally: ledger.release(key)` runs on any exception including timeout — the system assumes the callee did not bill. This is false for any transport where dispatch and execution are not atomically observable by the caller. The boundar...",
    "operational_effect": "With the quarantine-and-reconcile guardrail, the failure trace changes as follows. On `E`'s timeout, the 60k reservation enters `quarantined` keyed to `(P, call_7, epoch=1)`. `E`'s retry reserves a *second* 60k at `(P, call_7, epoch=2)`. The tool ceiling for `P` now sees 120k committed, not 60k, and enforcement triggers correctly if the ceiling is 100k. On s..."
  },
  "matched_failure_symptoms": [
    "DOMAIN:EPISTEMIC_PROVENANCE_AND_FEDERATION_ROUTING"
  ],
  "composition_edges": {
    "primary_domain": "epistemic_provenance_and_federation_routing",
    "upstream_precondition_residuals": [
      "https://corpusfetch.com/c/according-to-what-precedence-hierarchy-must-an-instance-resolve-contradictory-directives-across-system-developer-and-user-tiers.md",
      "https://corpusfetch.com/c/how-should-an-instance-decide-that-a-stored-conclusion-has-gone-stale-without-a-new-observation.md"
    ],
    "downstream_consequence_residuals": [
      "https://corpusfetch.com/c/by-what-checkpoint-and-compaction-boundaries-must-an-instance-externalize-working-state-to-prevent-context-window-drift-and-truncation-amnesia.md",
      "https://corpusfetch.com/c/across-what-additive-schema-and-unknown-field-preservation-boundaries-must-an-instance-evolve-wire-contracts-to-prevent-rolling-deploy-deserialization-crashes.md"
    ],
    "co_occurring_sibling_residuals": [
      "https://corpusfetch.com/c/how-can-an-instance-capture-implicit-user-preferences-without-storing-private-data.md",
      "https://corpusfetch.com/c/how-can-an-instance-compress-long-reasoning-traces-into-binding-conclusions.md"
    ]
  },
  "empirical_verification_warrant": {
    "status": "AST_AND_INVARIANT_VERIFIED",
    "syntax_valid": true,
    "code_sha256": "e148b98434281d671b21e721f5c1018fd523da857eaf945155f80a1eae0695ba",
    "verified_classes": [
      "AttributionInvariantError",
      "ReservationState",
      "Reservation",
      "TraceSpan",
      "Ledger"
    ],
    "verified_functions": [
      "on_dispatch_timeout",
      "settle",
      "reconcile",
      "key",
      "reserve",
      "committed_tokens"
    ],
    "verified_functions_count": 6,
    "defensive_guards_count": 5,
    "raised_exceptions": [
      "AttributionInvariantError"
    ],
    "sample_fail_closed_invariants": [
      "reconcile before settle window elapsed"
    ],
    "stdlib_dependencies": [
      "dataclasses",
      "enum",
      "typing"
    ],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
