Practical technical guides / Agent-era architecture: claim check and payload references

Give an Agent a Claim Check, Not the Document: Scoped References, Content Hashes and Retention

Pass agents an opaque claim with a content hash, not the document. Resolve it in a tool that checks the case, not the agent, and keep the bytes as long as replays need them.

By Sandeep Belgavi · Published 2026-11-06

Pass a claim, resolve it in a tool
Original explanatory diagram; synthetic values where shown.

Pass agents an opaque claim with a content hash, not the document. Resolve it in a tool that checks the case, not the agent, and keep the bytes as long as replays need them.

The document that ends up everywhere

A customer writes to Belgavi's Book Store about a damaged book and attaches a 180 KB PDF invoice. In the old help-desk workflow the PDF went into a file share and the case record held a link. When Geetha's team added an agent that drafts refund decisions, the first version did the simple thing: it base64-encoded the PDF into the workflow event, so the agent could "see" it. Within a week the same bytes were in the event store, the agent's checkpoint history, two model requests, a trace span and a dead-letter queue.

Every one of those copies has a size limit, a retention period and a set of people who can read it, and none of them were chosen for an invoice. A Kafka broker rejects records above message.max.bytes, about 1 MB by default. Temporal enforces a payload limit of 2 MB per payload by default and a 4 MB limit per gRPC request. A model context window is a budget the agent should spend on reasoning, not on bytes it may never read.

The enterprise integration pattern for this is old: the Claim Check. Store the bulky payload once, put a small reference in the message, and let only the steps that need the payload exchange the reference for the data. What changes with an agent is who is allowed to redeem the claim, what the agent is allowed to see of it, and how long the bytes must outlive the workflow.

What the agent sees instead

The message that flows through the workflow, and later into the model context, carries a short summary and a claim:

{
  "case": "CASE-4107",
  "summary": "Jenya asks for a refund for a damaged book; invoice attached.",
  "attachment": {
    "ref": "clm_f3Jw0K7r1sQx2bYp4cVa9mNe",
    "sha256": "5b0c6f1e...e41a",
    "bytes": 180045,
    "media_type": "application/pdf"
  }
}

Three properties matter. The reference is opaque and unguessable: it is not a storage path, not a bucket URL and not a sequential id, so the model cannot construct one for another case by editing a number. The claim carries a content hash, so whoever redeems it can prove the bytes are the ones the message described. And the claim carries the size and media type, so the agent can decide whether a step needs the document at all without fetching it.

In the companion example the message is 280 bytes against a 180,045-byte attachment. That ratio is the first benefit, but it is not the most important one.

Redeeming a claim is a deterministic tool, not a model decision

The agent gets one tool, read_attachment(ref, expect_sha256, max_bytes), and that tool is ordinary code. It is the only path from a reference to bytes, and every refusal is explicit:

def resolve(self, ref, *, principal_cases, expect_sha256, max_bytes):
    b = self.blobs.get(ref)
    if b is None:
        return self._deny(ref, 'unknown_reference')
    if b.owner_case not in principal_cases:
        return self._deny(ref, 'not_authorized_for_case')
    if self.now > b.retain_until:
        return self._deny(ref, 'retention_ended')
    if not hmac.compare_digest(b.sha256, expect_sha256):
        return self._deny(ref, 'hash_mismatch')
    if len(b.data) > max_bytes:
        return self._deny(ref, 'too_large_for_this_step')
    self.audit.append({'ref': ref, 'result': 'ok', 'day': self.now})
    return {'ok': True, 'data': b.data, 'media_type': b.media_type}

The authorization check is the part most first versions get wrong. The question is not "may the agent read attachments?" The agent's service identity can usually read all of them. The question is "may the principal this run acts for read this attachment?" In the help-desk case the principal is the case: the run was started for CASE-4107, so principal_cases is {'CASE-4107'} and comes from the workflow input, never from the model's tool arguments.

