Metadata-Version: 2.4
Name: memblock
Version: 0.10.0
Summary: Typed block tree + knowledge graph memory SDK for AI agents
Author-email: iexcalibur <shubhamkannojia10@gmail.com>
License: Proprietary
Project-URL: Homepage, https://memblock.xyz
Project-URL: Documentation, https://memblock.xyz
Project-URL: Repository, https://github.com/iexcalibur/memblock
Project-URL: Bug Tracker, https://github.com/iexcalibur/memblock/issues
Keywords: ai,memory,knowledge-graph,llm,agent
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: cryptography>=41.0
Provides-Extra: postgres
Requires-Dist: psycopg[binary]>=3.1; extra == "postgres"
Requires-Dist: asyncpg>=0.29; extra == "postgres"
Requires-Dist: pgvector>=0.3; extra == "postgres"
Provides-Extra: pool
Requires-Dist: psycopg_pool>=3.1; extra == "pool"
Provides-Extra: pgvector
Requires-Dist: pgvector>=0.3; extra == "pgvector"
Provides-Extra: tokens
Requires-Dist: tiktoken>=0.5; extra == "tokens"
Provides-Extra: llm
Requires-Dist: openai>=1.0; extra == "llm"
Requires-Dist: anthropic>=0.20; extra == "llm"
Requires-Dist: google-genai>=1.0; extra == "llm"
Provides-Extra: embeddings
Requires-Dist: fastembed>=0.3; extra == "embeddings"
Provides-Extra: embeddings-openai
Requires-Dist: httpx>=0.24; extra == "embeddings-openai"
Provides-Extra: embeddings-gemini
Requires-Dist: httpx>=0.24; extra == "embeddings-gemini"
Provides-Extra: llm-gemini
Requires-Dist: google-genai>=1.0; extra == "llm-gemini"
Provides-Extra: reranker-cohere
Requires-Dist: httpx>=0.24; extra == "reranker-cohere"
Provides-Extra: reranker-cross-encoder
Requires-Dist: sentence-transformers>=2.0; extra == "reranker-cross-encoder"
Provides-Extra: all-cloud
Requires-Dist: memblock[postgres]; extra == "all-cloud"
Requires-Dist: memblock[pool]; extra == "all-cloud"
Requires-Dist: memblock[pgvector]; extra == "all-cloud"
Requires-Dist: memblock[tokens]; extra == "all-cloud"
Requires-Dist: memblock[llm]; extra == "all-cloud"
Requires-Dist: memblock[embeddings-openai]; extra == "all-cloud"
Requires-Dist: memblock[embeddings-gemini]; extra == "all-cloud"
Requires-Dist: memblock[reranker-cohere]; extra == "all-cloud"
Provides-Extra: all
Requires-Dist: memblock[all-cloud]; extra == "all"
Requires-Dist: memblock[embeddings]; extra == "all"
Requires-Dist: memblock[reranker-cross-encoder]; extra == "all"
Provides-Extra: dev
Requires-Dist: pytest>=7.0; extra == "dev"
Requires-Dist: pytest-asyncio>=0.21; extra == "dev"
Requires-Dist: pytest-cov>=4.0; extra == "dev"
Requires-Dist: psycopg[binary]>=3.1; extra == "dev"
Requires-Dist: asyncpg>=0.29; extra == "dev"
Requires-Dist: pgvector>=0.3; extra == "dev"
Dynamic: license-file

<p align="center">
  <h1 align="center">MemBlock</h1>
  <p align="center"><strong>Structured memory SDK for AI agents.</strong></p>
  <p align="center">Typed blocks · Knowledge graph · Hybrid search · Encryption · Decay engine — all local, all yours.</p>
  <p align="center"><a href="https://memblock.xyz">memblock.xyz</a></p>
</p>

---

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

```bash
pip install memblock
```

## Quick Start

```python
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)

```python
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

```bash
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](https://memblock.xyz)**

## License

Proprietary. Copyright (c) 2025-2026 iexcalibur. All Rights Reserved.
