Skip to main content

HY Memory - Intelligent hierarchical memory system for LLM agents

Project description

HY Memory

Intelligent hierarchical memory system for LLM agents.

HY Memory provides a production-grade memory layer for AI agents with LLM-driven extraction, semantic search, multi-layer knowledge representation, and graph-based schema inference.

Features

  • 7-Layer Memory Architecture — From raw facts (L1) to behavioral schemas (L6) and intentions (L7)
  • LLM-Driven Extraction — Automatically extracts structured memories from conversations
  • Semantic Search — Vector similarity search across all memory layers
  • Graph Knowledge — Neo4j/Kuzu graph store for schema and intention inference (System 2)
  • Evolution Chains — Tracks how memories evolve over time via supersedes links
  • Multiple Backends — Qdrant, ChromaDB, FAISS for vectors; Neo4j, Kuzu for graphs
  • OpenAI-Compatible — Works with any LLM that supports the OpenAI API format (DeepSeek, Qwen, Claude, etc.)

Quick Start

pip install hy-memory
from hy_memory import HyMemoryClient

client = HyMemoryClient(mode="lite")

# Write
client.add("I love sci-fi movies, especially Interstellar", user_id="user_1")

# Search
results = client.search("What movies does the user like?", user_id="user_1")
for mem in results["memories"]:
    print(f"  [{mem['score']:.2f}] {mem['content']}")

client.close()

Configuration

HY Memory is configured via environment variables. Minimal setup:

export MEMORY_LLM_API_KEY="sk-your-key"
export MEMORY_LLM_BASE_URL="https://api.deepseek.com"   # or any OpenAI-compatible endpoint
export MEMORY_LLM_MODEL="deepseek-chat"

export MEMORY_EMBEDDER_API_KEY="sk-your-key"
export MEMORY_EMBEDDER_BASE_URL="https://api.openai.com/v1"
export MEMORY_EMBEDDER_MODEL="text-embedding-3-small"

Or copy .env.example and fill in your values:

cp .env.example .env

See docs/env_reference.md for all available options.

Modes

Mode Layers Graph Best For
lite L0-L4 (facts + identity) No Simple chatbots, quick setup
pro L0-L5 (+ knowledge) Optional Knowledge-heavy applications
ultra L0-L7 (+ schema + intention) Yes Full cognitive architecture

Vector Store Backends

Backend Install Config
ChromaDB (default) included MEMORY_VECTOR_STORE=chroma
Qdrant pip install hy-memory[qdrant] MEMORY_VECTOR_STORE=qdrant
FAISS pip install hy-memory[faiss] MEMORY_VECTOR_STORE=faiss

Graph Store Backends (Ultra mode)

Backend Install Config
Kuzu (default) included MEMORY_GRAPH_PROVIDER=kuzu
Neo4j pip install hy-memory[graph] MEMORY_GRAPH_PROVIDER=neo4j

Documentation

License

MIT License. See LICENSE for details.

Project details


Download files

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

Source Distribution

hy_memory-1.0.0.tar.gz (319.8 kB view details)

Uploaded Source

Built Distribution

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

hy_memory-1.0.0-py3-none-any.whl (357.9 kB view details)

Uploaded Python 3

File details

Details for the file hy_memory-1.0.0.tar.gz.

File metadata

  • Download URL: hy_memory-1.0.0.tar.gz
  • Upload date:
  • Size: 319.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.11

File hashes

Hashes for hy_memory-1.0.0.tar.gz
Algorithm Hash digest
SHA256 1885db5f0d082cf9284cb52e6804af3fc5ec58cae42ad73b4c118ef6cbb4b3ef
MD5 936075a3cfb86d3febf4eeee928daa54
BLAKE2b-256 2bac43fb7f89a620a3739d821cc5d4ec513762d467f160e016cb2e9bd6eddbc1

See more details on using hashes here.

File details

Details for the file hy_memory-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: hy_memory-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 357.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.11

File hashes

Hashes for hy_memory-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 71dadaa05fb2a4b8fcc6cce83e1e0b7772e8cd2eddafc788abd6353617b193d8
MD5 fcec7039039a14e29da4bb749c6b289c
BLAKE2b-256 110b4a7e5acb9142866173338b9d222abeb4532dc8e37e5315c2ecfb77005cfd

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page