[ STRUCTURED MEMORY SDK FOR AI AGENTS ]

Memory that agents can actually reason over.

Give your AI agents persistent, structured memory they can store, query, and build context from — without external infrastructure or per-call LLM costs.

V0.4.0 — NOW AVAILABLE
DOCUMENTATION

Core Capabilities

Everything an agent needs to remember

Six foundational primitives that give your AI agents structured, searchable, and secure long-term memory.

Typed Memory Blocks

5 structured types — FACT, PREFERENCE, EVENT, ENTITY, RELATION. Schema-validated, not untyped text blobs.

Per-Block Encryption

AES-256 with three levels: NONE, STANDARD, SENSITIVE. Encrypt what matters, leave the rest fast.

Knowledge Graph

Built-in graph index with link, traverse, and neighbor queries. No Neo4j or external graph DB required.

Memory Decay Engine

Exponential decay with configurable rates. Prune weak memories, surface the strongest automatically.

Tamper Detection

SHA-256 hash-chained operation log. One call to verify() catches any unauthorized modification.

NEW

Async + Event Hooks

Full async API via AsyncMemBlock. Lifecycle hooks for on_add, on_update, on_delete, on_query.

Quickstart

Get started in three lines of Python.

Install from PyPI. Create a MemBlock instance. Store your first memory. No API keys, no configuration files, no setup wizard.

VIEW ON GITHUB

[ PYTHON REPL ]

$ pip install memblock
>>> from memblock import MemBlock, BlockType
>>> mem = MemBlock(storage="sqlite:///memory.db")
>>> mem.store("User prefers dark mode", type=BlockType.PREFERENCE)
Block(id='blk_7f2a', type=PREFERENCE, confidence=1.0)
>>> mem.query(text_search="dark mode")
[Block(id='blk_7f2a', content='User prefers dark mode')]
>>> mem.build_context(query="user preferences", token_budget=2000)
'[PREFERENCE] User prefers dark mode (confidence: 1.00)'

READY