Getting Started

Getting Started

Generate cryptographically verifiable receipts for your AI agents in 60 seconds.

RunProof = cryptographically verifiable record of an agent execution


Installation

pip install substr8-langgraph substr8

Quick Start

1. Wrap your LangGraph

from langgraph.graph import StateGraph
from substr8_langgraph import instrument_graph
import json
 
# Build your graph normally
graph = StateGraph(MyState)
graph.add_node("search", search_node)
graph.add_node("analyze", analyze_node)
graph.set_entry_point("search")
graph.add_edge("search", "analyze")
 
# Compile it
compiled = graph.compile()
 
# Wrap with Substr8 instrumentation (one line)
instrumented = instrument_graph(
    compiled,
    agent_id="my-agent",
    project="my-project",
)
 
# Run the agent
result = instrumented.invoke({"query": "..."})
 
# The result includes the proof
print(f"Run ID: {result['run_id']}")
print(f"Proof status: {result['proof_status']}")

2. Save the RunProof

The proof is in result["proof"]. Save it to a file:

# Save proof to runproof.json
with open("runproof.json", "w") as f:
    json.dump(result["proof"].model_dump(mode="json"), f, indent=2)

Now you have runproof.json — a portable, verifiable receipt.

3. Verify locally (CLI)

pip install substr8
 
substr8 proof verify runproof.json

Output:

╭─────────────────── Verification Result ───────────────────╮
│ ✓ RunProof: VALID                                         │
╰───────────────────────────────────────────────────────────╯

  Proof ID   proof_abc123...
  Run ID     run_xyz789...
  Agent      my-agent

Checks:
  ✓ schema
  ✓ hash_chain
  ✓ merkle_root
  ✓ signature

4. Verify in browser

Upload runproof.json to runproof.substr8labs.com


What Gets Tracked

Every instrumented run produces a RunProof containing:

EventWhen
run_startedExecution begins
node_startedGraph node begins
node_endedGraph node completes
tool_calledTool invocation
tool_resultTool result
run_endedExecution finished

All events are:

  • Hash-chained — tamper-evident sequence
  • Merkle-rooted — single commitment to all events
  • Ed25519-signed — cryptographic proof of origin

Full Example

See the complete demo: substr8-langgraph-demo

git clone https://github.com/Substr8-Labs/substr8-langgraph-demo
cd substr8-langgraph-demo
pip install -r requirements.txt
python demo_agent.py
substr8 proof verify runproof.json

Next Steps