mirror of
https://github.com/langchain-ai/langgraphjs.git
synced 2026-07-21 08:35:23 -04:00
73ecaa0fb5
This PR was opened by the [Changesets release](https://github.com/changesets/action) GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated. # Releases ## @langchain/langgraph-checkpoint@1.1.2 ### Patch Changes - [#2544](https://github.com/langchain-ai/langgraphjs/pull/2544) [`4487214`](https://github.com/langchain-ai/langgraphjs/commit/448721449f0801009ba76b03dd2e9c16f900bbba) Thanks [@christian-bromann](https://github.com/christian-bromann)! - fix(langgraph): make concurrent DeltaChannel writes deterministic on replay Concurrent same-superstep writes to a `DeltaChannel` could reconstruct from a checkpoint differently than they were applied live, because live execution ordered them by task path while savers replayed them by task id. This fixes that divergence in two complementary ways: - Plain concurrent writes are now applied in the canonical `(task_id, idx)` order on both paths: `_applyWrites` orders them that way live, and the `getDeltaChannelHistory` walk enforces the same order so reconstruction matches live for every saver (Postgres, SQLite, MongoDB, Redis, and custom). - An `Overwrite` now wins its entire super-step: every sibling write in the same step — before AND after the `Overwrite` — is discarded, matching `BinaryOperatorAggregate`. This makes the result independent of the (unstable) ordering of concurrent fan-in writes; previously a plain write that landed after an `Overwrite` in the same step was still folded in. To keep reconstruction in sync with this `Overwrite` rule, any `DeltaChannel` that sees an `Overwrite` in a super-step is now force-snapshotted at the next checkpoint (and, under `"exit"` durability, in the final checkpoint). The post-overwrite value is materialized into `channel_values`, so a cold read seeds from that snapshot and never has to replay across the reset — making live and reconstructed state identical without changing the sparse-replay history shape. These delta-channel APIs remain Beta. - [#2531](https://github.com/langchain-ai/langgraphjs/pull/2531) [`38cfe01`](https://github.com/langchain-ai/langgraphjs/commit/38cfe01ff02490ff6bcc86c66708ef671f2e0d4b) Thanks [@christian-bromann](https://github.com/christian-bromann)! - fix(langgraph): forward task metadata and name subagents via lc_agent_name `mapDebugTasks` now forwards filtered user-meaningful task config metadata (including `lc_agent_name`) onto `tasks` stream payloads. The lifecycle transformer uses that metadata to set subagent `graph_name` from `lc_agent_name` and recover `cause: { type: "toolCall", tool_call_id }` from parent tool-dispatch tasks. Adds the shared `EXCLUDED_METADATA_KEYS` constant to `@langchain/langgraph-checkpoint`. Ports langgraph#7928. ## @langchain/langgraph-checkpoint-redis@1.0.10 ### Patch Changes - [#2336](https://github.com/langchain-ai/langgraphjs/pull/2336) [`25907eb`](https://github.com/langchain-ai/langgraphjs/commit/25907eb0be25258c26327c6c68c72bc828ee1cff) Thanks [@MohMaherId](https://github.com/MohMaherId)! - fix(langgraph-checkpoint-redis): persist and reconstruct full `channel_values` across multi-node graphs. `RedisSaver.put()` delta-filters `channel_values` to only the channels written by the current node, but `getTuple()` had no reconstruction logic — unlike `PostgresSaver` — so any multi-node graph whose last node wrote a subset of channels silently lost the others. Each changed channel is now persisted as a version-keyed `checkpoint_blob:*` entry in `put()` and missing channels are reconstructed from those blobs on read. `deleteThread()` now also deletes the `checkpoint_blob:*` keys. Without this the blobs introduced above would orphan forever (memory growth) and thread deletion would be incomplete, matching `PostgresSaver.deleteThread()` parity. When `ttlConfig.refreshOnRead` is enabled, reads now refresh the TTL of the reconstructed `checkpoint_blob:*` keys alongside the checkpoint key. Otherwise a read would keep the checkpoint alive while the blobs it depends on expired, silently dropping reconstructed channels. On write, `put()` now refreshes the TTL of every blob the checkpoint references (the full `channel_versions` set), not just the channels changed by the current node, so carried-over blobs from earlier nodes expire in lockstep with the checkpoint doc. This write-side refresh is independent of `refreshOnRead`. The per-channel blob writes also now run in parallel. Known limitation: with TTL enabled, a carried-over blob can still be lost if it expires during an idle gap longer than `defaultTTL` (no read or write refreshed it in time). When that happens the channel is left cleanly absent on read rather than erroring. Fully closing this gap (re-persisting expired blobs) is tracked as a follow-up. ## @langchain/langgraph@1.4.3 ### Patch Changes - [#2544](https://github.com/langchain-ai/langgraphjs/pull/2544) [`4487214`](https://github.com/langchain-ai/langgraphjs/commit/448721449f0801009ba76b03dd2e9c16f900bbba) Thanks [@christian-bromann](https://github.com/christian-bromann)! - fix(langgraph): make concurrent DeltaChannel writes deterministic on replay Concurrent same-superstep writes to a `DeltaChannel` could reconstruct from a checkpoint differently than they were applied live, because live execution ordered them by task path while savers replayed them by task id. This fixes that divergence in two complementary ways: - Plain concurrent writes are now applied in the canonical `(task_id, idx)` order on both paths: `_applyWrites` orders them that way live, and the `getDeltaChannelHistory` walk enforces the same order so reconstruction matches live for every saver (Postgres, SQLite, MongoDB, Redis, and custom). - An `Overwrite` now wins its entire super-step: every sibling write in the same step — before AND after the `Overwrite` — is discarded, matching `BinaryOperatorAggregate`. This makes the result independent of the (unstable) ordering of concurrent fan-in writes; previously a plain write that landed after an `Overwrite` in the same step was still folded in. To keep reconstruction in sync with this `Overwrite` rule, any `DeltaChannel` that sees an `Overwrite` in a super-step is now force-snapshotted at the next checkpoint (and, under `"exit"` durability, in the final checkpoint). The post-overwrite value is materialized into `channel_values`, so a cold read seeds from that snapshot and never has to replay across the reset — making live and reconstructed state identical without changing the sparse-replay history shape. These delta-channel APIs remain Beta. - [#2531](https://github.com/langchain-ai/langgraphjs/pull/2531) [`38cfe01`](https://github.com/langchain-ai/langgraphjs/commit/38cfe01ff02490ff6bcc86c66708ef671f2e0d4b) Thanks [@christian-bromann](https://github.com/christian-bromann)! - fix(langgraph): merge instead of overwrite in `ensureLangGraphConfig` `ensureLangGraphConfig` now per-key merges `callbacks`, `tags`, `metadata`, and `configurable` across configs instead of last-write-wins, so values bound via `.withConfig({...})` survive when a later (e.g. invoke-time) config supplies other keys. The merged dicts are fresh objects, fixing a by-reference mutation of shared base configs. Also drops the now-redundant `combineCallbacks` workaround in `streamEvents`, which double-registered and double-fired graph-bound callbacks. - [#2531](https://github.com/langchain-ai/langgraphjs/pull/2531) [`38cfe01`](https://github.com/langchain-ai/langgraphjs/commit/38cfe01ff02490ff6bcc86c66708ef671f2e0d4b) Thanks [@christian-bromann](https://github.com/christian-bromann)! - fix(langgraph): preserve namespace nesting for imperative graph invokes When a compiled graph is invoked from inside another graph's running task (e.g. a tool body calling `subAgent.invoke(...)`), the surrounding task context — including the langgraph-internal nesting keys (`__pregel_read`, `__pregel_stream`, `checkpoint_ns`, the checkpoint map) — is propagated implicitly via `AsyncLocalStorage`. The base `Runnable.stream` calls langchain-core's `ensureConfig`, which replaces the ambient `configurable` wholesale whenever the caller passes its own. Because `createAgent` always supplies a `configurable`, every tool-invoked sub-agent lost those keys, ran as a fresh root run, and had its streamed events flattened to the root namespace instead of nesting under the triggering task. `Pregel.stream` now merges the ambient `configurable` underneath the caller's (caller keys win per-key) when the ambient marks an active task (`__pregel_read` present) but the explicit `configurable` is missing it. Declared subgraph nodes (which already carry their own `__pregel_read`) and top-level runs are unaffected. - [#2537](https://github.com/langchain-ai/langgraphjs/pull/2537) [`be09666`](https://github.com/langchain-ai/langgraphjs/commit/be096663f42fe7ea9355d6c0def4854e657866d8) Thanks [@christian-bromann](https://github.com/christian-bromann)! - fix(langgraph): dispatch stream messages handler inline The v3 `messages` handler (`StreamProtocolMessagesHandler`, which powers `run.messages`) only performs a synchronous `push()` onto the run's stream, but its callbacks were dispatched on LangChain's background callback queue (the default `awaitHandlers === false`). A model or tool call inside a nested or parallel task could therefore flush its `messages` chunk _after_ the Pregel loop returned and sealed the stream, where `IterableReadableWritableStream.push` silently drops chunks once closed. This surfaced as empty per-message streams (`sub.messages`) for subagents dispatched in parallel from a single tools step. The handler now sets `awaitHandlers = true` so its callbacks run inline — every push happens during the originating model/chain call while the stream is still open. This avoids the global over-wait, fake-timer deadlock, and error-path unhandled rejections that a blanket `awaitAllCallbacks()` drain before close would have introduced. - [#2531](https://github.com/langchain-ai/langgraphjs/pull/2531) [`38cfe01`](https://github.com/langchain-ai/langgraphjs/commit/38cfe01ff02490ff6bcc86c66708ef671f2e0d4b) Thanks [@christian-bromann](https://github.com/christian-bromann)! - fix(langgraph): forward task metadata and name subagents via lc_agent_name `mapDebugTasks` now forwards filtered user-meaningful task config metadata (including `lc_agent_name`) onto `tasks` stream payloads. The lifecycle transformer uses that metadata to set subagent `graph_name` from `lc_agent_name` and recover `cause: { type: "toolCall", tool_call_id }` from parent tool-dispatch tasks. Adds the shared `EXCLUDED_METADATA_KEYS` constant to `@langchain/langgraph-checkpoint`. Ports langgraph#7928. - [#2549](https://github.com/langchain-ai/langgraphjs/pull/2549) [`bc667a9`](https://github.com/langchain-ai/langgraphjs/commit/bc667a998ae9909d15795387dad45048e8947219) Thanks [@christian-bromann](https://github.com/christian-bromann)! - fix(langgraph): support DeltaChannel fields in StateSchema Add a `DeltaValue` state field (and a `MessagesDeltaValue` prebuilt) so a `DeltaChannel` can be declared via `StateSchema`, not just `Annotation.Root` or a raw channel map. `StateSchema` now maps `DeltaValue` to a `DeltaChannel` (forwarding `snapshotFrequency` and the value-schema default) and validates its inputs/`Overwrite` updates like `ReducedValue`. - Updated dependencies \[[`4487214`](https://github.com/langchain-ai/langgraphjs/commit/448721449f0801009ba76b03dd2e9c16f900bbba), [`2134c8a`](https://github.com/langchain-ai/langgraphjs/commit/2134c8a2c0bc8dd2ebea33e1191c8dd0c4b83236), [`38cfe01`](https://github.com/langchain-ai/langgraphjs/commit/38cfe01ff02490ff6bcc86c66708ef671f2e0d4b)]: - @langchain/langgraph-checkpoint@1.1.2 - @langchain/langgraph-sdk@1.9.23 ## @langchain/langgraph-sdk@1.9.23 ### Patch Changes - [#2545](https://github.com/langchain-ai/langgraphjs/pull/2545) [`2134c8a`](https://github.com/langchain-ai/langgraphjs/commit/2134c8a2c0bc8dd2ebea33e1191c8dd0c4b83236) Thanks [@christian-bromann](https://github.com/christian-bromann)! - fix(sdk): avoid scoped stream resubscribe churn Defer final projection disposal by one microtask so framework bindings that release and immediately reacquire the same scoped projection during reactive updates keep the existing stream subscription instead of rotating through root-only and scoped SSE filters. ## @langchain/angular@1.0.24 ### Patch Changes - Updated dependencies \[[`2134c8a`](https://github.com/langchain-ai/langgraphjs/commit/2134c8a2c0bc8dd2ebea33e1191c8dd0c4b83236)]: - @langchain/langgraph-sdk@1.9.23 ## @langchain/react@1.0.24 ### Patch Changes - Updated dependencies \[[`2134c8a`](https://github.com/langchain-ai/langgraphjs/commit/2134c8a2c0bc8dd2ebea33e1191c8dd0c4b83236)]: - @langchain/langgraph-sdk@1.9.23 ## @langchain/svelte@1.0.24 ### Patch Changes - Updated dependencies \[[`2134c8a`](https://github.com/langchain-ai/langgraphjs/commit/2134c8a2c0bc8dd2ebea33e1191c8dd0c4b83236)]: - @langchain/langgraph-sdk@1.9.23 ## @langchain/vue@1.0.24 ### Patch Changes - Updated dependencies \[[`2134c8a`](https://github.com/langchain-ai/langgraphjs/commit/2134c8a2c0bc8dd2ebea33e1191c8dd0c4b83236)]: - @langchain/langgraph-sdk@1.9.23 ## @example/ai-elements@0.1.39 ### Patch Changes - Updated dependencies \[[`4487214`](https://github.com/langchain-ai/langgraphjs/commit/448721449f0801009ba76b03dd2e9c16f900bbba), [`38cfe01`](https://github.com/langchain-ai/langgraphjs/commit/38cfe01ff02490ff6bcc86c66708ef671f2e0d4b), [`38cfe01`](https://github.com/langchain-ai/langgraphjs/commit/38cfe01ff02490ff6bcc86c66708ef671f2e0d4b), [`be09666`](https://github.com/langchain-ai/langgraphjs/commit/be096663f42fe7ea9355d6c0def4854e657866d8), [`38cfe01`](https://github.com/langchain-ai/langgraphjs/commit/38cfe01ff02490ff6bcc86c66708ef671f2e0d4b), [`bc667a9`](https://github.com/langchain-ai/langgraphjs/commit/bc667a998ae9909d15795387dad45048e8947219)]: - @langchain/langgraph@1.4.3 - @langchain/react@1.0.24 ## @examples/assistant-ui-claude@0.1.39 ### Patch Changes - Updated dependencies \[[`4487214`](https://github.com/langchain-ai/langgraphjs/commit/448721449f0801009ba76b03dd2e9c16f900bbba), [`38cfe01`](https://github.com/langchain-ai/langgraphjs/commit/38cfe01ff02490ff6bcc86c66708ef671f2e0d4b), [`38cfe01`](https://github.com/langchain-ai/langgraphjs/commit/38cfe01ff02490ff6bcc86c66708ef671f2e0d4b), [`be09666`](https://github.com/langchain-ai/langgraphjs/commit/be096663f42fe7ea9355d6c0def4854e657866d8), [`38cfe01`](https://github.com/langchain-ai/langgraphjs/commit/38cfe01ff02490ff6bcc86c66708ef671f2e0d4b), [`bc667a9`](https://github.com/langchain-ai/langgraphjs/commit/bc667a998ae9909d15795387dad45048e8947219)]: - @langchain/langgraph@1.4.3 - @langchain/react@1.0.24 ## @examples/ui-angular@0.0.49 ### Patch Changes - Updated dependencies \[[`4487214`](https://github.com/langchain-ai/langgraphjs/commit/448721449f0801009ba76b03dd2e9c16f900bbba), [`38cfe01`](https://github.com/langchain-ai/langgraphjs/commit/38cfe01ff02490ff6bcc86c66708ef671f2e0d4b), [`38cfe01`](https://github.com/langchain-ai/langgraphjs/commit/38cfe01ff02490ff6bcc86c66708ef671f2e0d4b), [`2134c8a`](https://github.com/langchain-ai/langgraphjs/commit/2134c8a2c0bc8dd2ebea33e1191c8dd0c4b83236), [`be09666`](https://github.com/langchain-ai/langgraphjs/commit/be096663f42fe7ea9355d6c0def4854e657866d8), [`38cfe01`](https://github.com/langchain-ai/langgraphjs/commit/38cfe01ff02490ff6bcc86c66708ef671f2e0d4b), [`bc667a9`](https://github.com/langchain-ai/langgraphjs/commit/bc667a998ae9909d15795387dad45048e8947219)]: - @langchain/langgraph@1.4.3 - @langchain/langgraph-sdk@1.9.23 - @langchain/angular@1.0.24 ## @examples/ui-multimodal@0.0.25 ### Patch Changes - Updated dependencies \[[`4487214`](https://github.com/langchain-ai/langgraphjs/commit/448721449f0801009ba76b03dd2e9c16f900bbba), [`38cfe01`](https://github.com/langchain-ai/langgraphjs/commit/38cfe01ff02490ff6bcc86c66708ef671f2e0d4b), [`38cfe01`](https://github.com/langchain-ai/langgraphjs/commit/38cfe01ff02490ff6bcc86c66708ef671f2e0d4b), [`be09666`](https://github.com/langchain-ai/langgraphjs/commit/be096663f42fe7ea9355d6c0def4854e657866d8), [`38cfe01`](https://github.com/langchain-ai/langgraphjs/commit/38cfe01ff02490ff6bcc86c66708ef671f2e0d4b), [`bc667a9`](https://github.com/langchain-ai/langgraphjs/commit/bc667a998ae9909d15795387dad45048e8947219)]: - @langchain/langgraph@1.4.3 - @langchain/react@1.0.24 ## @examples/ui-react@0.0.25 ### Patch Changes - Updated dependencies \[[`4487214`](https://github.com/langchain-ai/langgraphjs/commit/448721449f0801009ba76b03dd2e9c16f900bbba), [`38cfe01`](https://github.com/langchain-ai/langgraphjs/commit/38cfe01ff02490ff6bcc86c66708ef671f2e0d4b), [`38cfe01`](https://github.com/langchain-ai/langgraphjs/commit/38cfe01ff02490ff6bcc86c66708ef671f2e0d4b), [`2134c8a`](https://github.com/langchain-ai/langgraphjs/commit/2134c8a2c0bc8dd2ebea33e1191c8dd0c4b83236), [`be09666`](https://github.com/langchain-ai/langgraphjs/commit/be096663f42fe7ea9355d6c0def4854e657866d8), [`38cfe01`](https://github.com/langchain-ai/langgraphjs/commit/38cfe01ff02490ff6bcc86c66708ef671f2e0d4b), [`bc667a9`](https://github.com/langchain-ai/langgraphjs/commit/bc667a998ae9909d15795387dad45048e8947219)]: - @langchain/langgraph@1.4.3 - @langchain/langgraph-sdk@1.9.23 - @langchain/react@1.0.24 ## langgraph@1.0.43 ### Patch Changes - Updated dependencies \[[`4487214`](https://github.com/langchain-ai/langgraphjs/commit/448721449f0801009ba76b03dd2e9c16f900bbba), [`38cfe01`](https://github.com/langchain-ai/langgraphjs/commit/38cfe01ff02490ff6bcc86c66708ef671f2e0d4b), [`38cfe01`](https://github.com/langchain-ai/langgraphjs/commit/38cfe01ff02490ff6bcc86c66708ef671f2e0d4b), [`be09666`](https://github.com/langchain-ai/langgraphjs/commit/be096663f42fe7ea9355d6c0def4854e657866d8), [`38cfe01`](https://github.com/langchain-ai/langgraphjs/commit/38cfe01ff02490ff6bcc86c66708ef671f2e0d4b), [`bc667a9`](https://github.com/langchain-ai/langgraphjs/commit/bc667a998ae9909d15795387dad45048e8947219)]: - @langchain/langgraph@1.4.3 Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@langchain/langgraph-checkpoint-redis
Redis checkpoint and store implementation for LangGraph.
Overview
This package provides Redis-based implementations for:
- Checkpoint Savers: Store and manage LangGraph checkpoints using Redis
- RedisSaver: Standard checkpoint saver that maintains full checkpoint history
- ShallowRedisSaver: Memory-optimized saver that only keeps the latest checkpoint per thread
- RedisStore: Redis-backed key-value store with optional vector search capabilities
Installation
npm install @langchain/langgraph-checkpoint-redis
Dependencies
Redis Requirements
This library requires Redis with the following modules:
- RedisJSON - For storing and manipulating JSON data
- RediSearch - For search and indexing capabilities
Redis 8.0+
If you're using Redis 8.0 or higher, both RedisJSON and RediSearch modules are included by default.
Redis < 8.0
For Redis versions lower than 8.0, you'll need to:
- Use Redis Stack, which bundles Redis with these modules
- Or install the modules separately in your Redis instance
Usage
Standard Checkpoint Saver
import { RedisSaver } from "@langchain/langgraph-checkpoint-redis";
const checkpointer = await RedisSaver.fromUrl(
"redis://localhost:6379",
{
defaultTTL: 60, // TTL in minutes
refreshOnRead: true
}
);
// Indices are automatically created by fromUrl()
// Use with your graph
const config = {configurable: {thread_id: "1"}};
// Metadata must include required fields
const metadata = {
source: "update", // "update" | "input" | "loop" | "fork"
step: 0,
parents: {}
};
await checkpointer.put(config, checkpoint, metadata, {});
const loaded = await checkpointer.get(config);
Shallow Checkpoint Saver
The ShallowRedisSaver is a memory-optimized variant that only keeps the latest checkpoint per thread:
import { ShallowRedisSaver } from "@langchain/langgraph-checkpoint-redis/shallow";
// Create a shallow saver that only keeps the latest checkpoint
const shallowSaver = await ShallowRedisSaver.fromUrl("redis://localhost:6379");
// Use it the same way as RedisSaver
const config = {
configurable: {
thread_id: "my-thread",
checkpoint_ns: "my-namespace"
}
};
const metadata = {
source: "update",
step: 0,
parents: {}
};
await shallowSaver.put(config, checkpoint, metadata, versions);
// Only the latest checkpoint is kept - older ones are automatically cleaned up
const latest = await shallowSaver.getTuple(config);
Key differences from RedisSaver:
- Storage: Only keeps the latest checkpoint per thread (no history)
- Performance: Reduced storage usage and faster operations
- Inline storage: Channel values are stored inline (no separate blob storage)
- Automatic cleanup: Old checkpoints and writes are automatically removed
RedisStore
The RedisStore provides a key-value store with optional vector search capabilities:
import { RedisStore } from "@langchain/langgraph-checkpoint-redis/store";
// Basic key-value store
const store = await RedisStore.fromConnString("redis://localhost:6379");
// Store with vector search
const vectorStore = await RedisStore.fromConnString("redis://localhost:6379", {
index: {
dims: 1536, // Embedding dimensions
embed: embeddings, // Your embeddings instance
distanceType: "cosine", // or "l2", "ip"
fields: ["text"], // Fields to embed
},
ttl: {
defaultTTL: 60, // TTL in minutes
refreshOnRead: true,
}
});
// Put and get items
await store.put(["namespace", "nested"], "key1", {text: "Hello world"});
const item = await store.get(["namespace", "nested"], "key1");
// Search with namespace filtering
const results = await store.search(["namespace"], {
filter: {category: "docs"},
limit: 10,
});
// Vector search
const semanticResults = await vectorStore.search(["namespace"], {
query: "semantic search query",
filter: {type: "article"},
limit: 5,
});
// Batch operations
const ops = [
{type: "get", namespace: ["ns"], key: "key1"},
{type: "put", namespace: ["ns"], key: "key2", value: {data: "value"}},
{type: "search", namespacePrefix: ["ns"], limit: 10},
{type: "list_namespaces", matchConditions: [{matchType: "prefix", path: ["ns"]}], limit: 10},
];
const results = await store.batch(ops);
TTL Support
Both checkpoint savers and stores support Time-To-Live (TTL) functionality:
const ttlConfig = {
defaultTTL: 60, // Default TTL in minutes
refreshOnRead: true, // Refresh TTL when items are read
};
const checkpointer = await RedisSaver.fromUrl("redis://localhost:6379", ttlConfig);
Development
Running Tests
# Run tests (uses TestContainers)
yarn test
# Run tests in watch mode
yarn test:watch
# Run integration tests
yarn test:int
License
MIT