synwire-checkpoint 0.1.0

Checkpoint traits and in-memory implementation for Synwire
Documentation

synwire-checkpoint

Checkpoint persistence traits for Synwire graphs. Enables resumable, forkable, and rewindable workflow runs.

What this crate provides

  • BaseCheckpointSaver — trait for saving and loading graph snapshots: get_tuple, list, put
  • InMemoryCheckpointSaver — zero-config, process-lifetime checkpoint store
  • BaseStore — general-purpose K-V store for agent state persistence: get, put, delete, list
  • CheckpointConfigthread_id namespaces runs; checkpoint_id targets a specific snapshot
  • CheckpointTuple — a checkpoint with its config, metadata, and parent reference
  • Checkpoint — snapshot of all channel values at a given step
  • CheckpointMetadata — step number, source, writes, parent references

Quick start

[dependencies]
synwire-checkpoint = "0.1"
synwire-orchestrator = "0.1"
tokio = { version = "1", features = ["full"] }

Wire InMemoryCheckpointSaver into a compiled graph:

use synwire_checkpoint::{InMemoryCheckpointSaver, CheckpointConfig};
use synwire_orchestrator::graph::ValueState;
use std::sync::Arc;

#[tokio::main]
async fn main() -> anyhow::Result<()> {
    // assume `compiled` is a CompiledGraph<ValueState>
    // let saver = Arc::new(InMemoryCheckpointSaver::new());
    // let graph = compiled.with_checkpoint_saver(saver);
    //
    // First run — thread_id "session-1" is checkpointed
    // let config = CheckpointConfig::new("session-1");
    // let result = graph.invoke(ValueState::default(), Some(config.clone())).await?;
    //
    // Resume the same run later — graph picks up from the last checkpoint
    // let resumed = graph.invoke(ValueState::default(), Some(config)).await?;
    Ok(())
}

Resuming from a checkpoint

Pass the same thread_id on subsequent invoke calls. The graph loads the latest checkpoint for that thread and continues from where it left off.

For durable storage across process restarts, use synwire-checkpoint-sqlite.

Documentation