Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Langgraph Knowledge Patch?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/nevaberry-langgraph-knowledge-patch)
---
name: langgraph-knowledge-patch
description: LangGraph
version: null
license: MIT
metadata:
author: Nevaberry
---
# LangGraph compatibility guidance
Load this skill when migrating LangGraph code or working with state schemas,
node execution, interrupts, streaming, checkpointing, subgraphs, or Agent Server.
Use the quick reference below and load the topic file for full details and examples.
## Reference index
| Reference | Topics |
| --- | --- |
| [Migration and state](references/migration-and-state.md) | Package exports, deprecated types, state schemas, reducers, validation, graph changes |
| [Execution and routing](references/execution-and-routing.md) | Node typing, context, tracing, retries, timeouts, recovery, caching, tools, fan-in, recursion |
| [Streaming and interrupts](references/streaming-and-interrupts.md) | SSE, transports, event projections, interrupt IDs, resume, breakpoints, nested streams |
| [Persistence and subgraphs](references/persistence-and-subgraphs.md) | Durability, checkpoint namespaces, delta channels, custom savers, retention, child persistence and inspection |
| [Deployment](references/deployment.md) | Graph exports, storage backends, queues, workers, deployment targets, threadless runs |
## Breaking changes and deprecations
### Imports and agent types
LangGraph JavaScript packages ship bundled output. Migrate imports that reach
into a package's `dist/` directory to its public package exports.
Replace the deprecated `AgentState`, `AgentStatePydantic`,
`AgentStateWithStructuredResponse`, and `AgentStateWithStructuredResponsePydantic`
from `langgraph.prebuilt` with `langchain.agents.AgentState`.
The replacement uses `TypedDict` state.
`HumanInterruptConfig`, `ActionRequest`, and `HumanInterrupt` are deprecated.
In `langchain.agents.middleware.human_in_the_loop`, use `InterruptOnConfig`
for per-tool approval settings and `HITLRequest` for the interrupt payload.
### JavaScript HTTP streaming
The low-level `toLangGraphEventStream` helper was removed. For an HTTP handler
that previously used `toLangGraphEventStreamResponse`, select SSE directly on
`graph.stream` and use the returned stream as the response body.
```typescript
const stream = await graph.stream(input, {
encoding: "text/event-stream",
streamMode: ["values", "messages"],
});
return new Response(stream, {
headers: { "Content-Type": "text/event-stream" },
});
```
## State schemas and updates
Pass `{ state, input, output }` to JavaScript's `StateGraph` to separate internal
channels from invocation input and returned output. A node can write to graph
channels outside its input schema, and a node schema can declare more channels.
Use `ReducedValue` with `inputSchema` when updates differ from the accumulated
value's type. `typeof State.State` extracts full state; `typeof State.Update`
extracts partial updates using the reducer's input type.
```ts
import { ReducedValue, StateSchema } from "@langchain/langgraph";
import { z } from "zod/v4";
const State = new StateSchema({
steps: new ReducedValue(z.array(z.string()).default(() => []), {
inputSchema: z.string(),
reducer: (steps, step) => [...steps, step],
}),
});
```
Use `MessagesValue` directly as a `StateSchema` field to convert plain message
objects to message instances, append messages, replace by ID, and handle deletions.
For plain Zod schemas, v3 attaches reducers through `.langgraph`; v4 uses
`.register()` with the registry from `@langchain/langgraph/zod`.
Declare `UntrackedValue` for execution state that starts fresh on resume.
Its default `guard: true` rejects multiple writes in one super-step;
`guard: false` keeps the last write.
In Python, `Overwrite(value)` from `langgraph.types` replaces a reducer-backed
value; the serialized form is `{"__overwrite__": []}` for an empty list.
A second overwrite of the same key in one super-step raises `InvalidUpdateError`.
Pydantic runtime state validation covers input to the first node. Validate later
updates explicitly and construct a model from the result for validated output.
Completed threads support node renaming and removal. Interrupted threads need
existing nodes and names preserved to resume. State fields can be added or
removed; renaming loses the saved value, and incompatible types can break threads.
## Interrupts and resuming
For typed JavaScript interrupts, pass an `interrupts` map as the second argument
to `StateGraph`. Each entry's types describe the outgoing payload, then the resume
value. Nodes call the named interrupt through `runtime.interrupt`.
Python's `interrupt()` accepts `response_schema=` in 1.2.12 to describe the
expected resume value.
For parallel pauses, pass an interrupt-ID-to-answer map as `Command(resume=answers)`
in Python or `new Command({ resume: answers })` in JavaScript. For JavaScript
invocation results, narrow with `isInterrupted(result)` and read `result[INTERRUPT]`.
Starting in Python LangGraph 1.2.20, each `interrupt()` call within a task has its
own ID. Use the ID from the new pause when answering a later call. Its opt-in
strict resume mode rejects stale answers; use it when separate clients can
answer the same paused run.
An input `Command` can supply both `resume` and `update` in one call:
```python
graph.invoke(Command(resume=True, update={"status": "reviewed"}), config)
```
Starting in 1.2.16, this state update is applied once, which matters for reducers
that append or accumulate values. Pass plain input for a new turn on an existing
thread to start from `START`.
For invalid input, call `interrupt()` once per node invocation, store a revised
prompt in state, and route back to the node. An in-node loop replays earlier
iterations each time the node resumes. Keep task and interrupt calls in the same
order before the resume point so replay retrieves the intended values.
With a checkpointer, set per-invocation breakpoints using `interrupt_before` /
`interrupt_after` in Python or `interruptBefore` / `interruptAfter` in JavaScript.
Continue on the same thread with `None` in Python or `null` in JavaScript.
## Event streams and output selection
Values streaming includes private state channels by default even if the output
schema omits them. Select snapshot channels with Python's `output_keys` or
JavaScript's `outputKeys`.
In Python, reading `stream.output` drives `graph.stream_events(..., version="v3")`
to the end and returns its output. Check `stream.interrupted` and `stream.interrupts`
afterward; open a new stream with `Command(resume=...)` on the same thread per pause.
In both languages, v3 streams expose snapshots through `stream.values` and token
deltas through each streamed message's `text` projection. Read nested messages
from each `stream.subgraphs` entry's `messages` projection. In JavaScript, enable
`subgraphs: true` on `streamEvents` to include nested output.
## Persistence and subgraphs
Agent Server's default `async` durability writes checkpoints after each graph
step. Use `exit` to persist only the final state; in both languages it also
persists when a run exits with an error or pauses at a human-in-the-loop interrupt.
In JavaScript, `durability: "sync"` finishes each checkpoint before the next
super-step starts.
Compile the parent with a checkpointer to enable child persistence. On the child:
- Omit the checkpointer option or use `None` / `null` for fresh child state per
invocation, inheriting the parent's checkpointer for interrupts and durable
execution within that call.
- Use `True` / `true` for child state accumulated across calls on the same thread.
- Use `False` / `false` for stateless execution. Interrupts and durable execution
require a checkpointed mode.
Use per-invocation persistence when one node calls the same child multiple times.
Repeated per-thread child calls can collide in their checkpoint namespace,
including parallel calls through tools. Cap calls per run on the outer agent for
a tool backed by a per-thread child. Give distinct per-thread children unique,
stable node names; a wrapper graph provides that named node for function calls.
Python's beta `DeltaChannel` requires `langgraph>=1.2` and reconstructs accumulated
state by replaying ancestor checkpoint writes. When pruning, preserve required
ancestors and writes or save a reconstructed `_DeltaSnapshot` before removing
history. Copy the necessary ancestor chain and writes when copying a thread.
Custom saver implementations must preserve checkpoint metadata, parent IDs, and
reserved write indices. See the persistence reference for the full contract,
optional Agent Server methods, serializers, and conformance testing.
## Node execution and routing
For Python async nodes in LangGraph 1.2+, `timeout=` sets per-attempt limits.
`TimeoutPolicy` supports run and idle limits. Timed-out attempts discard buffered
writes and raise `NodeTimeoutError` for the retry policy to handle.
Register `error_handler=` to handle failure after retries are exhausted.
In LangGraph 1.2+, `StateGraph.set_node_defaults()` supplies `retry_policy`,
`timeout`, `cache_policy`, and `error_handler` at compile time. Per-node settings
take precedence, and each subgraph needs its own defaults. Error-handler nodes get
retry and timeout defaults; cache and handler defaults apply only to regular nodes.
For JavaScript node caching, set `cachePolicy` on registration and supply a cache
at compile time. Optional `keyFunc` derives the key from node input; `ttl` is in
seconds and defaults to no expiration.
A tool's `goto` schedules its destination alongside static outgoing edges from
the calling node. Use tool-driven routing alone when the tool should choose the
next node. A subgraph's `Command.PARENT` update requires a reducer in the closest
parent for each updated key declared in both schemas.
## Agent Server deployment
Agent Server loads an exported `CompiledGraph` once per container at startup and
calls an exported factory each time it needs the graph for per-run customization.
Leave the graph's checkpointer and store unset so the server can inject its
configured backends at runtime.
PostgreSQL holds pending runs in the durable queue; Redis handles ephemeral
signaling, cancellation, and streaming pub/sub. In single-host and split
deployments, each worker executes up to `N_JOBS_PER_WORKER` concurrent runs
(default `10`), with at most one executing run per thread. Keep at least one
worker listening so pending runs can execute.