pub struct SqliteStore { /* private fields */ }sqlite only.Expand description
Single-file SQLite-backed implementation of every SDK store trait.
See the module docs for resume semantics and a wiring example.
Cloning shares the same single Arc<Mutex<Connection>> (not a pool), so a
clone handed to the agent builder observes everything the kept handle
records (and vice versa); all database calls serialize on that one mutex.
Implementations§
Source§impl SqliteStore
impl SqliteStore
Sourcepub fn open(path: impl AsRef<Path>) -> Result<Self>
pub fn open(path: impl AsRef<Path>) -> Result<Self>
Open (creating if absent) the SQLite database at path and ensure the
store schema exists.
Reopening an existing file is the resume path: the schema creation is a no-op and all previously persisted rows remain available.
This constructor is synchronous — it opens the file, converts it to
WAL, and applies the schema on the calling thread (waiting up to five
seconds if another process holds the write lock). Call it during
startup, or wrap it in spawn_blocking on a latency-sensitive async
runtime.
§Errors
Returns an error if the database cannot be opened, the schema cannot be initialized, or the file carries a schema version newer than this SDK understands.
Trait Implementations§
Source§impl Clone for SqliteStore
impl Clone for SqliteStore
Source§fn clone(&self) -> SqliteStore
fn clone(&self) -> SqliteStore
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl EventStore for SqliteStore
impl EventStore for SqliteStore
Source§fn append<'life0, 'life1, 'async_trait>(
&'life0 self,
thread_id: &'life1 ThreadId,
turn: usize,
envelope: AgentEventEnvelope,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn append<'life0, 'life1, 'async_trait>(
&'life0 self,
thread_id: &'life1 ThreadId,
turn: usize,
envelope: AgentEventEnvelope,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§fn finish_turn<'life0, 'life1, 'async_trait>(
&'life0 self,
thread_id: &'life1 ThreadId,
turn: usize,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn finish_turn<'life0, 'life1, 'async_trait>(
&'life0 self,
thread_id: &'life1 ThreadId,
turn: usize,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§fn get_turn<'life0, 'life1, 'async_trait>(
&'life0 self,
thread_id: &'life1 ThreadId,
turn: usize,
) -> Pin<Box<dyn Future<Output = Result<Option<StoredTurnEvents>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_turn<'life0, 'life1, 'async_trait>(
&'life0 self,
thread_id: &'life1 ThreadId,
turn: usize,
) -> Pin<Box<dyn Future<Output = Result<Option<StoredTurnEvents>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§fn get_turns<'life0, 'life1, 'async_trait>(
&'life0 self,
thread_id: &'life1 ThreadId,
) -> Pin<Box<dyn Future<Output = Result<Vec<StoredTurnEvents>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_turns<'life0, 'life1, 'async_trait>(
&'life0 self,
thread_id: &'life1 ThreadId,
) -> Pin<Box<dyn Future<Output = Result<Vec<StoredTurnEvents>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§fn get_events<'life0, 'life1, 'async_trait>(
&'life0 self,
thread_id: &'life1 ThreadId,
) -> Pin<Box<dyn Future<Output = Result<Vec<AgentEventEnvelope>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_events<'life0, 'life1, 'async_trait>(
&'life0 self,
thread_id: &'life1 ThreadId,
) -> Pin<Box<dyn Future<Output = Result<Vec<AgentEventEnvelope>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§fn event_count<'life0, 'life1, 'async_trait>(
&'life0 self,
thread_id: &'life1 ThreadId,
) -> Pin<Box<dyn Future<Output = Result<usize>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn event_count<'life0, 'life1, 'async_trait>(
&'life0 self,
thread_id: &'life1 ThreadId,
) -> Pin<Box<dyn Future<Output = Result<usize>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
thread_id without materializing them. Read moreSource§fn get_events_since<'life0, 'life1, 'async_trait>(
&'life0 self,
thread_id: &'life1 ThreadId,
offset: usize,
) -> Pin<Box<dyn Future<Output = Result<Vec<AgentEventEnvelope>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_events_since<'life0, 'life1, 'async_trait>(
&'life0 self,
thread_id: &'life1 ThreadId,
offset: usize,
) -> Pin<Box<dyn Future<Output = Result<Vec<AgentEventEnvelope>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
thread_id from offset onward, in overall
append order, skipping the earlier ones. Read moreSource§impl MessageStore for SqliteStore
impl MessageStore for SqliteStore
Source§fn append<'life0, 'life1, 'async_trait>(
&'life0 self,
thread_id: &'life1 ThreadId,
message: Message,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn append<'life0, 'life1, 'async_trait>(
&'life0 self,
thread_id: &'life1 ThreadId,
message: Message,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§fn get_history<'life0, 'life1, 'async_trait>(
&'life0 self,
thread_id: &'life1 ThreadId,
) -> Pin<Box<dyn Future<Output = Result<Vec<Message>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_history<'life0, 'life1, 'async_trait>(
&'life0 self,
thread_id: &'life1 ThreadId,
) -> Pin<Box<dyn Future<Output = Result<Vec<Message>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§fn clear<'life0, 'life1, 'async_trait>(
&'life0 self,
thread_id: &'life1 ThreadId,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn clear<'life0, 'life1, 'async_trait>(
&'life0 self,
thread_id: &'life1 ThreadId,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§fn count<'life0, 'life1, 'async_trait>(
&'life0 self,
thread_id: &'life1 ThreadId,
) -> Pin<Box<dyn Future<Output = Result<usize>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn count<'life0, 'life1, 'async_trait>(
&'life0 self,
thread_id: &'life1 ThreadId,
) -> Pin<Box<dyn Future<Output = Result<usize>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§fn replace_history<'life0, 'life1, 'async_trait>(
&'life0 self,
thread_id: &'life1 ThreadId,
messages: Vec<Message>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn replace_history<'life0, 'life1, 'async_trait>(
&'life0 self,
thread_id: &'life1 ThreadId,
messages: Vec<Message>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§impl StateStore for SqliteStore
impl StateStore for SqliteStore
Source§fn save<'life0, 'life1, 'async_trait>(
&'life0 self,
state: &'life1 AgentState,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn save<'life0, 'life1, 'async_trait>(
&'life0 self,
state: &'life1 AgentState,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§impl ToolExecutionStore for SqliteStore
impl ToolExecutionStore for SqliteStore
Source§fn get_execution<'life0, 'life1, 'async_trait>(
&'life0 self,
tool_call_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<ToolExecution>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_execution<'life0, 'life1, 'async_trait>(
&'life0 self,
tool_call_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<ToolExecution>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
tool_call_id. Read moreSource§fn record_execution<'life0, 'async_trait>(
&'life0 self,
execution: ToolExecution,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn record_execution<'life0, 'async_trait>(
&'life0 self,
execution: ToolExecution,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Source§fn update_execution<'life0, 'async_trait>(
&'life0 self,
execution: ToolExecution,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn update_execution<'life0, 'async_trait>(
&'life0 self,
execution: ToolExecution,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
operation_id). Read moreSource§fn get_execution_by_operation_id<'life0, 'life1, 'async_trait>(
&'life0 self,
operation_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<ToolExecution>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_execution_by_operation_id<'life0, 'life1, 'async_trait>(
&'life0 self,
operation_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<ToolExecution>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
operation_id (for async tool resume). Read more