behest-store 0.5.5

Persistence traits and storage backends for the behest agent runtime
Documentation

Persistence layer for sessions, embeddings, artifacts, and executions.

This module defines four storage trait abstractions:

  • [SessionStore]: CRUD for conversation sessions and message history
  • [EmbeddingStore]: Vector persistence and nearest-neighbor search
  • [ArtifactStore]: Binary blob storage for files and attachments
  • [ExecutionStore]: Tool execution records, token usage tracking, and session stats

Each trait has an in-memory implementation (always available) and feature-gated backend implementations for SQL databases, MongoDB, SurrealDB, Redis, Qdrant, and object stores.

Example

use behest_provider::{ContentPart, ModelName};
use behest_store::memory::MemorySessionStore;
use behest_store::{MessageRecord, MessageRole, Session, SessionStore};
use uuid::Uuid;

# async fn example() -> Result<(), behest_core::error::StorageError> {
let store = MemorySessionStore::new();

let session = Session::new("My Chat", ModelName::new("gpt-4"));
let session = store.create_session(session).await?;

let message = MessageRecord::new(
    session.id,
    MessageRole::User,
    vec![ContentPart::text("Hello!")],
);
store.append_message(message).await?;
# Ok(())
# }