Allowing asynchronous serialization and deserialization within checkpoint savers #98

Closed
opened 2026-02-15 17:15:44 -05:00 by yindo · 2 comments
Owner

Originally created by @wpoynter on GitHub (Sep 28, 2024).

I am currently in the process of writing a package that uses AWS's Dynamno DB as the persistence store for checkpoint saving. I am keeping the implementation as close to the existing Sqlite and MongoDB checkpoint savers as possible.

In my use case for the library I am creating, I would like the serde to be able to encrypt and decrypt the data. My intention is to use an encryption library that performs asynchronously. There is no reason within my package I cannot support both serdes that work synchronously and asynchronously, but it does deviate from the existing classes.

Proposed Change

My idea is that the SerializationProtocol is updated to allow async methods, e.g.

export interface SerializerProtocol {
    dumpsTyped(data: any): Promise<[string, Uint8Array]> | [string, Uint8Array];
    loadsTyped(type: string, data: Uint8Array | string): Promise<any> | unknown;
}

Then changes are made to MemorySaver, MongoDBSaver, SqliteSaver, and tests to await the calls of dumpsTyped and loadsTyped. This should allow existing users to continue to use synchronous methods without an issue and will allow future use of asynchronous methods.

Possible Issue

The only possible issue that occurs to me is how Langgraph JS behaves if someone provides slow async methods for serialization for some reason?

Doing the work

I am happy to take a stab at the work if it seems like a reasonable idea.

Originally created by @wpoynter on GitHub (Sep 28, 2024). I am currently in the process of writing a package that uses AWS's Dynamno DB as the persistence store for checkpoint saving. I am keeping the implementation as close to the existing Sqlite and MongoDB checkpoint savers as possible. In my use case for the library I am creating, I would like the serde to be able to encrypt and decrypt the data. My intention is to use an encryption library that performs asynchronously. There is no reason within my package I cannot support both serdes that work synchronously and asynchronously, but it does deviate from the existing classes. ## Proposed Change My idea is that the SerializationProtocol is updated to allow async methods, e.g. ```typescript export interface SerializerProtocol { dumpsTyped(data: any): Promise<[string, Uint8Array]> | [string, Uint8Array]; loadsTyped(type: string, data: Uint8Array | string): Promise<any> | unknown; } ``` Then changes are made to MemorySaver, MongoDBSaver, SqliteSaver, and tests to `await` the calls of `dumpsTyped` and `loadsTyped`. This should allow existing users to continue to use synchronous methods without an issue and will allow future use of asynchronous methods. ## Possible Issue The only possible issue that occurs to me is how Langgraph JS behaves if someone provides slow async methods for serialization for some reason? ## Doing the work I am happy to take a stab at the work if it seems like a reasonable idea.
yindo added the enhancement label 2026-02-15 17:15:44 -05:00
yindo closed this issue 2026-02-15 17:15:44 -05:00
Author
Owner

@wpoynter commented on GitHub (Oct 2, 2024):

PR: https://github.com/langchain-ai/langgraphjs/pull/543

@wpoynter commented on GitHub (Oct 2, 2024): PR: https://github.com/langchain-ai/langgraphjs/pull/543
Author
Owner

@dqbd commented on GitHub (Sep 9, 2025):

Should be now available with 0.4.x!

@dqbd commented on GitHub (Sep 9, 2025): Should be now available with 0.4.x!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langchain-ai/langgraphjs#98