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-nevaberry-plugins)
---
name: langgraph-knowledge-patch
description: LangGraph
version: null
license: MIT
metadata:
author: Nevaberry
---
# LangGraph Knowledge Patch
Load this skill when migrating LangGraph code or working with state, execution,
streaming, interrupts, checkpoint savers, subgraphs, or deployment in Python,
TypeScript, or JavaScript. Use the quick references below and open the relevant
topic file for complete guidance and examples.
## Reference index
| Reference | Topics |
| --- | --- |
| [Migrations and state](references/migrations-and-state.md) | Package exports, deprecated types, schemas, reducers, validation, graph changes, node typing, runtime context |
| [Execution and reliability](references/execution-and-reliability.md) | Routing, tasks, caching, retries, timeouts, recovery, draining, tracing, runtime metadata, visualization |
| [Streaming and interrupts](references/streaming-and-interrupts.md) | SSE, React transports, v3 projections, nested events, interrupt schemas and IDs, resume, breakpoints |
| [Persistence and subgraphs](references/persistence-and-subgraphs.md) | Durability, namespaces, delta channels, custom savers, retention, conformance, child persistence and inspection |
| [Deployment](references/deployment.md) | Agent Server exports, backends, queues, workers, cloud deployment, JavaScript targets, threadless streams |
## Breaking changes and deprecations
JavaScript LangGraph packages ship bundled output. Replace imports into a package's
`dist/` directory with its public package exports.
The low-level `toLangGraphEventStream` helper was removed. For HTTP handlers
previously using `toLangGraphEventStreamResponse`, select SSE 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" },
});
```
Replace the deprecated `AgentState`, `AgentStatePydantic`,
`AgentStateWithStructuredResponse`, and
`AgentStateWithStructuredResponsePydantic` from `langgraph.prebuilt` with
`langchain.agents.AgentState`, which 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.
## State and routing quick reference
In JavaScript, pass `{ state, input, output }` to `StateGraph` to separate
internal channels, invocation input, and returned output. A node can write to
graph channels outside its input schema; a node schema can add channels.
- Use `ReducedValue` with `inputSchema` when updates differ from the stored
value. `typeof State.State` is the full state; `typeof State.Update` is the
partial update and uses the reducer's input type.
- Use `MessagesValue` directly in `StateSchema` for message conversion,
appending, replacement by ID, and deletion.
- `UntrackedValue` fields start fresh on resume. The default `guard: true`
rejects multiple writes in a super-step; `guard: false` keeps the last write.
- Zod v3 reducers use the `.langgraph` plugin. Zod v4 uses `.register()` with
the registry from `@langchain/langgraph/zod`; message fields can use
`MessagesZodMeta` from `@langchain/langgraph`.
In Python, `Overwrite(value)` from `langgraph.types` replaces a reducer-backed
value. The JSON form is `{"__overwrite__": []}` for replacing a value with an
empty list. A second overwrite of the same key in a super-step raises
`InvalidUpdateError`.
Pydantic state validation covers input to the first node. Validate later
updates explicitly and construct the Pydantic model from the result when a
validated output object is needed.
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. In JavaScript, when a tool returns a `Command` containing a tool
result in its message update, set `tool_call_id` to `runtime.toolCall.id`.
For `Command.PARENT` updates to keys shared by parent and child schemas,
define a reducer for each such key in the closest parent.
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 type changes can
break existing threads.
## Interrupt and resume quick reference
For typed JavaScript interrupts, pass an `interrupts` map as the second
`StateGraph` argument. Each entry types the outgoing payload first and the
resume value second; nodes call the named interrupt through `runtime.interrupt`.
In Python `langgraph` 1.2.12, pass `response_schema=` to `interrupt()` to
describe the expected resume value.
For parallel pauses, resume with an interrupt-ID-to-answer map using
`Command(resume=answers)` in Python or `new Command({ resume: answers })`
in JavaScript. JavaScript `isInterrupted(result)` narrows an invocation result
so its interrupt records can be read with `result[INTERRUPT]`.
Starting in Python LangGraph 1.2.20, each `interrupt()` call within a task has
its own ID. Use the new pause's ID for the next answer. Opt-in strict resume
rejects stale answers; use it when separate clients can answer the same paused run.
An input `Command` can combine `resume` and `update`. Starting in 1.2.16,
the resume command's state update is applied once, including for accumulating
reducers. For a new turn on an existing thread, pass plain input to start from
`START`.
To re-prompt after invalid input, call `interrupt()` once per node invocation,
store the revised prompt in state, and route back to the node. An in-node loop
replays earlier iterations each time the node resumes.
With a checkpointer configured, per-invocation debugging breakpoints use
`interrupt_before` / `interrupt_after` in Python or `interruptBefore` /
`interruptAfter` in JavaScript. Continue on the same thread with `None` in
Python or `null` in JavaScript. LangSmith Studio also supports static
interrupts set in the UI before a run.
## Streaming quick reference
Python `graph.stream_events(..., version="v3")` runs to completion when
`stream.output` is read. Then check `stream.interrupted` and `stream.interrupts`;
open a new stream with `Command(resume=...)` on the same thread for each pause.
Both languages expose v3 state snapshots through `stream.values` and token
deltas through each streamed message's `text` projection. Nested messages are
in the `messages` projection of each entry in `stream.subgraphs`.
Values streaming includes private state channels by default even if the
output schema omits them. Select exposed snapshot channels with Python
`output_keys` or JavaScript `outputKeys`.
In Python, `stream.subgraphs` exposes each nested run's `graph_name`, `path`,
and `values`. In JavaScript, set `subgraphs: true` on `streamEvents` to include
nested output. Raw Python v3 `updates` events identify the emitting graph with
`params.namespace` path segments (`[]` for the root); `params.data` contains
updates keyed by node name.
To change a React `useStream` connection, pass a transport.
`FetchStreamTransport` takes its endpoint as `apiUrl`.
## Execution and reliability quick reference
In Python LangGraph 1.2+, register async nodes with `timeout=`. Seconds or a
`timedelta` set a run limit; `TimeoutPolicy` can set run and idle limits:
```python
from langgraph.types import TimeoutPolicy
builder.add_node("fetch", fetch, timeout=TimeoutPolicy(run_timeout=60, idle_timeout=15))
```
Each attempt has its own timer. A timed-out attempt discards buffered writes
and raises `NodeTimeoutError`, a `TimeoutError` subclass, for the retry policy.
Use `runtime.heartbeat` to refresh an idle timeout.
In Python LangGraph 1.2+, a node's `error_handler=` handles failures after
retries are exhausted. It receives state and a `NodeError` and can return a
`Command` to update state and route to recovery.
`StateGraph.set_node_defaults()` supplies Python `retry_policy`, `timeout`,
`cache_policy`, and `error_handler` at compile time in LangGraph 1.2+.
Per-node settings take precedence; 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` at node registration and supply
a cache at compilation. Optional `keyFunc` derives a key from input; `ttl`
uses seconds and defaults to no expiration.
Nodes can call Functional API tasks. With a checkpointer, completed task
results can be reused on resume. Keep task and interrupt calls in the same
order before the resume point so replay retrieves the intended values.
Python `defer=True` on a node waits for pending tasks once triggered, letting
a collector run once after branches of unequal length finish. Use
`RemainingSteps` to route to `END` while enough steps remain to exit a loop.
## Persistence and subgraphs quick reference
JavaScript `durability: "sync"` completes each checkpoint write before the
next super-step. In both languages, `exit` also persists state when a run exits
with an error or pauses at a human-in-the-loop interrupt.
Python's beta `DeltaChannel` requires `langgraph>=1.2` and reconstructs state
by replaying saved ancestor writes. In 1.2.18, full snapshots default to every
100 updates; `snapshot_frequency=1000` retains the previous interval and
storage behavior. Preserve needed ancestors and writes during pruning, or
save a reconstructed `_DeltaSnapshot` in the retained checkpoint before removing
its history.
Compile the parent with a checkpointer to enable child persistence. Set the
child's compile-time `checkpointer` option as follows:
| Python / JavaScript | Child behavior |
| --- | --- |
| Omitted, `None` / `null` | Fresh state per invocation; inherits the parent's checkpointer for interrupts and durable execution within that call |
| `True` / `true` | State accumulates across calls on the same thread |
| `False` / `false` | Stateless; interrupts and durable execution require a checkpointed mode |
Use per-invocation persistence for repeated calls to the same child in one
node. Per-thread child calls can collide in their checkpoint namespace,
including parallel tool calls; cap calls per run on the outer agent for a
tool backed by a per-thread child.
Register distinct per-thread children under unique, stable node names.
Otherwise, reordering calls inside a node can load the wrong history. For a
function-invoked child, give it a named node in a wrapper graph and invoke
the compiled wrapper.
Custom saver contracts, delta history, retention, optional Agent Server
capabilities, and `langgraph-checkpoint-conformance` examples are in the
persistence reference.
## Deployment quick reference
Agent Server loads an exported `CompiledGraph` once per container at startup
and calls an exported factory each time it needs the graph. Leave checkpointer
and store unset in graph code so the server can inject configured backends.
PostgreSQL always stores assistants, threads, runs, and cron jobs and defaults
to storing checkpoints and cross-thread memory. Checkpoints can move to
MongoDB or a custom checkpointer; cross-thread memory can use a custom store.
PostgreSQL holds pending runs in the durable queue. Redis handles ephemeral
signaling, cancellation, and streaming pub/sub. In single-host and split
deployments, `N_JOBS_PER_WORKER` defaults to `10` concurrent runs per worker;
the queue allows at most one executing run per thread. Keep at least one
worker listening so pending runs can execute.
For a threadless SDK stream, pass `None` in Python or `null` in JavaScript as
the first argument to `client.runs.stream`. For REST, send the graph name from
`langgraph.json` as `assistant_id` to `POST /runs/stream` and authenticate with
a LangSmith API key.