Skip to main content
@engramviz/adapter-langgraph instruments LangGraph’s cross-thread Store interface. It captures durable memory writes, searches, reads, and deletes while preserving the distinction between retrieval and model context.

Install

The adapter supports @langchain/langgraph 1.x and wraps any compatible Store implementation, including InMemoryStore and persistent Store backends.

Wrap the Store

Wrap the Store before compiling the graph, then run the graph inside an Engram turn:
Inside a graph node, LangGraph exposes the Store as runtime.store. Store searches are captured automatically. Report context loading only after the application actually copies results into the model input:
search proves that LangGraph returned candidates. It does not prove that the application placed them in a prompt. Engram never converts a search result into active context automatically.

Captured operations

LangGraph put is an upsert, so the adapter cannot know whether a key existed without adding another Store read. Use classifyPut when the application knows that a write is an update:
Memory IDs include the full namespace and key. For example, ["users", "user-1", "memories"] plus "city" becomes langgraph:users/user-1/memories/city. This prevents identical keys in different namespaces from collapsing into one Engram memory.

Checkpoints are different

LangGraph checkpointers persist graph state within a thread and enable resume, history, and replay. LangGraph Store persists arbitrary information across threads. Engram’s adapter observes the latter as durable memory. It intentionally does not turn every checkpoint value into a memory event. Doing so would make transient execution state look like a durable user fact. Instrument an explicit application boundary separately if checkpoint state is part of the memory behavior being investigated.

Capture a replay boundary

For an incident to rerun the actual graph, capture state at an explicit node boundary while an Engram turn is active:
The helper automatically attaches the checkpoint to the active Engram turn. Pass { attachToActiveTurn: false } only when storing the returned checkpoint yourself, or pass an explicit turn for applications that cannot use async context. asNode is required because replay must resume from a known graph boundary. Engram stores JSON-compatible state values, not the checkpointer implementation or arbitrary closures.

Define the real replay executor

Export a provider-neutral executor from a local module:
Scaffold the module and shared project configuration once:
Studio and engram test both discover engram.executor.mjs through engram.config.json. This prevents a passing CI test from silently using a different replay implementation than the engineer used during diagnosis. Engram runs an untreated baseline first and rejects a causal comparison when it cannot reproduce the captured answer. It then applies the intervention only to the treatment fork, reruns the graph, and compares memory state, retrieval, selection, active context, and answer.
The executor checks the isolation declarations, but your application must make them true. Clone or reconstruct checkpoint and Store state for each variant. Block, record, or safely sandbox tool and network effects. Never replay against a mutable production Store.

Run the LangGraph example

Exercise a real StateGraph and InMemoryStore with deterministic capture.

Run the support-agent quickstart

Exercise the model-backed production-shaped workflow and shared executor.

Understand the evidence model

See what observed, mapped, derived, and unavailable evidence mean.

LangGraph references