Skip to main content
A LangGraph node calls ordinary LangChain models, so the LangChain options carry over. The samples below were run against langgraph 1.2 and langchain-core 1.7 in Python, with promptguard-sdk 2.4.

Auto-instrumentation

Call init() before the graph is built. Every model call made through a patched SDK is scanned, in whichever node it happens, sync or async. A block raises PromptGuardBlockedError out of graph.invoke().
This scans what reaches the model. Tool calls and tool results are scanned only as part of the next model call’s messages, not when the tool runs.

Guarding a node’s input

To scan, and redact, a value before a node uses it, invoke the inline guard inside the node. On a redact decision it returns the redacted value; on a block it raises.

Callback handler

Pass PromptGuardCallbackHandler in the graph’s config and it scans every model call made in any node. It needs promptguard-sdk 2.4.0 or later. The graph’s thread_id is sent as the session id.

Proxy

A ChatOpenAI pointed at the proxy works in a graph like anywhere else, in Python or LangGraph.js.

Next steps

LangChain

Auto-instrumentation, an LCEL guard, or the proxy

Agent traces

Submit a full agent run to catch multi-step attacks

Auto-instrumentation

Which provider calls init() patches, and which it does not
Last modified on October 31, 2026