pub trait SessionStore: Send + Sync {
// Required methods
fn save<'life0, 'life1, 'async_trait>(
&'life0 self,
session: &'life1 AgentSession,
) -> Pin<Box<dyn Future<Output = AgentResult<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn load<'life0, 'life1, 'async_trait>(
&'life0 self,
session_id: &'life1 SessionId,
) -> Pin<Box<dyn Future<Output = AgentResult<Option<AgentSession>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn list<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = AgentResult<Vec<SessionId>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn delete<'life0, 'life1, 'async_trait>(
&'life0 self,
session_id: &'life1 SessionId,
) -> Pin<Box<dyn Future<Output = AgentResult<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
// Provided method
fn append_event<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_session_id: &'life1 SessionId,
_event: &'life2 RuntimeEvent,
) -> Pin<Box<dyn Future<Output = AgentResult<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait { ... }
}Expand description
Session Persistence Adapter
SessionStore is an optional persistence interface for agent sessions.
Under the lightweight kernel design:
AgentRuntime.sessionsis the authoritative live state during executionSessionStoreis a persistence adapter for save/load/list/delete- Does not participate in the execution control flow
Replace the default InMemorySessionStore with a custom implementation
to persist sessions to a database, filesystem, or other storage.
Required Methods§
Sourcefn save<'life0, 'life1, 'async_trait>(
&'life0 self,
session: &'life1 AgentSession,
) -> Pin<Box<dyn Future<Output = AgentResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn save<'life0, 'life1, 'async_trait>(
&'life0 self,
session: &'life1 AgentSession,
) -> Pin<Box<dyn Future<Output = AgentResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Save a session snapshot to the persistence layer
Sourcefn load<'life0, 'life1, 'async_trait>(
&'life0 self,
session_id: &'life1 SessionId,
) -> Pin<Box<dyn Future<Output = AgentResult<Option<AgentSession>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn load<'life0, 'life1, 'async_trait>(
&'life0 self,
session_id: &'life1 SessionId,
) -> Pin<Box<dyn Future<Output = AgentResult<Option<AgentSession>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Load a session from the persistence layer
Provided Methods§
Sourcefn append_event<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_session_id: &'life1 SessionId,
_event: &'life2 RuntimeEvent,
) -> Pin<Box<dyn Future<Output = AgentResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn append_event<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_session_id: &'life1 SessionId,
_event: &'life2 RuntimeEvent,
) -> Pin<Box<dyn Future<Output = AgentResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Optionally persist a runtime event for audit/replay. Default implementation is a no-op — override to implement append-log style persistence (e.g. JSONL file, database event log).
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".