NORNR
Mandates, approvals and evidence for autonomous agents.
Guide / LangGraph
12 minutesHow to gate paid tool calls in LangGraph
Gate paid LangGraph tool calls with NORNR so graph edges only reach expensive actions after policy says yes.
1. Why this guide matters
LangGraph shines when you want explicit nodes, edges and state transitions. That makes it a great place to attach spend governance before a paid tool node fires.
This pattern adds a decision node that asks NORNR first and routes the graph based on the returned status.
2. Install what you need
pip install agentpay langgraph
This guide uses the hosted NORNR path at https://nornr.com, so you can validate the decision flow without standing up the full local stack first.
3. Create the governed wallet
from agentpay import Wallet
wallet = Wallet.create(
owner="graph-agent",
daily_limit=80,
require_approval_above=30,
base_url="https://nornr.com",
)
This wallet is the mandate. It sets the budget and review threshold before the framework-specific workflow is allowed to continue.
4. Apply it in the workflow
from typing import TypedDict
from langgraph.graph import StateGraph, END
class FlowState(TypedDict):
question: str
decision: dict | None
def check_budget(state: FlowState):
decision = wallet.pay(
amount=18.00,
to="openai",
purpose="paid tool call",
)
return {"decision": decision}
def route_after_budget(state: FlowState):
status = (state.get("decision") or {}).get("status")
return "paid_tool" if status == "approved" else "hold"
graph = StateGraph(FlowState)
graph.add_node("check_budget", check_budget)
graph.add_conditional_edges("check_budget", route_after_budget, {"paid_tool": "paid_tool", "hold": END})
The key pattern stays the same across frameworks: ask NORNR for a decision first, then let the expensive or externally billable step run only if policy says yes.
5. What to expect
- approved means the workflow can continue immediately inside its mandate.
- queued means the request crossed an approval threshold and should wait for review.
- rejected means policy did not allow the action to proceed.
That three-way split is what makes the pattern useful: low-risk work stays fast, higher-risk work becomes reviewable, and clearly out-of-policy work never leaves the workflow.
6. Where to go next
Related guides
Keep going from the same control problem.
These are the closest follow-up guides in the same part of the library.
How to give your LangChain agent a budget in 10 minutes
Add a governed wallet, budget threshold and decision handling to a LangChain workflow with NORNR in 10 minutes.
Read guide OpenAI Agents SDK / 10 minutesHow to add approval rules to an OpenAI Agents SDK workflow
Add approval thresholds to an OpenAI Agents SDK workflow so expensive or risky steps pause before money moves.
Read guide OpenAI Agents SDK / 9 minutesHow to add budget limits to an OpenAI Agents SDK agent
Put budget limits in front of an OpenAI Agents SDK agent so it cannot burn through paid calls without policy.
Read guide