Expand description
§adk-memory
Semantic memory and search for ADK agents.
§Overview
This crate provides long-term memory capabilities:
InMemoryMemoryService- Simple in-memory memory storageMemoryService- Trait for custom backendsMemoryEntry- Structured memory with metadataMemoryServiceAdapter- Bridge toadk_core::Memorywith optional project scopevalidate_project_id- Project identifier validation
§Quick Start
use adk_memory::InMemoryMemoryService;
let service = InMemoryMemoryService::new();
// Memory is automatically searched and injected
// when configured via LlmAgentBuilder::include_memory()§Project-Scoped Memory
Memories can be isolated by project within a user. The isolation key is
(app_name, user_id, project_id?):
- Global entries (
project_id = None): visible in all contexts. - Project entries (
project_id = Some(id)): visible only within that project. - Project search: returns global + matching project entries.
- Global search: returns only global entries.
ⓘ
use adk_memory::{InMemoryMemoryService, MemoryService, MemoryServiceAdapter};
use std::sync::Arc;
let service = Arc::new(InMemoryMemoryService::new());
// Store entries in a project
service.add_session_to_project("app", "user", "sess", "my-project", entries).await?;
// Adapter scoped to a project
let adapter = MemoryServiceAdapter::new(service, "app", "user")
.with_project_id("my-project");§Features
- Per-user and per-project memory isolation
- Semantic search queries
- Six backends: InMemory, SQLite, PostgreSQL, Redis, MongoDB, Neo4j
- Versioned schema migrations
- GDPR
delete_useracross all projects
Re-exports§
pub use adapter::MemoryServiceAdapter;pub use inmemory::InMemoryMemoryService;pub use service::MemoryEntry;pub use service::MemoryService;pub use service::SearchRequest;pub use service::SearchResponse;pub use service::validate_project_id;
Modules§
- adapter
- Adapter bridging
MemoryServicetoadk_core::Memory. - inmemory
- migration
- Lightweight, embedded migration runner for SQL-backed memory services.
- service
- text
- Shared text extraction utilities for memory backends.