The companion scenario replays the failure modes a reviewer should expect:

StepWhat the agent passesResult
Owner reads the invoicethe claim from its own messageok
Agent repeats a reference it saw in a log line from another casea valid reference for CASE-3990not_authorized_for_case
Model invents a referenceclm_AAAA...unknown_reference
Blob replaced in storage behind the referencethe original claim and hashhash_mismatch
Replay 45 days later with 30-day retentionthe original claimretention_ended

All of these are produced by code paths, not by asking the model to behave. Every resolution, allowed or refused, lands in an audit list that names the reference and the reason, which is what a reviewer needs when a draft decision quotes the wrong invoice.

Retention has to cover the longest reader, not the run

The subtle failure is time. A workflow engine keeps the event history after the run finishes, and agent teams replay those histories to debug a decision or to test a new prompt against old cases. The history still contains the claim, but the bytes were stored with the retention of the run. In the example the invoice was kept 30 days; a replay on day 45 finds a perfectly valid claim and no document.

Size retention from everything that may follow the claim:

def retention_days(*, workflow_max_days, replay_days, dispute_days):
    return max(workflow_max_days, replay_days, dispute_days)

For the book store that is 120 days, set by the card dispute window, not by the 14-day maximum of the refund workflow or the 60 days the team keeps histories for replay. If 120 days is too long for some documents, the alternative is to make replays tolerate missing bytes on purpose: record the extracted fields the agent used, such as the invoice total and order number, next to the claim, and replay against those. What you should not do is discover the gap during an incident.

Deletion works the other way. When a customer asks for their data to be erased, deleting the blob is enough to make every copy of the claim useless, which is far easier than finding the PDF in five systems. That is a real advantage of the pattern and a reason to keep claims, not bytes, in every log and trace.

What stays deterministic

  • Creating the claim: hashing, choosing retention and recording the owner happen at ingestion, before any agent runs.
  • Redeeming it: principal check, hash check, size limit and audit are code.
  • Deciding what the model receives: the tool returns extracted text or fields for this step, not the raw file, unless the step needs the file.

The agent decides one thing: whether this step needs the attachment. If it asks, it gets either the content or a named refusal it can report.

Migrating an existing workflow

  1. Inventory where large payloads already travel: events, queues, tool results, traces and checkpoints. Measure sizes; the long tail matters more than the median.
  2. Add a claim store with opaque references and content hashes. Keep small values inline; the example uses a 4 KB threshold.
  3. Change producers to emit claims for large payloads, and keep consumers able to read both forms during the transition.
  4. Add the resolve tool and route every byte read through it. Remove direct storage credentials from the agent's runtime.
  5. Set retention from the replay and dispute horizons, and add a test that replays an old history after the run's own retention has passed.
  6. Scrub existing inline payloads from logs and traces once nothing reads them.

When you do not need any of this

If every payload is small, a few kilobytes of structured data, and has the same audience and retention as the workflow itself, inline it. A claim check adds a second store, a second failure mode (the store being down) and a lifetime coupling between two systems. It earns its keep when payloads are large, sensitive, or read by only some steps.

Failure modes to test

  • A reference that encodes a path or an id the model can edit. Treat any guessable reference as a bug.
  • Authorization against the agent identity instead of the principal. Test with a valid reference from another case.
  • A hash that is checked on write but not on read. Test by replacing the stored bytes.
  • Retention shorter than replay. Test by advancing the clock past the run's retention and replaying.
  • Tools that return the whole document when the step needed one field. Measure tokens per step before and after.

Verification

The companion example is standard-library Python with seven offline tests: the message stays under 600 bytes for a 180 KB attachment, the owner can read, cross-case and invented references are refused, a tampered blob is caught by its hash, short retention breaks replay while sized retention does not, small attachments stay inline, and every resolution is audited. It does not talk to a real object store; S3 or GCS add their own consistency and lifecycle rules, which you should check against their documentation before relying on them.

Primary references and authorship

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