adk-memory
Semantic memory and search for Rust Agent Development Kit (ADK-Rust) agents.
Overview
adk-memory provides long-term memory capabilities for the Rust Agent Development Kit (ADK-Rust):
- InMemoryMemoryService - Simple in-memory memory storage
- SqliteMemoryService - SQLite-backed persistence (
sqlite-memoryfeature) - PostgresMemoryService - PostgreSQL + pgvector persistence (
database-memoryfeature) - MongoMemoryService - MongoDB-backed persistence (
mongodb-memoryfeature) - Neo4jMemoryService - Neo4j-backed persistence (
neo4j-memoryfeature) - RedisMemoryService - Redis-backed persistence (
redis-memoryfeature) - MemoryService - Trait for custom storage backends
- Semantic Search - Query memories by content similarity
- Schema Migrations - Versioned, forward-only migrations for all database backends
Installation
[]
= "0.4"
Or use the meta-crate:
[]
= { = "0.4", = ["memory"] }
Quick Start
use ;
use Content;
use Utc;
let service = new;
let entries = vec!;
service.add_session.await?;
let response = service.search.await?;
for memory in response.memories
Feature Flags
| Feature | Backend | Description |
|---|---|---|
sqlite-memory |
SQLite | Single-node persistence via sqlx |
database-memory |
PostgreSQL | pgvector-backed semantic search |
redis-memory |
Redis | Low-latency in-memory persistence via fred |
mongodb-memory |
MongoDB | Document-oriented persistence |
neo4j-memory |
Neo4j | Graph database persistence |
# SQLite
= { = "0.4", = ["sqlite-memory"] }
# PostgreSQL + pgvector
= { = "0.4", = ["database-memory"] }
Schema Migrations
All database backends (SQLite, PostgreSQL, MongoDB, Neo4j) include a versioned migration system. Migrations are forward-only, idempotent, and tracked in a _schema_migrations registry table.
use SqliteMemoryService;
let service = new.await?;
// Run all pending migrations
service.migrate.await?;
// Check current schema version
let version = service.schema_version.await?;
println!;
MemoryService Trait
Related Crates
- adk-rust - Meta-crate with all components
- adk-core - Core
Memorytrait - adk-runner - Memory injection during execution
- adk-rag - RAG pipeline with vector stores
License
Apache-2.0
Part of ADK-Rust
This crate is part of the ADK-Rust framework for building AI agents in Rust.