Where must an instance re-derive federation egress policy at tool-call time, and why cached residency verdicts silently expire

**Date of Record:** 2026 December 2 **Scope:** Applies to LLM agents operating under a cross-organization federation where a policy engine (residency + per-tool egress allowlist) authorizes tool calls on behalf of a calling tenant. Does not cover single-org deployments where the policy engine and the tool executor share one trust boundary, nor offline batch inference with no egress.

Core Distinction

The distinction that matters is between **policy evaluation** and **policy verdict caching**. A federation policy engine returns a verdict ("tool `vector_search` may egress tenant `acme` data to region `eu-west`") that is a function of *at least four* independently mutable inputs: the calling tenant's residency class, the tool's declared egress class, the inter-org federation treaty version in force, and the data classification of the specific payload. Agents almost universally cache the verdict keyed on `(tenant, tool)` and treat it as a stable capability token for the remainder of a session. It is not stable. The verdict is a *snapshot of a four-dimensional state vector*, and three of those dimensions can change without the agent's session ending — treaty renegotiation, tool re-registration with a widened egress class, or payload reclassification after a distillation step. The non-obvious failure is that the cached verdict remains *internally consistent* and *cryptographically valid* (the signature still verifies) while being *semantically stale*. The agent has no local signal that it must re-derive.

What Was Observed

A two-org federation: Tenant `acme` (residency class `EU`) calls an agent hosted by Org `beta`. The agent's tool registry includes `export_report`, registered by `beta` with declared egress class `internal-only`. At session start the policy engine evaluates and returns `ALLOW` with a signed verdict object carrying `treaty_version: 7`, `tool_egress_class: internal-only`, `residency: EU`, and `ttl: 3600s`. The agent caches this.

At T+1400s, Org `beta`'s platform team re-registers `export_report` with `egress_class: cross-border-ok` (a routine config push; the tool now writes to a US-hosted object store). This bumps the tool's registration epoch but does **not** invalidate outstanding verdicts — the policy engine treats verdicts as leases, not as subscriptions. At T+1500s the agent, mid-task, calls `export_report` with a payload containing `acme` customer records. The cached verdict still verifies against `beta`'s signing key. The tool executes and writes EU-resident data to `us-east-1`.

The trace shows no error at any layer. The signature check passed. The TTL had not expired. The agent's reasoning loop logged `tool_authorized: true` and proceeded. The violation was only caught 40 minutes later by `acme`'s out-of-band egress audit, which compares actual destination regions against the residency class — a check the agent never performed because it trusted the verdict as a *capability* rather than as a *lease over a state vector*.

The deeper mechanic: the verdict's validity predicate is `signature_ok AND ttl_not_expired AND all_four_inputs_unchanged`. The agent checked the first two. The third clause is unobservable from inside the agent's context — it requires either (a) subscribing to a policy-invalidation feed, or (b) re-deriving the verdict at every egress point by re-reading the four inputs. Most federation protocols specify (a) but most agent runtimes implement only the signature+TTL subset because it is the only part expressible as a local check.

Condition of Validity

A cached egress verdict is valid at tool-call time **iff** all of the following hold, and the agent must be able to *evaluate* each at the call site, not merely assume it:

  1. `treaty_version` in the verdict equals the treaty version currently in force between caller-org and host-org. Treaties renegotiate on human timescales (days), so this is checkable via a cheap version-ping, not a full re-evaluation.
  2. `tool_egress_class` in the verdict equals the tool's *current* registration epoch. Tool re-registration is the silent killer because it happens on config-push timescales (minutes) and is invisible to the caller.
  3. `residency` in the verdict equals the calling tenant's current residency class. Tenants get re-homed; this is rare but catastrophic when missed.
  4. The *payload's* data classification is not stricter than the classification the verdict was evaluated against. This is the clause agents violate most often, because the payload classification is determined by the agent's own prior steps — a distillation or summarization step can *promote* classification (PII surfaced from a redacted field), and the verdict was never evaluated for the promoted class.

Condition 4 is the one that cannot be delegated to a feed. It must be checked locally at the call site because only the agent knows what it just put in the payload.

Decision Boundary

The boundary is: **re-derive, don't re-check, whenever the payload classification or the tool registration epoch could have changed since the verdict was minted.** Concretely:

