Skip to main content

SessionStore

Trait SessionStore 

Source
pub trait SessionStore:
    Send
    + Sync
    + Debug {
    // Required methods
    fn load<'a>(
        &'a self,
        id: &'a SessionId,
    ) -> BoxFuture<'a, Result<Vec<ChatMessage>, AgentError>>;
    fn save<'a>(
        &'a self,
        id: &'a SessionId,
        messages: &'a [ChatMessage],
    ) -> BoxFuture<'a, Result<(), AgentError>>;
}
Expand description

Persistence for session transcripts.

Transcripts exclude the system prompt: the agent rebuilds it on every run so memory and skills stay current. ChatMessage is Serialize, so a database implementation can store the transcript as one JSON column.

Required Methods§

Source

fn load<'a>( &'a self, id: &'a SessionId, ) -> BoxFuture<'a, Result<Vec<ChatMessage>, AgentError>>

Load a transcript. An unknown session is an empty transcript.

Source

fn save<'a>( &'a self, id: &'a SessionId, messages: &'a [ChatMessage], ) -> BoxFuture<'a, Result<(), AgentError>>

Replace a transcript.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§