Skip to main content

Memotrix

Composable hybrid memory and RAG for AI agents.

Memotrix lets an agent remember files and free-text facts the same way LangChain-style tools compose: pick embeddings, pick a store, then add / search / delete. It is a Python library — not an LLM, not a chat UI, and not a hosted service.

It chunks documents, stores dense vectors (semantic) plus a keyword index (BM25 or Postgres full-text), and retrieves a small context window with hybrid search, optional rerank, and neighbor expansion.


Why use it

You need Memotrix does
Agent long-term memory add_text for facts, chat turns, procedures (semantic / episodic / procedural)
RAG over files add("report.pdf") then search("what is the revenue?")
Hybrid retrieval Dense (HNSW or pgvector) + sparse (BM25 or Postgres tsvector), fused with RRF
Tight context Default top_k=3 and neighbor-window expansion, not five full files
No silent secrets You pass the embedding model and DSN. Nothing is defaulted.

Install

Python 3.10+. A bare pip install memotrix only installs python-dotenv. Use an extra:

pip install memotrix[memory]

Postgres + file extractors:

pip install memotrix[postgres,memory,extractors]
Extra Enables
memory in-process HNSW + BM25 + Sentence-Transformers (minimum to construct Memory)
local HNSW + BM25
embeddings HuggingFace / Sentence-Transformers
postgres PostgreSQL + pgvector
extractors PDF, Office, HTML, CSV, images, RDF, …
openai OpenAI embeddings and vision
audio Whisper transcription
all everything above

Quick start

from memotrix import Memory
from memotrix.embeddings import HuggingFaceEmbeddings
from memotrix.vectorstores import InMemoryStore

embeddings = HuggingFaceEmbeddings(model="BAAI/bge-small-en-v1.5")
memory = Memory(embeddings=embeddings, store=InMemoryStore(embeddings))

memory.add_text("User prefers dark mode.", memory_type="semantic", source_id="prefs")
hits = memory.search("what theme does the user want?", top_k=3)
memory.delete("prefs")
memory.close()

Files:

memory.add("report.pdf")
hits = memory.search("what is the revenue?", memory_type="semantic")
print(memory.list_sources())

Postgres:

import os
from memotrix.vectorstores import PostgresStore

embeddings = HuggingFaceEmbeddings(model=os.environ["EMBEDDING_MODEL"])
memory = Memory(
    embeddings=embeddings,
    store=PostgresStore(connection=os.environ["DATABASE_URL"], embeddings=embeddings),
)

Or from the environment (EMBEDDING_MODEL required; DATABASE_URL when MEMOTRIX_BACKEND=postgres):

from memotrix import Memory
memory = Memory.from_env()

Agent memory

memory.add_text("Shipped hybrid search.", memory_type="episodic", session_id="2026-09-03")
memory.add_text("Always cite source_path.", memory_type="procedural")
memory.search("how should answers be cited?", memory_type="procedural")

session_id and memory_type are exact-match payload filters.


What it can ingest

PDF, DOCX, PPTX, TXT, Markdown, HTML, EPUB, CSV, Excel (.xlsx), JSON (FHIR / GeoJSON / chat sniff), YAML, XML, SQL, images, video, audio ([audio]), source code, SCORM, knowledge graphs, GeoJSON, email (.eml / .mbox), chat exports, and .log files.

Generic .zip and BIFF .xls are not supported. Convert spreadsheets to .xlsx.

Plug in your own extractor:

memory = Memory(embeddings=embeddings, extract_file=my_extractor)

Links

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

memotrix-0.1.0.tar.gz (86.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

memotrix-0.1.0-py3-none-any.whl (93.2 kB view details)

Uploaded Python 3

File details

Details for the file memotrix-0.1.0.tar.gz.

File metadata

  • Download URL: memotrix-0.1.0.tar.gz
  • Upload date:
  • Size: 86.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.14.6

File hashes

Hashes for memotrix-0.1.0.tar.gz
Algorithm Hash digest
SHA256 0ed1ce018682d325b378afd1aa4aebfca30214d9d897f2530d1847773a669c16
MD5 95f180cfefc59304936ab25831d0ff3b
BLAKE2b-256 2ac3a8eb8a13dc4b3e16b2e12853fa1a18eeaf5bc49089b1cb098a81c2845d01

See more details on using hashes here.

File details

Details for the file memotrix-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: memotrix-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 93.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.14.6

File hashes

Hashes for memotrix-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 78be1566472d4743a298722b2085ac04a45395c8b8157268853b0522c182723d
MD5 664593c2ef98d727db147b47771ffb08
BLAKE2b-256 6bd25baf4c4edd8790842c9d5153089a711ea0890f4ac2f614fef7274915dd0b

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page