Getting Started with LangGraph
OpenBox integrates with LangGraph by wrapping your compiled graph — your agents, nodes, and state machines stay exactly as they are while every action is governed, scored, and auditable.
One Code Change
The entire integration is a single function call wrapping your compiled graph:
- LangGraph
- OpenBox
from langgraph.graph import StateGraph, START, END, MessagesState
graph = StateGraph(MessagesState)
graph.add_node("agent", call_model)
graph.add_node("tools", tool_node)
graph.add_edge(START, "agent")
graph.add_conditional_edges("agent", should_continue, {"tools": "tools", END: END})
graph.add_edge("tools", "agent")
app = graph.compile()
result = await app.ainvoke({"messages": [("user", "Hello")]})
import os
from langgraph.graph import StateGraph, START, END, MessagesState
from openbox_langgraph import create_openbox_graph_handler # Added import
graph = StateGraph(MessagesState)
graph.add_node("agent", call_model)
graph.add_node("tools", tool_node)
graph.add_edge(START, "agent")
graph.add_conditional_edges("agent", should_continue, {"tools": "tools", END: END})
graph.add_edge("tools", "agent")
app = graph.compile()
# Wrap with OpenBox governance
governed = create_openbox_graph_handler(
graph=app,
api_url=os.getenv("OPENBOX_URL"),
api_key=os.getenv("OPENBOX_API_KEY"),
agent_did=os.getenv("OPENBOX_AGENT_DID"),
agent_private_key=os.getenv("OPENBOX_AGENT_PRIVATE_KEY"),
agent_name="MyAgent",
)
result = await governed.ainvoke({"messages": [("user", "Hello")]})
Newly created OpenBox agents require DID signing by default. If Require signing is disabled for the agent, omit agent_did and agent_private_key. See Agent DID Identity for the required environment variables.
Choose Your Path
LangGraph 101
Get the LangGraph concepts that matter for OpenBox before you wire governance into a real graph.
I already use LangGraph
Add the trust layer to your existing agent in 5 minutes. Install the SDK, wrap your graph, and your agent is governed.
Show me the SDK reference
Explore the full API reference, configuration options, error handling, and 3-layer governance architecture.
What OpenBox Captures
From a single integration point, OpenBox captures:
- Root graph lifecycle events for governed graph invocations
- User prompt signals before graph execution
- Tool, subagent, and LLM activity lifecycle events
- HTTP, database, and traced-function telemetry, with optional lower-level file telemetry
- Governance decisions, approvals, and guardrail outcomes
What To Expect In The UI
After integration, OpenBox gives you:
- A run timeline for graph, tool, subagent, and LLM activity
- Policy and guardrail decisions on governed boundaries
- Session replay with runtime context
- Model and token usage when the model provider returns usage metadata
- Tool health metrics for graphs that actually execute tools
Next Steps
- Read LangGraph 101 if you want the conceptual model first.
- Use Wrap an Existing Graph if you already have LangGraph in production.
- Continue to the LangGraph Developer Guide for configuration, event semantics, telemetry, and troubleshooting.