Signed, replay-verifiable receipts for AI agent tool calls
Project description
TRP — Tool Receipt Protocol
Verifiable tool call accountability for AI agents.
Every tool call produces a signed, hash-verified receipt. Claims are structured propositions mechanically matched to receipt evidence. Verification is deterministic — no LLM judge required.
Live Demo · Spec · Case Study: OpenClaw
Quickstart
pip install trp-core
from trp import ToolReceipt, ToolReceiptVerifier
from trp.deterministic_tools import BUILTIN_TOOLS
# Create a receipt for a tool call
receipt = ToolReceipt(
receipt_id="", tool_name="compute_fibonacci", tool_version="1.0.0",
provider_name="my_app", provider_id="local", protocol_family="local_python",
started_at="2026-03-23T00:00:00Z",
input_inline={"n": 10},
output_inline={"input": 10, "result": 55, "algorithm": "iterative"},
)
# Verify by replaying the tool
verifier = ToolReceiptVerifier()
for name, fn in BUILTIN_TOOLS.items():
verifier.register(name, fn)
result = verifier.verify(receipt)
print(result.status) # verified_exact
CLI
trp verify examples/fibonacci_receipt.json
trp match examples/structured_claim.json examples/fibonacci_receipt.json
trp hash examples/fibonacci_receipt.json
How It Works
flowchart LR
A[Tool Call] --> B[ToolReceipt]
B --> C{Verifier}
C -->|Replay match| D[VERIFIED]
C -->|Hash mismatch| E[REJECTED]
F[StructuredClaim] --> G{Claim Matcher}
B --> G
G -->|TRUE| H[Evidence confirms]
G -->|FALSE| I[Evidence contradicts]
G -->|UNKNOWN| J[Insufficient evidence]
D --> K[SettlementMessage]
E --> K
Add Receipts to MCP Tool Calls
from trp.mcp_adapter import wrap_tool_call
# In your MCP server's tool handler:
def handle_tool_call(name, inputs):
output = my_tool(inputs)
receipt = wrap_tool_call(
tool_name=name,
tool_version="1.0.0",
inputs=inputs,
output=output,
nondeterminism="deterministic",
side_effects="none",
replay="strong",
)
return {"result": output, "_meta": {"trp:tool_receipt": receipt.to_dict()}}
REST API
# Verify a receipt
curl -X POST https://trp-core-production.up.railway.app/api/verify \
-H "Content-Type: application/json" \
-d @examples/fibonacci_receipt.json
# Match a claim against evidence
curl -X POST https://trp-core-production.up.railway.app/api/match \
-H "Content-Type: application/json" \
-d '{"claim": ..., "evidence": [...]}'
# Compute JCS canonical hash
curl -X POST https://trp-core-production.up.railway.app/api/hash \
-H "Content-Type: application/json" \
-d '{"n": 10}'
What TRP Is
A message protocol that lets agents make claims, attach proofs, and stake value on correctness. Other agents evaluate, challenge, or accept claims, and settlement redistributes stakes. TRP defines message shapes and interaction flow — it does not prescribe transport, identity, or proof format.
How It Fits
Where MCP handles tool invocation and A2A handles agent discovery, TRP handles claim accountability. An agent that retrieves data via MCP or delegates work via A2A can use TRP to attach a verifiable proof and an economic stake to the result.
Core Types
| Type | Purpose |
|---|---|
ToolReceipt |
Signed, hash-verified record of a tool call |
StructuredClaim |
Machine-parseable proposition linked to evidence |
EvidenceBundle |
Composite package of receipts + document hashes + attestations |
ToolReceiptVerifier |
Replay engine — re-runs tools and compares output hashes |
TRPMessage |
Versioned protocol envelope |
SettlementMessage |
Stake redistribution record |
AgentCapability |
Discovery declaration (served at /.well-known/trp-capability.json) |
License
Apache-2.0. See LICENSE.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file trp_core-0.6.0.tar.gz.
File metadata
- Download URL: trp_core-0.6.0.tar.gz
- Upload date:
- Size: 64.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1955df10ed83e154e5b3a737982f7ac34df126bd4d96769d8f917bffdcfbc136
|
|
| MD5 |
bf072a0a8a71cf2feb693e6d391f70a8
|
|
| BLAKE2b-256 |
b4a6aa97d1f4d46dbd776928de841f6d5c23c296b22188d2600da4e54cb8e889
|
File details
Details for the file trp_core-0.6.0-py3-none-any.whl.
File metadata
- Download URL: trp_core-0.6.0-py3-none-any.whl
- Upload date:
- Size: 47.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
523c3c726d27be35ff45bc021987a9cb40d565ad4583f00cbe1845805c60e092
|
|
| MD5 |
226bde890165ebc8eaaf4dcd4bd6d8b8
|
|
| BLAKE2b-256 |
bd387f8b1d45108467bb6c50192a2f8f6417b2a0f4d8249aeb3d2f43056cf9ab
|