Loading page...Загружаем страницу...正在加载页面...
AtlasRepo

Build Your Own Receipt Gateway in 28 Lines of Python

Description and use

Build a 28‑line Python receipt gateway that generates cryptographic proofs of tool execution, ensuring execution integrity.

Problem

Agents can claim tool execution without verifiable proof, making it hard to trust their outputs.

Outcome

A lightweight, 28‑line Python implementation that mints verifiable receipts for every tool call, ensuring execution integrity without external services.

Workflow

  • 1. Wrap the tool dispatch in execute_with_receipt, passing tool name, arguments, and the tool function.
  • 2. The executor runs the tool and obtains the result.
  • 3. Immediately after execution, generate a receipt containing a UUID, tool name, SHA‑256 hashes of canonicalized arguments and result, and a timestamp.
  • 4. Store the receipt and result in an append‑only log (RECEIPT_LOG).
  • 5. Return the result and receipt ID to the agent.
  • 6. To verify, fetch the receipt by UUID and compare the SHA‑256 hash of the claimed result with the stored hash using verify_receipt.

Evidence

The receipt has to be minted by the thing that runs the tool, not the thing that talks about running the tool.

Source

Wrap your tool dispatch in execute_with_receipt, and every call your agent makes now carries independently checkable proof.

Source

  • Record date: 2026-09-22T00:00:37.033Z