Skip to main content

Universal memory engine for AI bots. 3 layers: Redis (Hot) + Qdrant (Warm) + Neo4j (Cold). FZ-152 compliant.

Project description

Memory Core SDK

Universal memory engine for AI bots. 3 layers: Redis (Hot) + Qdrant (Warm) + Neo4j (Cold).

FZ-152 compliant — all personal data stored in Russia.

Quick Start

pip install memorycore-ai
from memory_core import MemoryClient

memory = MemoryClient("mc_live_...")

# Bot remembers
memory.upsert(user_id="user_42", content="Люблю итальянскую кухню")

# Bot recalls
ctx = memory.context(user_id="user_42", query="что заказать на ужин?")
# → Hot: fresh messages
# → Warm: "итальянская кухня" (score: 0.82)
# → Cold: user knowledge graph

Async (for aiogram, FastAPI)

pip install memorycore-ai[async]
from memory_core import AsyncMemoryClient

memory = AsyncMemoryClient("mc_live_...", bot_id="my_bot")

await memory.upsert(user_id="user_42", content="Предпочитает SPA")
ctx = await memory.context(user_id="user_42", query="что предложить?")

API Methods

Core

Method Description
upsert(user_id, content) Save to memory (Hot+Warm+Cold)
context(user_id, query) Retrieve relevant context
remember(user_id, fact) Shortcut: save a fact
recall(user_id, query) Shortcut: semantic search
summarize(user_id) Summarize session into episode
profile(user_id) Full user profile
health() API health check

New in v0.5.0 (Soft Delete)

Method Description
forget(episode_id or user_id) Soft delete to trash (30-day retention)
trash(user_id) View deleted records in trash
restore(episode_ids or user_id) Restore from trash
purge(user_id) Permanently delete (IRREVERSIBLE)

New in v0.4.2

Method Description
search(user_id, query) Semantic search with filters
delete(user_id, memory_id) Delete memory entries
usage() API usage & rate limits
export_data(user_id) Export user data (GDPR/FZ-152)
import_data(user_id, records) Bulk import records
regenerate_key() Regenerate API key

Examples

Semantic Search

results = memory.search(
    user_id="user_42",
    query="итальянская еда",
    limit=5,
    memory_type="fact"
)
for item in results["results"]:
    print(f"{item['content']} (score: {item['score']:.2f})")

Check Usage & Limits

usage = memory.usage()
print(f"Plan: {usage['plan']}")
print(f"Used: {usage['used']}/{usage['limit']}")
print(f"Remaining: {usage['remaining']}")

Delete Memory

# Delete specific entry
memory.delete(user_id="user_42", memory_id="uuid-here")

# Delete all facts
memory.delete(user_id="user_42", memory_type="fact")

# Delete ALL user data
memory.delete(user_id="user_42", delete_all=True)

Soft Delete (v0.5.0)

Soft Delete - safe deletion with 30-day recovery window.

# Soft delete one record (move to trash for 30 days)
memory.forget(episode_id="uuid-record")

# Soft delete ALL user records (move to trash for 30 days)
memory.forget(user_id="user_42")

# View trash - see deleted records with remaining retention days
trash = memory.trash(user_id="user_42")
for item in trash["trash"]:
    print(f"ID: {item['id']}, Days left: {item['days_remaining']}")

# Restore from trash
memory.restore(episode_ids=["uuid1", "uuid2"])

# Restore ALL user records from trash
memory.restore(user_id="user_42")

# Permanently purge from trash (IRREVERSIBLE!)
memory.purge(user_id="user_42")  # Only records older than 30 days
memory.purge(user_id="user_42", force_all=True)  # ALL records (even fresh ones!)

Export / Import (GDPR/FZ-152)

# Export
data = memory.export_data("user_42", format="json")
print(f"Exported {data['total']} records")

# Import
memory.import_data("user_42", records=[
    {"content": "Loves Italian food", "memory_type": "fact"},
    {"content": "Prefers morning meetings", "memory_type": "preference"},
])

Rate Limit Headers

Every API response includes these headers:

Header Description
X-RateLimit-Limit Monthly limit for your plan
X-RateLimit-Remaining Requests remaining
X-RateLimit-Used Requests used this month
X-RateLimit-Reset Unix timestamp of reset

Plans

Plan Requests/month Price
Free 1,000 0 ₽
Starter 10,000 990 ₽
Pro 50,000 4,900 ₽
Business 200,000 14,900 ₽

Links

License

MIT - (c) 2025-2026 Otel Group

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

memorycore_ai-0.5.0.tar.gz (10.8 kB view details)

Uploaded Source

Built Distribution

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

memorycore_ai-0.5.0-py3-none-any.whl (9.2 kB view details)

Uploaded Python 3

File details

Details for the file memorycore_ai-0.5.0.tar.gz.

File metadata

  • Download URL: memorycore_ai-0.5.0.tar.gz
  • Upload date:
  • Size: 10.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.12

File hashes

Hashes for memorycore_ai-0.5.0.tar.gz
Algorithm Hash digest
SHA256 e5e5eed89d9dc182e12cf7de69abf6a2bf56ff65904f684f82d51696647cca5f
MD5 b34b5637f013fa514761891b2a275035
BLAKE2b-256 2a8ca58762a98237ea42fff26ad0ca280e121b23ae127c2e3cfef956ee21c028

See more details on using hashes here.

File details

Details for the file memorycore_ai-0.5.0-py3-none-any.whl.

File metadata

  • Download URL: memorycore_ai-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 9.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.12

File hashes

Hashes for memorycore_ai-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9974e3d5949a40cba19adcb499a67802589e538685a602fd325592258b85a523
MD5 d8cbd1e527948b43492716fddec98113
BLAKE2b-256 70dc50aa6fbcec79be05e09656a05a8c789ae1e4c528ed57801bca92d7f22702

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