Typed Memory Blocks
5 structured types — FACT, PREFERENCE, EVENT, ENTITY, RELATION. Schema-validated, not untyped text blobs.
[ STRUCTURED MEMORY SDK FOR AI AGENTS ]
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 AVAILABLECore Capabilities
Six foundational primitives that give your AI agents structured, searchable, and secure long-term memory.
5 structured types — FACT, PREFERENCE, EVENT, ENTITY, RELATION. Schema-validated, not untyped text blobs.
AES-256 with three levels: NONE, STANDARD, SENSITIVE. Encrypt what matters, leave the rest fast.
Built-in graph index with link, traverse, and neighbor queries. No Neo4j or external graph DB required.
Exponential decay with configurable rates. Prune weak memories, surface the strongest automatically.
SHA-256 hash-chained operation log. One call to verify() catches any unauthorized modification.
Full async API via AsyncMemBlock. Lifecycle hooks for on_add, on_update, on_delete, on_query.
Quickstart
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