LangGraph
Fuze integrates with LangGraph by wrapping tool functions registered with ToolNode.
Installation
pip install fuze-ai langgraphUsage
from fuze_ai.adapters.langgraph import fuze_tools
from langgraph.prebuilt import ToolNode
# Your existing tools
tools = [search_tool, calculator_tool, email_tool]
# Wrap all tools with Fuze protection
guarded_tools = fuze_tools(tools, config={
"max_cost_per_step": 0.50,
"max_iterations": 25,
})
# Use in your graph as normal
tool_node = ToolNode(guarded_tools)What it does
fuze_tools() wraps each tool's _run method with @guard, preserving the tool name, description, and input/output types — while adding loop detection, budget tracking, and audit logging.
Marking side-effects
guarded_tools = fuze_tools(tools, side_effects={
"send_email": cancel_email,
"create_record": delete_record,
})Per-tool configuration
guarded_tools = fuze_tools(tools, per_tool={
"search": {"max_cost": 0.10},
"send_email": {"side_effect": True, "max_retries": 1},
})Full example
from langgraph.graph import StateGraph, MessagesState
from langgraph.prebuilt import ToolNode
from fuze_ai.adapters.langgraph import fuze_tools
tools = [search, calculator, send_email]
guarded = fuze_tools(tools, side_effects={"send_email": recall_email})
graph = StateGraph(MessagesState)
graph.add_node("tools", ToolNode(guarded))
# ... rest of graph setup