Frameworks

Framework Integrations

Supported Frameworks

FrameworkPackageStatus
LangGraphsubstr8-langgraph✅ Production
AutoGenComing soon🔜
CrewAIComing soon🔜
PydanticAIComing soon🔜

LangGraph

The primary supported framework.

Installation

pip install substr8-langgraph langgraph

Basic Usage

from langgraph.graph import StateGraph, END
from substr8_langgraph import instrument_graph
from typing import TypedDict
 
# Define state
class MyState(TypedDict):
    input: str
    output: str
 
# Define nodes
def process(state: MyState) -> dict:
    return {"output": f"Processed: {state['input']}"}
 
# Build graph
graph = StateGraph(MyState)
graph.add_node("process", process)
graph.set_entry_point("process")
graph.add_edge("process", END)
 
# Compile
compiled = graph.compile()
 
# Wrap with Substr8
instrumented = instrument_graph(
    compiled,
    agent_id="my-agent",
    project="my-project",
)
 
# Run
result = instrumented.invoke({"input": "Hello"})
 
# Result includes proof
print(f"Output: {result['output']}")
print(f"Run ID: {result['run_id']}")
print(f"Proof status: {result['proof_status']}")

Saving the Proof

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

Verifying

substr8 proof verify runproof.json

Events Captured

EventWhen
run_startedGraph invocation begins
node_startedNode execution begins
node_endedNode execution completes
run_endedGraph invocation completes

Full Example

See the demo repository: 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

Coming Soon

AutoGen

Microsoft’s multi-agent framework.

# Coming in v1.1
from substr8_autogen import instrument_agents

CrewAI

Role-based agent orchestration.

# Coming in v1.1
from substr8_crewai import instrument_crew

PydanticAI

Type-safe agent framework.

# Coming in v1.1
from substr8_pydanticai import instrument_agent

Custom Integrations

For frameworks not yet supported, use substr8-core directly:

from substr8_core import RunState, RunStatus
 
state = RunState(agent_id="custom-agent", project="my-project")
 
# Start run
state.start()
 
# Emit events during your agent's execution
state.add_event("tool_called", {"tool": "search", "query": "..."})
state.add_event("tool_result", {"result": "..."})
 
# End run
state.end(RunStatus.COMPLETED, outputs={"answer": "..."})
 
# Build and save proof
proof = state.build_proof()

This gives you full control over event emission.


Next Steps