{"name":"@langchain/langgraph-checkpoint","version":"1.0.2","author":{"name":"LangChain"},"license":"MIT","_id":"@langchain/langgraph-checkpoint@1.0.2","maintainers":[{"name":"hwchase17","email":"hw.chase.17@gmail.com"},{"name":"jacoblee93","email":"jacoblee93@gmail.com"},{"name":"basproul","email":"braceasproul@gmail.com"},{"name":"eric_langchain","email":"eric@langchain.dev"},{"name":"andrewnguonly","email":"andrewnguonly@gmail.com"},{"name":"davidduong","email":"david@duong.cz"},{"name":"maddyadams","email":"madelyn.adams1@gmail.com"},{"name":"sam_noyes","email":"sam@langchain.dev"},{"name":"langchain-security","email":"infra@langchain.dev"},{"name":"andy-langchain","email":"andy@langchain.dev"},{"name":"rcasup","email":"ryan.l.casupanan@gmail.com"},{"name":"hntrl","email":"hunter@hntrl.io"},{"name":"christian-bromann","email":"mail@bromann.dev"}],"homepage":"https://github.com/langchain-ai/langgraphjs#readme","bugs":{"url":"https://github.com/langchain-ai/langgraphjs/issues"},"dist":{"shasum":"de350639d4c5c7b8f0308c7995be1202a539786e","tarball":"http://registry-npm.ywwl.com/@langchain/langgraph-checkpoint/download/@langchain/langgraph-checkpoint-1.0.2.tgz","fileCount":101,"integrity":"sha512-F4E5Tr0nt8FGghgdscJtHw+ABzChOHeI80R7Y1pjIHdiJom6c2ieo76vL+FWiny80JmoGqhrVAEIWrw0cXKPxg==","signatures":[{"sig":"MEUCIQDemMZuFsxGnWYvfEl94euyIAkuxDfIUsp6fzvsaZZeNgIgO20rRc5utj4sPYXsqQTQXSz8Ti/hgImVMc20yzpT/V8=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@langchain%2flanggraph-checkpoint@1.0.2","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":379532,"size":90421,"noattachment":false,"key":"/@langchain/langgraph-checkpoint/-/@langchain/langgraph-checkpoint-1.0.2.tgz"},"main":"./dist/index.js","type":"module","_from":"file:langchain-langgraph-checkpoint-1.0.2.tgz","types":"./dist/index.d.ts","engines":{"node":">=18"},"exports":{".":{"input":"./src/index.ts","import":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"require":{"types":"./dist/index.d.cts","default":"./dist/index.cjs"},"typedoc":"./src/index.ts"},"./package.json":"./package.json"},"scripts":{"test":"vitest run","build":"pnpm turbo build:internal --filter=@langchain/langgraph-checkpoint","clean":"rm -rf dist/ dist-cjs/ .turbo/","test:int":"vitest run --mode int","lint:dpdm":"dpdm --exit-code circular:1 --no-warning --no-tree src/*.ts src/**/*.ts","prepublish":"pnpm build","test:watch":"vitest watch","lint:eslint":"NODE_OPTIONS=--max-old-space-size=4096 eslint --cache --ext .ts,.js src/","build:internal":"pnpm --filter @langchain/build compile @langchain/langgraph-checkpoint"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:5e1643bb-9c20-43c5-bbed-a84f51ed265c"}},"_resolved":"/tmp/c6d01a6b64b9cf88b3f7f3ffd4c62ce9/langchain-langgraph-checkpoint-1.0.2.tgz","_integrity":"sha512-F4E5Tr0nt8FGghgdscJtHw+ABzChOHeI80R7Y1pjIHdiJom6c2ieo76vL+FWiny80JmoGqhrVAEIWrw0cXKPxg==","repository":{"url":"git+ssh://git@github.com/langchain-ai/langgraphjs.git","type":"git","directory":"libs/checkpoint"},"_npmVersion":"11.11.0","description":"Library with base interfaces for LangGraph checkpoint savers.","directories":{},"_nodeVersion":"24.14.1","dependencies":{"uuid":"^10.0.0"},"publishConfig":{"access":"public","registry":"https://registry.npmjs.org/"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.19.3","dpdm":"^3.12.0","dotenv":"^16.3.1","rollup":"^4.37.0","vitest":"^3.2.4","typescript":"^4.9.5 || ^5.4.5","@types/uuid":"^10","@langchain/scripts":">=0.1.3 <0.2.0","@tsconfig/recommended":"^1.0.3"},"peerDependencies":{"@langchain/core":"^1.1.44"},"_npmOperationalInternal":{"tmp":"tmp/langgraph-checkpoint_1.0.2_1777967145843_0.4562084061577749","host":"s3://npm-registry-packages-npm-production"},"readme":"# @langchain/langgraph-checkpoint\n\nThis library defines the base interface for [LangGraph.js](https://github.com/langchain-ai/langgraphjs) checkpointers. Checkpointers provide persistence layer for LangGraph. They allow you to interact with and manage the graph's state. When you use a graph with a checkpointer, the checkpointer saves a _checkpoint_ of the graph state at every superstep, enabling several powerful capabilities like human-in-the-loop, \"memory\" between interactions and more.\n\n## Key concepts\n\n### Checkpoint\n\nCheckpoint is a snapshot of the graph state at a given point in time. Checkpoint tuple refers to an object containing checkpoint and the associated config, metadata and pending writes.\n\n### Thread\n\nThreads enable the checkpointing of multiple different runs, making them essential for multi-tenant chat applications and other scenarios where maintaining separate states is necessary. A thread is a unique ID assigned to a series of checkpoints saved by a checkpointer. When using a checkpointer, you must specify a `thread_id` and optionally `checkpoint_id` when running the graph.\n\n- `thread_id` is simply the ID of a thread. This is always required\n- `checkpoint_id` can optionally be passed. This identifier refers to a specific checkpoint within a thread. This can be used to kick of a run of a graph from some point halfway through a thread.\n\nYou must pass these when invoking the graph as part of the configurable part of the config, e.g.\n\n```ts\n{ configurable: { thread_id: \"1\" } }  // valid config\n{ configurable: { thread_id: \"1\", checkpoint_id: \"0c62ca34-ac19-445d-bbb0-5b4984975b2a\" } }  // also valid config\n```\n\n### Serde\n\n`@langchain/langgraph-checkpoint` also defines protocol for serialization/deserialization (serde) and provides an default implementation that handles a range of types.\n\n### Pending writes\n\nWhen a graph node fails mid-execution at a given superstep, LangGraph stores pending checkpoint writes from any other nodes that completed successfully at that superstep, so that whenever we resume graph execution from that superstep we don't re-run the successful nodes.\n\n### When are checkpoints persisted\n\nBy default (`durability: \"async\"`) checkpoint writes are dispatched in the background while the graph keeps executing, which keeps runs fast. Regardless of the `durability` mode, LangGraph **awaits all outstanding checkpointer writes before `invoke()` / `stream()` resolves**, `invoke()` fully drains the underlying stream, and the stream awaits every pending checkpointer promise before it completes.\n\nIn practice this means:\n\n- If you `await graph.invoke(...)` (or fully consume `for await (... of graph.stream(...))`), persistence is guaranteed to be complete by the time the call returns. You do **not** need to keep the process/runtime alive for any trailing background writes.\n- On serverless/edge runtimes (e.g. Cloudflare Workers) you therefore do not need `ctx.waitUntil()` to flush checkpoints, just make sure you `await` the run before returning a response. The only way to orphan writes is to start a stream and never consume it (e.g. piping `graph.stream()` into a detached, un-awaited task).\n\n> Note: this guarantees the *write was issued and awaited*, not that your database driver works in a given runtime. See the runtime-compatibility notes in the [Postgres](../checkpoint-postgres/README.md#edge--serverless-runtimes-cloudflare-workers-etc) and [Redis](../checkpoint-redis/README.md#edge--serverless-runtimes-cloudflare-workers-etc) checkpointer READMEs.\n\n## Interface\n\nEach checkpointer should conform to `BaseCheckpointSaver` interface and must implement the following methods:\n\n- `.put` - Store a checkpoint with its configuration and metadata.\n- `.putWrites` - Store intermediate writes linked to a checkpoint (i.e. pending writes).\n- `.getTuple` - Fetch a checkpoint tuple using for a given configuration (`thread_id` and `thread_ts`).\n- `.list` - List checkpoints that match a given configuration and filter criteria.\n\n## Usage\n\n```ts\nimport { MemorySaver } from \"@langchain/langgraph-checkpoint\";\n\nconst writeConfig = {\n  configurable: {\n    thread_id: \"1\",\n    checkpoint_ns: \"\"\n  }\n};\nconst readConfig = {\n  configurable: {\n    thread_id: \"1\"\n  }\n};\n\nconst checkpointer = new MemorySaver();\nconst checkpoint = {\n  v: 1,\n  ts: \"2024-07-31T20:14:19.804150+00:00\",\n  id: \"1ef4f797-8335-6428-8001-8a1503f9b875\",\n  channel_values: {\n    my_key: \"meow\",\n    node: \"node\"\n  },\n  channel_versions: {\n    __start__: 2,\n    my_key: 3,\n    \"start:node\": 3,\n    node: 3\n  },\n  versions_seen: {\n    __input__: {},\n    __start__: {\n      __start__: 1\n    },\n    node: {\n      \"start:node\": 2\n    }\n  },\n  pending_sends: [],\n}\n\n// store checkpoint\nawait checkpointer.put(writeConfig, checkpoint, {}, {})\n\n// load checkpoint\nawait checkpointer.get(readConfig)\n\n// list checkpoints\nfor await (const checkpoint of checkpointer.list(readConfig)) {\n  console.log(checkpoint);\n}\n```\n","publish_time":1777967146031,"_cnpm_publish_time":1777967146031,"dist-tags":{"latest":"1.2.2","next":"1.0.0"}}