Hey @yagobski
welcome — this is a very good question.
You’re absolutely right: most “LLM privacy” discussions focus on final output, but in LangGraph-style multi-agent systems, the real risk surface is the internal state and tool boundary.
The AgentLeak paper is pointing at something very real.
The Core Problem in LangGraph
In LangGraph:
-
State is shared (or partially shared)
-
Nodes can read/write keys
-
Tools often receive slices of state
-
Intermediate reasoning may serialize state implicitly
If you put raw PII into the shared State, you’ve already widened the blast radius.
So the design question becomes:
How do we reduce unnecessary data visibility across nodes?
Patterns That Actually Work in Practice
State Segmentation (Most Important)
Instead of one big shared state:
class State(TypedDict):
public_context: dict
sensitive_context: dict
internal_reasoning: dict
Then:
-
Only specific nodes receive sensitive_context
-
Other nodes operate only on public_context
-
Tools never receive full state unless explicitly required
Think “principle of least privilege,” but for graph nodes.
Explicit State Projection Per Node
In LangGraph, don’t pass full state by default.
Instead:
-
Wrap nodes in adapter functions
-
Extract only required fields
-
Return only minimal updates
This avoids accidental propagation of sensitive fields.
PII Tokenization Layer (Very Effective)
Before PII enters the graph:
-
Replace PII with internal IDs
-
Store actual values in secure store (DB, vault)
-
Agents operate on surrogate keys
Example:
User email → USER_123
SSN → TOKEN_456
Only specific “resolution nodes” rehydrate the data.
This dramatically reduces leakage risk.
Tool-Level Guards (Second Line of Defense)
Every tool wrapper should:
Treat tools as security boundaries, not just utilities.
Separate Subgraphs for Sensitive Ops
For highly regulated workflows:
-
Put sensitive logic in a subgraph
-
Avoid exposing that branch to general reasoning agents
-
Return only sanitized outputs
This creates architectural containment.
What I Would Avoid
Putting full user profile in shared state
Letting planning agents see raw PII
Allowing tool calls to serialize entire state blobs
Logging raw state without redaction
Where AgentLeak Is Especially Relevant
Their point about “intermediate channels” is key:
Leak vectors include:
LangGraph’s flexibility increases power — but also responsibility.
My Mental Model
Treat LangGraph state like:
A distributed in-memory database with untrusted compute nodes.
Design like you would for:
-
Microservices
-
Zero-trust architecture
-
RBAC systems
Not like a simple Python dict.
If I Had to Pick a Default Pattern
For serious systems:
-
Tokenize PII at ingestion
-
Segmented state keys
-
Explicit projections per node
-
Tool input validation
-
Sanitized logging
That combination gives strong practical protection.
Really glad you brought this up — this is exactly the kind of architectural discussion multi-agent systems need more of.