> ## Documentation Index
> Fetch the complete documentation index at: https://engramviz.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# LangGraph checkpoint replay

> Capture a stale-memory failure, fork its checkpoint, and replay a repair through a real StateGraph.

The repository includes a deterministic incident at
`examples/langgraph-memory`. It uses a real `StateGraph`, `MemorySaver`, and
`InMemoryStore` without a live model or paid API.

The user first says they live in San Francisco, then corrects the city to
Oakland. The captured failing turn intentionally retrieves the superseded San
Francisco memory. Its checkpoint records the graph state immediately before
retrieval.

The executor forks that checkpoint twice:

1. The baseline reruns retrieval and generation with the original policy and
   must reproduce San Francisco.
2. The treatment applies the proposed memory-status intervention, reruns the
   same nodes, and selects Oakland.
3. Engram compares the observed stages and reports selection as the earliest
   divergence.

## Run it

From the Engram repository:

```bash theme={"dark"}
npm install
npm run engram -- init --project langgraph-example
npm run engram -- dev \
  --executor examples/langgraph-memory/engram.executor.mjs
```

In another terminal:

```bash theme={"dark"}
eval "$(npx --yes @engramviz/cli env --format shell)"
node examples/langgraph-memory/demo.mjs
```

Open `http://localhost:3100/?mode=incidents`, select the failing city answer,
enter `Oakland` as expected evidence, and run the proposed repair. The Replay
step should say **Real agent replay**, show `selection` as the earliest
divergence, and pass the answer check.

Run the complete executor contract without Studio:

```bash theme={"dark"}
npm run test:example-langgraph
```

## Isolation boundary

Each replay variant receives a fresh `MemorySaver`, `InMemoryStore`, and thread
ID. The executor supports only `blocked` side effects. A production integration
must create equivalent replay-safe copies of its checkpointer and Store and
must prevent arbitrary graph nodes from writing to production systems.

The graph answer is deterministic so normal tests remain free of paid calls.
Replace that node with the application's real model boundary only after model
identity, sampling, tools, and side effects are captured or controlled well
enough for the replay claim you want to make.

<Card title="Read the adapter guide" icon="book-open" href="/instrument/langgraph">
  Configure selection, update classification, custom content mapping, and explicit context loading.
</Card>
