Skip to main content

Crate adk_memory

Crate adk_memory 

Source
Expand description

§adk-memory

Semantic memory and search for ADK agents.

§Overview

This crate provides long-term memory capabilities:

§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_user across 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 MemoryService to adk_core::Memory.
inmemory
migration
Lightweight, embedded migration runner for SQL-backed memory services.
service
text
Shared text extraction utilities for memory backends.