Skip to main content

SessionManager

Trait SessionManager 

Source
pub trait SessionManager: Send + Sync {
    // Required methods
    fn list(&self) -> BoxFuture<'_, Result<Vec<SessionMetadata>, AgentError>>;
    fn resume(
        &self,
        session_id: &str,
    ) -> BoxFuture<'_, Result<Session, AgentError>>;
    fn save(&self, session: &Session) -> BoxFuture<'_, Result<(), AgentError>>;
    fn delete(&self, session_id: &str) -> BoxFuture<'_, Result<(), AgentError>>;
    fn fork(
        &self,
        session_id: &str,
        new_name: Option<String>,
    ) -> BoxFuture<'_, Result<SessionMetadata, AgentError>>;
    fn rewind(
        &self,
        session_id: &str,
        turn_index: u32,
    ) -> BoxFuture<'_, Result<Session, AgentError>>;
    fn tag(
        &self,
        session_id: &str,
        tags: Vec<String>,
    ) -> BoxFuture<'_, Result<(), AgentError>>;
    fn rename(
        &self,
        session_id: &str,
        new_name: String,
    ) -> BoxFuture<'_, Result<(), AgentError>>;
}
Expand description

Manages session persistence and lifecycle operations.

All operations are async and return AgentError on failure.

Required Methods§

Source

fn list(&self) -> BoxFuture<'_, Result<Vec<SessionMetadata>, AgentError>>

List all sessions, ordered by most-recently updated first.

Source

fn resume(&self, session_id: &str) -> BoxFuture<'_, Result<Session, AgentError>>

Load a session by ID.

Source

fn save(&self, session: &Session) -> BoxFuture<'_, Result<(), AgentError>>

Save (create or update) a session.

Source

fn delete(&self, session_id: &str) -> BoxFuture<'_, Result<(), AgentError>>

Delete a session and all associated data.

Source

fn fork( &self, session_id: &str, new_name: Option<String>, ) -> BoxFuture<'_, Result<SessionMetadata, AgentError>>

Fork a session — create a copy with a new ID.

The forked session shares the same history up to the fork point but accumulates diverging state independently thereafter.

Source

fn rewind( &self, session_id: &str, turn_index: u32, ) -> BoxFuture<'_, Result<Session, AgentError>>

Rewind a session to a previous turn.

turn_index is zero-based. Messages beyond turn_index are discarded.

Source

fn tag( &self, session_id: &str, tags: Vec<String>, ) -> BoxFuture<'_, Result<(), AgentError>>

Add one or more tags to a session.

Source

fn rename( &self, session_id: &str, new_name: String, ) -> BoxFuture<'_, Result<(), AgentError>>

Rename a session.

Implementors§