microagents-storage 0.1.0

Session storage layer for the microagents framework
Documentation

microagents-storage

Session storage layer for the microagents framework.

Overview

This crate provides pluggable backends for persisting and retrieving agent session events. All backends implement the AgentStorage trait, which defines three core operations:

  • create_session – persist the initial event that starts a new session
  • update_session – append an event to an existing session
  • get_session – retrieve all events for a given session, ordered by time

Backends

Backend Module Persistence
In-Memory memory Ephemeral (data lost on process exit)
JSON Lines jsonl One .jsonl file per session in ~/.microagents/sessions
SQLite sqlite Single SQLite database at ~/.microagents/sessions.db

Backend selection is controlled by AgentStorageChoice.

Usage

use microagents_storage::{sqlite::SqliteAgentStorage, types::AgentStorage};

let storage = SqliteAgentStorage::new(None).await?;
storage.create_session(init_event).await?;
storage.update_session(event).await?;
let events = storage.get_session("session-id").await?;

License

MIT