Skip to main content
TL;DR: Pass your StateGraph to secure_agent(). It returns a SecureGraph that replaces graph.compile(), running content Guards on every model call and enforcing tool permissions before each tool executes.
The Trust Runtime wraps a LangGraph Agent with the full trust stack: identity attestation, content Guards, tool-permission enforcement, and audit. Install the adapters extra:

Securing a Graph

Call secure_agent() with your uncompiled StateGraph. It detects LangGraph automatically and returns a SecureGraph that stands in for the compiled graph.
secure_agent() compiles the graph for you and best-effort wraps any tools it finds with permission checks. The returned SecureGraph supports the standard execution methods: invoke, ainvoke, stream, and astream. It also exposes .runtime (the underlying TrustRuntime) and .attestation (the identity-verification result).

Execution Flow

On invoke, a SecureGraph runs three stages:
1

Guard the input

Runs the input through Dome’s input Guards.
2

Execute the graph

Executes the underlying compiled graph.
3

Guard the output

Runs the graph output through Dome’s output Guards.
In enforce mode, flagged input or output returns a guarded response of the form {"messages": [guarded_response]} instead of the model result. In warn mode, violations are logged and execution continues.
Streaming (stream / astream) applies the output Guard on a best-effort basis after the stream completes, because streamed chunks cannot be retracted once emitted. For strict output enforcement, use invoke / ainvoke.

Passing Compile Options

Extra keyword arguments flow through to graph.compile():

Next Steps

Trust Runtime

Identity, tool permissions, and attestation

LangChain

Content Guards for LangChain chains
Last modified on July 16, 2026