Expand description
Persistence layer for sessions, embeddings, artifacts, and executions.
This module defines four storage trait abstractions:
SessionStore: CRUD for conversation sessions and message historyEmbeddingStore: Vector persistence and nearest-neighbor searchArtifactStore: Binary blob storage for files and attachmentsExecutionStore: 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.
- Compaction
Meta - Metadata attached to compaction-related messages.
- Embedding
Record - Embedding record with a dense vector and associated metadata.
- Message
Record - Persisted message exchange within a session.
- Pagination
- Pagination parameters for paginated list operations.
- Scored
Embedding - Embedding search result pairing a matching record with its similarity score.
- Session
- Persisted conversation session metadata.
- Session
Filter - Filter parameters for listing sessions.
- Session
Stats - Pre-computed or live-aggregated statistics for a session.
- Tool
Execution - Persisted record of a single tool invocation.
- Usage
Record - Detailed token usage record for a single provider interaction.
Enums§
- Message
Role - Role tag for a persisted message.
- Tool
Execution Status - Outcome of a tool execution.
Traits§
- Artifact
Store - Stores binary artifacts such as files, images, and attachments.
- Embedding
Store - Persists embedding vectors and supports nearest-neighbor search.
- Execution
Store - Persists tool execution records and token usage, and provides session analytics.
- Session
Store - Persists conversation sessions and their message history.
Type Aliases§
- Store
Result - Convenience result alias for storage operations using
StorageError.