Practical technical guides / Agent-era architecture: human approvals and guards (gate evidence)

A Write Gate Is Only as Good as the Evidence It Reads: Build the Digest From the System of Record and Test It

A gate that reads a truncated digest rejects valid refunds or writes forbidden ones. Build evidence from the system of record, make missing fields explicit, and test the gate.

By Sandeep Belgavi · Published 2026-11-14

A write gate decides only from its evidence
Original explanatory diagram; synthetic values where shown.

A gate that reads a truncated digest rejects valid refunds or writes forbidden ones. Build evidence from the system of record, make missing fields explicit, and test the gate.

A gate that rejected the right refunds

Geetha's refund agent at Belgavi's Book Store does not write refunds directly. Each proposed refund passes a gate first: a verifier that reads the evidence for the case and either lets the write through, rejects it, or sends it to a person. Gates like this are the standard way to add an agent to a system that already writes money or stock, and they are usually judged by one question: did the gate stop the bad writes?

A study posted on 10 November 2026 shows why that question is incomplete. Sungbin Im ran 2,160 episodes in two customer-service domains of the tau2-bench benchmark, recorded every database write, and tested three gates: verification before a write, correction after a rejected write, and safe termination that hands the episode to a person (arXiv 2611.14581v1, "When Evaluators of AI Agents Disagree"). Without gates, premature commitments, meaning writes the policy did not allow, occurred in 11.1 percent of episodes, with the rate varying more than 20-fold between the two domains. Adding the gates produced no significant reduction after correction for multiple comparisons.

The trace analysis found a reason that had nothing to do with the model. The verifier did not read the conversation; it read a digest. The digest covered the most recent 20 messages, kept the first 800 characters of each, and shrank to 8 messages when it exceeded 6,000 characters. In the domain where the gate misfired, tool results averaged 976 characters and 59.4 percent exceeded 800. In one traced episode the verifier rejected a legitimate return three times, twice because "the customer's identity is not authenticated": the authentication step happened early in the conversation and had fallen out of the window. After the third rejection the agent gave up without writing, and the episode was recorded as completed. The paper's conclusion is direct: gates are software whose quality must be measured separately.

The digest is the real interface of the gate

Whatever the gate's logic, it can only decide from what it receives. A digest built by truncating a transcript has three properties that make it a poor input:

  • Fields disappear by position, not by importance. Authentication happens early and falls out of a recent-messages window first.
  • Missing looks like false. A verifier asked "is the customer authenticated?" that sees no evidence answers no.
  • The loss is silent. Nothing in the digest says what was cut, so neither the gate nor its logs can tell a negative from an absence.

The fix is an architectural one: build the gate's evidence from the system of record, field by field, and make absence explicit.

Build the evidence, do not summarize the transcript

For a refund, the policy needs four facts: whether the customer is verified, the order status, the days since delivery, and whether the order was already refunded. Each has an owner system. The gate's evidence builder queries those systems directly with the case's identifiers and returns a typed record where every field is either a value or an explicit missing marker:

@dataclass(frozen=True)
class RefundEvidence:
    case: str
    verified: bool | None        # None means the identity service did not answer
    status: str | None           # 'delivered', 'shipped', 'cancelled' or None
    days_since_delivery: int | None
    prior_refund: bool | None
    amount: int

REQUIRED = ('verified', 'status', 'days_since_delivery', 'prior_refund')

def gate(ev: RefundEvidence, missing_policy: str) -> tuple[str, str]:
    missing = [f for f in REQUIRED if getattr(ev, f) is None]
    if ev.verified is False: return 'reject', 'customer not verified'
    if ev.status not in (None, 'delivered'): return 'reject', 'order ' + ev.status
    if ev.days_since_delivery is not None and ev.days_since_delivery > 30: return 'reject', 'outside window'
    if ev.prior_refund: return 'reject', 'already refunded'
    if missing and missing_policy in ('reject', 'escalate'):
        return missing_policy, 'missing ' + ', '.join(missing)
    if ev.amount > 2000: return 'escalate', 'above the person limit'   # applies even when checks were skipped
    if missing:
        return 'allow', 'checks skipped for ' + ', '.join(missing)
    return 'allow', 'all checks passed'

