Checkpointer

Trait Checkpointer 

Source
pub trait Checkpointer: Send + Sync {
    // Required methods
    fn save_state<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        thread_id: &'life1 String,
        state: &'life2 AgentStateSnapshot,
    ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             Self: 'async_trait;
    fn load_state<'life0, 'life1, 'async_trait>(
        &'life0 self,
        thread_id: &'life1 String,
    ) -> Pin<Box<dyn Future<Output = Result<Option<AgentStateSnapshot>, Error>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             Self: 'async_trait;
    fn delete_thread<'life0, 'life1, 'async_trait>(
        &'life0 self,
        thread_id: &'life1 String,
    ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             Self: 'async_trait;
    fn list_threads<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<String>, Error>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             Self: 'async_trait;
}
Available on crate feature aws only.
Expand description

Trait for persisting and retrieving agent state between conversation runs. This mirrors the LangGraph Checkpointer interface used in the Python implementation.

Required Methods§

Source

fn save_state<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, thread_id: &'life1 String, state: &'life2 AgentStateSnapshot, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, Self: 'async_trait,

Save the current agent state for a given thread.

Source

fn load_state<'life0, 'life1, 'async_trait>( &'life0 self, thread_id: &'life1 String, ) -> Pin<Box<dyn Future<Output = Result<Option<AgentStateSnapshot>, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Load the last saved state for a given thread. Returns None if no state exists for this thread.

Source

fn delete_thread<'life0, 'life1, 'async_trait>( &'life0 self, thread_id: &'life1 String, ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Delete all saved state for a given thread.

Source

fn list_threads<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<String>, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

List all thread IDs that have saved state.

Implementors§