@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
@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:runtime.store. Store
searches are captured automatically. Report context loading only after the
application actually copies results into the model input:
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:
["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:{ 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: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.
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.