The agent's conversation is still useful, but as a pointer to the case, not as evidence. If the agent says the customer verified their identity, the evidence builder checks the identity service for that case; the agent's statement is never the value.

Choosing what the gate does when evidence is missing

With absence made explicit, the gate needs a missing-evidence policy, and each choice moves cost to a different place. The companion model runs 400 synthetic refund requests through the gate with the status field removed from the digest, an agent that proposes a refund for 97 percent of eligible requests and for 20 percent of ineligible ones, and the three policies:

Missing-evidence policyRefunds writtenValid requests rejectedForbidden refunds writtenSent to a person
Full digest (reference)1430033
Status missing, reject014300
Status missing, escalate000185
Status missing, allow1520933

Rejecting turns a digest defect into an outage that looks like caution: every valid refund is refused, which is the failure the study traced. Escalating is safe but moves 143 routine refunds onto people. Allowing keeps the queue moving and writes nine refunds for orders that were shipped or cancelled. None of these is acceptable as a steady state; each is a choice for the period until the evidence builder is fixed, and the right one depends on whether a wrong write or a stalled customer costs more for that action.

When fields go missing at random rather than all the time, the trade-off is the same at a smaller scale. With a 15 percent chance that any included field is missing, the reject policy refused 67 of 147 valid requests, and the allow policy wrote two forbidden refunds.

Test the gate like any other component

Because the gate is a function of its evidence, it can be tested without an agent:

  1. Field ablation. For each required field, run a fixed set of cases with that field removed and assert the gate's behaviour matches the chosen missing-evidence policy. This catches a builder that silently drops a field.
  2. Known answers. Run cases whose correct outcome a person has checked, including every boundary: day 30 and day 31, amount 2,000 and 2,001, a shipped order, a prior refund.
  3. Evidence coverage in production. Log, per decision, which fields were present. A rising missing rate for one field is a builder defect long before anyone notices the rejections.
  4. A commit-boundary check after the fact. The same study's boundary evaluator compared whether a write was expected with whether one occurred, with no model call, and caught all 11 human-confirmed forbidden writes. Do the equivalent nightly: compare the refunds actually written in the ledger with the cases the policy allows. In the companion's allow-policy run it finds all nine forbidden refunds; it cannot prevent them, but it bounds how long they go unnoticed.

What stays deterministic

  • The evidence builder: queries to owner systems by case identifier, typed fields, explicit missing markers.
  • The gate's rules and its missing-evidence policy, versioned and tested.
  • The commit-boundary reconciliation between the ledger and the policy.
  • The agent proposes and explains; it never supplies a field value the gate trusts.

Migrating a transcript-reading gate

  1. List the facts the policy needs and the system that owns each. If a fact has no owner system, that is the first gap to close.
  2. Build the evidence record next to the existing digest and log both for a few weeks. Count the decisions where they disagree; those are the digest's casualties.
  3. Switch the gate to the evidence record, with escalate as the missing-evidence policy while you watch the missing rates.
  4. Add the field-ablation and known-answer tests to CI, and the nightly reconciliation to operations.
  5. Decide per action whether missing evidence should reject or escalate once the missing rate is low and understood.

When an agent is unnecessary

If the refund request arrives as a structured form with an order number, the evidence builder and the gate are the whole decision; an agent adds nothing but a chance to misread. The agent earns its place when requests arrive as free text that must be matched to an order and a reason, and then only as the step that finds the case, not the step that decides it.

Failure modes

  • A cached evidence record that outlives a status change: read at decision time, or carry a version and recheck before the write.
  • A builder that maps a timeout to false instead of missing.
  • A missing-evidence policy chosen once and never revisited as rates change.
  • Reconciliation that runs on the same flawed digest as the gate; it must read the ledger and owner systems directly.

Limits

The companion is a toy with four fields and random drops; the study's numbers come from tau2-bench with its own policies, models and gate prompts, and its gate results are for those gates as implemented. Neither says how often digests drop fields in your system. Measure that first.

Interactive experiment

Write gate evidence: dropped fields, missing-evidence policy and a commit check. Synthetic browser-local fixtures, adjustable inputs, decision traces and JSON export.

Primary references and authorship

Original explanation and synthetic examples by Sandeep Belgavi. Companion code: Sandeep-BA/agent-decision-lab/examples/python/write_gate_evidence_digest. Views are my own and do not represent any employer, past or present.