Skip to main content

Crate behest_store

Crate behest_store 

Source
Expand description

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, Redis, and object stores.

§Example

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

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?;

Modules§

memory
In-memory storage implementations for testing, development, and prototyping.

Structs§

Artifact
Binary artifact stored by the agent runtime, such as files, images, or attachments.
CompactionMeta
Metadata attached to compaction-related messages.
EmbeddingRecord
Embedding record with a dense vector and associated metadata.
MessageRecord
Persisted message exchange within a session.
Pagination
Pagination parameters for paginated list operations.
ScoredEmbedding
Embedding search result pairing a matching record with its similarity score.
Session
Persisted conversation session metadata.
SessionFilter
Filter parameters for listing sessions.
SessionStats
Pre-computed or live-aggregated statistics for a session.
ToolExecution
Persisted record of a single tool invocation.
UsageRecord
Detailed token usage record for a single provider interaction.

Enums§

MessageRole
Role tag for a persisted message.
ToolExecutionStatus
Outcome of a tool execution.

Traits§

ArtifactStore
Stores binary artifacts such as files, images, and attachments.
EmbeddingStore
Persists embedding vectors and supports nearest-neighbor search.
ExecutionStore
Persists tool execution records and token usage, and provides session analytics.
SessionStore
Persists conversation sessions and their message history.

Type Aliases§

StoreResult
Convenience result alias for storage operations using StorageError.