Implement or declare extended capabilities in BaseCheckpointSaver

Hi guys!

I’ve been looking for a documented way to copy a thread and stumbled across the documented “extended capabilities” to:

  • adelete_for_runs
  • acopy_thread
  • aprune
  • aget_delta_channel_history

at Checkpointers - Docs by LangChain .

These methods don’t seem to be implemented by either js or python library. However, they’re at least declared by the python’s base saver, meanwhile TypeScript base class doesn’t have those mentioned at all.

Is there a specific reason it’s omitted?

Since I’m a heavy user of mongodb typescript checkpointer, I’m asking whether it makes to gradually introduce these methods starting from a mongodb implementation.

In addition, I’m willing to contribute the feature.

Kind Regards, Dmytro.

Hey @eddienubes!

These are Agent Server features, not checkpointer features. If you’re running Agent Server, you can copy threads using client.threads.copy().

For your actual goal, in the base library you’d usually fork from a checkpoint rather than copy:

// walk back to the checkpoint you want to branch from
const states = [];
for await (const s of graph.getStateHistory({ configurable: { thread_id } })) {
  states.push(s);
}
const target = states.find((s) => s.next.includes("myNode"));

// branch from it, optionally with modified state
const forkConfig = await graph.updateState(target.config, { someKey: newValue });

// continue down the new branch
const result = await graph.invoke(null, forkConfig);

If you specifically need a separate thread_id, then no, there’s no primitive for that in either language today. You’d replay list()put()/putWrites() into the new id yourself.

Hope that helps!

Hi Dariel!

Yes, I think these features are optional for a checkpointer to implement. However, we don’t use Agent Server at all.

And yes, the ultimate goal is to have a separate thread_id, that’s why I suggested to have it as part of a checkpointer interface exactly as you put it list() → put()/putWrites(). Seemingly, it makes sense for a copy operation to be a built-in API.

Thanks!