Typed block tree + knowledge graph memory SDK for AI agents
Project description
MemBlock
Structured memory SDK for AI agents.
Typed blocks · Knowledge graph · Hybrid search · Encryption · Decay engine — all local, all yours.
AI agents forget everything between sessions. Vector databases give you search but no structure. Cloud memory APIs lock you in and store your users' data on someone else's servers. MemBlock is the alternative: typed memory blocks, a built-in knowledge graph, hybrid search, encryption, and intelligent decay — all running on your infrastructure with pip install and one line of Python. No Docker, no Neo4j, no subscriptions. Your data never leaves your machine.
Install
pip install memblock
Quick Start
from memblock import MemBlock, BlockType
mem = MemBlock(storage="sqlite:///memory.db")
# Store structured memories
mem.store("User prefers Python", type=BlockType.PREFERENCE)
mem.store("User works at Acme Corp", type=BlockType.FACT, confidence=0.95)
# Query with hybrid search
results = mem.query(text_search="programming", type=BlockType.PREFERENCE)
# Build LLM-ready context
context = mem.build_context(query="user preferences", token_budget=4000)
# Knowledge graph
mem.link(results[0].id, other.id, relation="related_to")
# Tamper detection
mem.verify()
Async (asyncio)
from memblock import AsyncMemBlock, BlockType
# Native asyncpg path — non-blocking storage I/O
mem = AsyncMemBlock(storage="postgresql+asyncpg://user@host/db")
await mem.store("User prefers Python", type=BlockType.PREFERENCE)
results = await mem.query(text_search="programming", limit=10)
# Multi-tenant isolation: each tenant gets its own Postgres schema.
mem = AsyncMemBlock(
storage="postgresql+asyncpg://user@host/db",
schema="tenant_xyz", # bootstraps + isolates on first use
)
AsyncMemBlock accepts plain postgresql:// URLs too — those use the legacy thread-pool wrapper. Use postgresql+asyncpg:// to opt into the native async backend.
Optional Extras
pip install "memblock[postgres]" # PostgreSQL backend (sync + async + pgvector)
pip install "memblock[embeddings]" # Local vector embeddings (FastEmbed)
pip install "memblock[llm]" # LLM extraction (OpenAI, Anthropic, Gemini)
pip install "memblock[reranker-cohere]" # Cohere reranker
pip install "memblock[reranker-cross-encoder]" # HuggingFace reranker
pip install "memblock[all-cloud]" # Everything without onnxruntime (Python 3.13+)
pip install "memblock[all]" # Everything including local embeddings
Documentation
Full docs, API reference, and examples: memblock.xyz
License
Proprietary. Copyright (c) 2025-2026 iexcalibur. All Rights Reserved.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file memblock-0.10.1.tar.gz.
File metadata
- Download URL: memblock-0.10.1.tar.gz
- Upload date:
- Size: 168.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9995938e16ea013a00e9c1beec5fd350b9266ff82d85a2f6c23c8c9c5adf196f
|
|
| MD5 |
b69f7db4fa3e1b3b037842738e85937f
|
|
| BLAKE2b-256 |
a707fe8dd3ccb323bfc22e2c694bf36cfd5c5671bbffce1bdf7abc4a9908cc2d
|
File details
Details for the file memblock-0.10.1-py3-none-any.whl.
File metadata
- Download URL: memblock-0.10.1-py3-none-any.whl
- Upload date:
- Size: 136.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
759abcb5936ddc869e252991ba40f03923f726d4aac2cb40e38e4a6f366699fe
|
|
| MD5 |
3af9c6656be3a1426381c61c3e3b1a89
|
|
| BLAKE2b-256 |
dd60c9776f33a69edf99e90ee9474a42754721a1a5c1ca5842be165e0153b207
|