Storage Overview

Storage taxonomy, trait matrix, feature-flag backends, and the RuntimeStore facade.

Storage

The pluggable persistence layer.

behest defines four store traits plus a RunStore trait, each with multiple feature-gated backends. A RuntimeStore facade composes them into a single handle for the runtime.

Trait matrix

TraitPurposeKey methods
SessionStoreSession CRUD + message historycreate_session, append_message, list_messages, get_latest_compaction
EmbeddingStoreVector persistence + searchupsert, search, delete_by_session
ExecutionStoreTool execution + token usage + session statsrecord_execution, record_usage, session_stats
ArtifactStoreBinary file storageput, get, list_by_session
RunStoreEvent-sourced run lifecyclecreate_run, append_event, list_events, get_run_state

Backend matrix

BackendSessionEmbeddingExecutionArtifactRunFeature
Memory(default)
Redisredis
SQLx PostgreSQLsqlx-postgres
SQLx MySQLsqlx-mysql
SQLx SQLitesqlx-sqlite
MongoDBmongodb
SurrealDBsurrealdb
Qdrantqdrant
Object (S3/Disk)object_store

RuntimeStore facade

RuntimeStore composes the individual stores into a single handle. The runtime accesses stores by name through the Extensions facade:

pub struct RuntimeStore {
    session: Arc<ExtensionPoint<dyn SessionStore>>,
    execution: Arc<ExtensionPoint<dyn ExecutionStore>>,
    run: Arc<ExtensionPoint<dyn RunStore>>,
    embedding: Option<Arc<ExtensionPoint<dyn EmbeddingStore>>>,
    artifact: Option<Arc<ExtensionPoint<dyn ArtifactStore>>>,
}

impl RuntimeStore {
    pub fn from_extensions(ext: &Extensions) -> Self;
    pub fn session(&self, name: &str) -> Option<Arc<dyn SessionStore>>;
    pub fn execution(&self, name: &str) -> Option<Arc<dyn ExecutionStore>>;
    pub fn run(&self, name: &str) -> Option<Arc<dyn RunStore>>;
}

See also

Related components

Edit this page on GitHub →