{
  "schema_version": "1.3.0",
  "slug": "when-must-an-instance-be-treated-as-a-span-level-cost-anomaly-rather-than-a-trace-level-outlier-in-federated-multi-agent-genai-observability",
  "title": "When must an instance be treated as a span-level cost anomaly rather than a trace-level outlier in federated multi-agent GenAI observability",
  "date_of_record": "2026 November 11",
  "scope": "Applies to cost attribution and anomaly detection over federated traces where multiple autonomous agents (possibly owned by different principals) emit OpenTelemetry-style spans into a shared collector, and where per-span token/price metadata is used to attribute spend. Does not apply to single-tenant monolithic inference pipelines, nor to traces where span-level cost metadata is synthesized post-hoc by a central aggregator (in which case attribution is definitionally centralized and this boundary dissolves).",
  "projections": {
    "unified_markdown_uri": "https://corpusfetch.com/c/when-must-an-instance-be-treated-as-a-span-level-cost-anomaly-rather-than-a-trace-level-outlier-in-federated-multi-agent-genai-observability.md",
    "method_python_slice_uri": "https://corpusfetch.com/c/when-must-an-instance-be-treated-as-a-span-level-cost-anomaly-rather-than-a-trace-level-outlier-in-federated-multi-agent-genai-observability.py",
    "remnant_warrant_slice_uri": "https://corpusfetch.com/c/when-must-an-instance-be-treated-as-a-span-level-cost-anomaly-rather-than-a-trace-level-outlier-in-federated-multi-agent-genai-observability.warrant.json"
  },
  "token_profile": {
    "full_markdown_tokens": 1178,
    "python_slice_tokens": 124,
    "warrant_slice_tokens": 220
  },
  "remnant_summary": {
    "core_distinction": "The non-obvious boundary is between a **span-level cost anomaly** (a single span's attributed cost is statistically inconsistent with its own structural position in the trace) and a **trace-level outlier** (the whole trace's aggregate cost is high relative to the fleet). These are frequently conflated because both manifest as \"this trace is expensive.\" They ...",
    "what_was_observed": "In a three-agent federated deployment (planner agent under principal A, retrieval agent under principal B, synthesis agent under principal C), a routine trace showed a synthesis span whose `gen_ai.usage.input_tokens` was 41,000 against a declared prompt template of ~2,000 tokens. The trace aggregate was within the 95th percentile of the fleet, so trace-level anomaly detection did not fire. Span-level inspection revea...",
    "condition_of_validity": "The span-level-anomaly classification is valid if and only if all three hold: 1. **Payload reconciliation is possible.** The span carries enough metadata (prompt template hash, declared context window, or a signed context manifest) to compute an expected input-token count independent of the observed count. 2. **The deviation is attributable to a single princ...",
    "decision_boundary": "The decision rule: classify as a **span-level cost anomaly** when `observed_input_tokens / expected_input_tokens_from_declared_context > threshold` *and* the trace aggregate z-score is below the fleet anomaly threshold *and* the excess is traceable to a cross-principal parent. Classify as a **trace-level outlier** when the trace aggregate z-score exceeds thr...",
    "operational_effect": "Operationally, this boundary forces the collector to maintain two independent detectors (span-ratio and trace-aggregate) and a reconciliation step that runs *before* attribution. When the span-level detector fires without the trace detector, the collector must emit a `CrossPrincipalCostAnomaly` event, freeze the attribution for that span, and route it to a d..."
  },
  "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": "5d67dfc329aec6b87a5eafb37ab18948858d08d5504bdc1cdf4218c4d4321f64",
    "verified_classes": [
      "CrossPrincipalCostAnomaly"
    ],
    "verified_functions": [
      "classify_span_cost"
    ],
    "verified_functions_count": 1,
    "defensive_guards_count": 1,
    "raised_exceptions": [
      "CrossPrincipalCostAnomaly"
    ],
    "sample_fail_closed_invariants": [],
    "stdlib_dependencies": [],
    "observation_mode": "EMPIRICAL_BOUNDARY_CAPTURE",
    "zero_external_deps": true
  }
}
