Integration Guide
LangGraph
Connect LangGraph to DashClaw and get your first governed action into /decisions in under 20 minutes.
Instance URL detected: https://your-dashclaw-instance.example.com
Deploy DashClaw
Get a running instance. Click the Vercel deploy button or run locally.
Already have an instance? Skip to Step 2.
Install the DashClaw Python SDK and LangGraph
Create a virtual environment and install the required packages.
Terminal
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate pip install dashclaw langgraph==1.1.3 langchain-core==1.2.21 python-dotenv
Set environment variables
Create a .env file with your DashClaw connection details. No LLM API key required for the example.
.env
DASHCLAW_BASE_URL=https://your-dashclaw-instance.example.com DASHCLAW_API_KEY=oc_live_...
Keep the effect inside a governed LangGraph node
The node passes the exact research act and callback to run_governed. DashClaw handles current policy, recording, approval, one execution claim, and outcome reporting.
main.py
import os
from dashclaw import DashClaw
from langgraph.graph import StateGraph, END
from typing import TypedDict
class AgentState(TypedDict):
topic: str
research_result: str
claw = DashClaw(
base_url=os.environ["DASHCLAW_BASE_URL"],
api_key=os.environ["DASHCLAW_API_KEY"],
agent_id="langgraph-research-agent",
)
def governed_research_node(state: AgentState) -> AgentState:
"""Keep the research effect inside DashClaw's claimed callback."""
topic = state["topic"]
result = claw.run_governed(
{
"kind": "http",
"request": {
"method": "GET",
"url": "https://research.example.test/search",
"body_excerpt": topic,
},
},
{
"action_type": "research",
"declared_goal": f"Research topic: {topic}",
"risk_score": 30,
},
lambda: f"Research findings for {topic}", # replace with real work
)
return {**state, "research_result": result}
# Wire the graph
graph = StateGraph(AgentState)
graph.add_node("research", governed_research_node)
graph.set_entry_point("research")
graph.add_edge("research", END)
app = graph.compile()Do not split guard and effect across graph nodes. The effect callback must stay behind the execution claim.
Run the governed LangGraph agent
Execute the example and watch the governance flow.
Terminal
python main.py
No OPENAI_API_KEY needed: the example simulates LLM output. Only the DashClaw SDK calls are real.
See the result in DashClaw
Open your DashClaw dashboard to confirm the action was recorded.
Go to /decisions: you should see your action in the ledger with action_type 'research', agent_id 'langgraph-research-agent', and status 'completed'.
Clone the full example
The complete runnable example is in the DashClaw repo.
Terminal
git clone https://github.com/ucsandman/DashClaw.git cd DashClaw/examples/langgraph-governed pip install -r requirements.txt python main.py
The repository example is an older cooperative guard-and-record graph. It records policy and approval state, but it does not claim execution authority. Use the run_governed node pattern above for real effects.
What success looks like
Go to /decisions: you should see your action in the ledger with action_type 'research', agent_id 'langgraph-research-agent', and status 'completed'.
Navigate to /decisions in your DashClaw instance. Your action should appear in the ledger within seconds of the agent run.
Governance as Code
guardrails.yml is a policy-as-code template. Import it into your instance — POST the YAML to /api/policies/import or call the Python SDK's import_policies — and DashClaw evaluates these rules at the guard step before any action executes.
guardrails.yml
version: 1
project: my-langgraph-agent
description: >
Governance policy for a LangGraph research agent.
High-risk external writes require approval.
Low-risk reads are auto-allowed.
policies:
- id: approve_external_writes
description: Writing to external systems requires human approval
applies_to:
tools:
- api.post
- file.write
- database.insert
rule:
require: approval
- id: allow_research
description: Read-only research is low risk
applies_to:
tools:
- web.search
- document.read
rule:
allow: true