- Tool wrapping — replace every tool’s
func/coroutinewith a gated version that evaluates risk before execution. - Graph node — insert a gate node into a LangGraph
StateGraphthat filters tool calls between the agent and tool-execution nodes.
Installation
Tool Wrapping (Python)
AttestaToolWrapper wraps a list of LangChain tools so that every invocation passes through Attesta approval. The original tool objects are mutated in-place (their func and coroutine attributes are replaced).
API
Methods:
Full Example
Behavior on Denial
When a tool call is denied, the wrapper returns a string message instead of raising an exception. This allows the LLM agent to understand the denial and suggest alternatives:Both sync (
func) and async (coroutine) paths are wrapped. If your tool has a coroutine attribute, the async path is also gated. The wrapper auto-detects whether it is running inside an existing event loop (e.g., Jupyter or LangServe) and handles both cases.Tool Wrapping (TypeScript)
The TypeScript SDK providesgatedTool which wraps a LangChain tool’s invoke method using a Proxy.
API
Full Example
LangGraph Node (Python)
attesta_node() returns an async function suitable for use as a LangGraph node. Insert it between the agent node and the tool-execution node so that only approved tool calls are forwarded.
API
async (state: dict) -> dict. The function:
- Reads
tool_callsfrom the last message instate["messages"] - Evaluates each tool call through
attesta.evaluate() - Replaces
tool_callson the message with only the approved subset - Returns the modified state
Full Example
LangGraph Node (TypeScript)
The TypeScript SDK providescreateGateNode for LangGraph.
_attesta metadata to the state on approval, or throws AttestaDenied on denial.
Risk Overrides
Force specific risk levels for sensitive tools usingrisk_overrides:
OpenAI Agents SDK
Approval handler and tool guardrails
MCP Integration
Gate any MCP server with zero code changes