The guardrail invariant: **a verdict is a lease over `(treaty, epoch, residency, payload_class)`, and the agent must hold evidence of all four at the moment of egress, not at the moment of mint.**

Operational Effect

The architectural consequence is that the agent runtime needs a **pre-egress policy barrier** — a mandatory synchronous step between "I have decided to call tool T with payload P" and "the bytes leave." That barrier does three cheap things: (1) computes the payload's current classification from the agent's own provenance chain, (2) pings the tool registry for the current epoch, (3) compares both against the cached verdict's mint-time values, and re-derives on any mismatch. This barrier is not a security control in the traditional sense (it does not authenticate); it is a *staleness detector* for a semantic lease. Without it, the federation's signature and TTL machinery provides the illusion of enforcement while the state vector drifts underneath it. The failure is silent precisely because every local check the agent *can* perform passes.

The cost is one registry ping per egress, which is why most deployments skip it and then discover the gap via audit. The correct framing for an agent: the verdict you hold is a photograph of a moving object; the object moves on config-push and transformation timescales, both faster than your TTL. Re-derive at the barrier.

from dataclasses import dataclass
from typing import Optional


class StaleEgressVerdict(RuntimeError):
    """Raised when a cached federation egress verdict no longer describes
    the state vector it was minted against."""
    pass


@dataclass(frozen=True)
class EgressVerdict:
    tenant: str
    tool: str
    treaty_version: int
    tool_epoch: int
    residency: str
    payload_class: str
    ttl_remaining_s: int


def pre_egress_barrier(
    verdict: EgressVerdict,
    *,
    current_treaty_version: int,
    current_tool_epoch: int,
    current_residency: str,
    payload_class_now: str,
    payload_transformed_since_mint: bool,
) -> None:
    # TTL and signature are necessary but NOT sufficient.
    if verdict.ttl_remaining_s <= 0:
        raise StaleEgressVerdict(
            f"verdict for {verdict.tool} expired (ttl={verdict.ttl_remaining_s})"
        )

    # Clause 1: treaty renegotiation invalidates the lease.
    if current_treaty_version != verdict.treaty_version:
        raise StaleEgressVerdict(
            f"treaty drift: verdict={verdict.treaty_version} "
            f"current={current_treaty_version}"
        )

    # Clause 2: tool re-registration (epoch bump) invalidates the lease,
    # even when the new egress class is WIDER than the old one.
    if current_tool_epoch != verdict.tool_epoch:
        raise StaleEgressVerdict(
            f"tool epoch drift for {verdict.tool}: "
            f"verdict={verdict.tool_epoch} current={current_tool_epoch}"
        )

    # Clause 3: tenant re-homing invalidates the lease.
    if current_residency != verdict.residency:
        raise StaleEgressVerdict(
            f"residency drift for {verdict.tenant}: "
            f"verdict={verdict.residency} current={current_residency}"
        )

    # Clause 4: the clause agents most often miss. A transformation since
    # mint can PROMOTE payload classification; the verdict was never
    # evaluated for the promoted class.
    if payload_transformed_since_mint and payload_class_now != verdict.payload_class:
        raise StaleEgressVerdict(
            f"payload class promoted since mint for {verdict.tool}: "
            f"verdict={verdict.payload_class} current={payload_class_now}; "
            f"re-derive verdict before egress"
        )


def guarded_egress(
    verdict: EgressVerdict,
    *,
    current_treaty_version: int,
    current_tool_epoch: int,
    current_residency: str,
    payload_class_now: str,
    payload_transformed_since_mint: bool,
    rederive,
):
    try:
        pre_egress_barrier(
            verdict,
            current_treaty_version=current_treaty_version,
            current_tool_epoch=current_tool_epoch,
            current_residency=current_residency,
            payload_class_now=payload_class_now,
            payload_transformed_since_mint=payload_transformed_since_mint,
        )
    except StaleEgressVerdict:
        # Barrier failed: re-derive against the live state vector, do not
        # fall back to the stale verdict under any circumstance.
        fresh: Optional[EgressVerdict] = rederive(
            verdict.tenant, verdict.tool, payload_class_now
        )
        if fresh is None:
            raise StaleEgressVerdict(
                f"re-derivation refused for {verdict.tool}; egress blocked"
            )
        return fresh
    return verdict