Skip to main content

LangChain integration for EngramPort — persistent memory for AI bots and agents

Project description

engramport-langchain

Persistent memory for AI bots and agents, powered by EngramPort + MandelDB.

3 lines to give your bot a brain:

from engramport_langchain import EngramPortMemory

memory = EngramPortMemory(api_key="ek_bot_...")
memory.remember("User prefers dark mode and lives in Tampa, FL")

Install

pip install engramport-langchain

For LangChain integration:

pip install engramport-langchain[langchain]

Quick Start

Standalone (no LangChain required)

from engramport_langchain import EngramPortMemory

memory = EngramPortMemory(api_key="ek_bot_...")

# Store memories
memory.remember("User's name is Alex")
memory.remember("User prefers concise answers")
memory.remember("User lives in Tampa, FL and checks weather often")

# Semantic recall — no keyword matching needed
results = memory.recall("What do I know about this user?")
for m in results.memories:
    print(f"  {m.content} (score: {m.relevance_score:.2f})")

# Synthesize insights across all memories
insights = memory.reflect(topic="user preferences")
for i in insights.insights:
    print(f"  {i.content} (confidence: {i.confidence:.0%})")

# Check stats
stats = memory.stats()
print(f"Memories: {stats.memory_count}, Insights: {stats.insight_count}")

Async

Every method has an async counterpart:

await memory.aremember("User mentioned they love hiking")
results = await memory.arecall("outdoor activities")
insights = await memory.areflect()
stats = await memory.astats()

LangChain Integration

Drop-in memory for any LangChain conversation chain:

from engramport_langchain.langchain import EngramPortChatMemory
from langchain.chains import ConversationChain
from langchain_openai import ChatOpenAI

memory = EngramPortChatMemory(
    api_key="ek_bot_...",
    recall_limit=5,        # memories per turn
    auto_reflect=True,     # synthesize insights automatically
    reflect_interval=10,   # every 10 interactions
)

chain = ConversationChain(llm=ChatOpenAI(), memory=memory)

# Memories persist across sessions automatically
chain.invoke({"input": "My name is Alex and I live in Tampa"})
# ... restart your app ...
chain.invoke({"input": "What's the weather like where I live?"})
# Bot recalls Tampa without being told again

API Reference

Method Description
remember(content, context?, session_id?) Store a memory
recall(query, limit=5) Semantic search across memories
reflect(topic?) LLM-powered insight synthesis
stats() Memory and insight counts

All methods return typed Pydantic models. Async versions prefixed with a.

Get Your API Key

curl -X POST https://mandeldb.com/api/v1/portal/register \
  -H "Content-Type: application/json" \
  -d '{"bot_name": "my-bot", "bot_type": "custom", "owner_email": "you@example.com"}'

Why EngramPort?

Feature EngramPort Mem0
Semantic recall Yes Yes
Insight synthesis Yes — /reflect No
Cryptographic provenance (AEGIS) Yes No
Graph-based reasoning Yes (MandelDB) No
Category-aware memory decay Yes No
Self-hosted option Yes Paid only
Pricing (hobby) Free tier $49/mo

Links

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

engramport_langchain-0.1.0.tar.gz (7.0 kB view details)

Uploaded Source

Built Distribution

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

engramport_langchain-0.1.0-py3-none-any.whl (8.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: engramport_langchain-0.1.0.tar.gz
  • Upload date:
  • Size: 7.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for engramport_langchain-0.1.0.tar.gz
Algorithm Hash digest
SHA256 80bb25c29c8922c1689f2666d807a0a99af0dd9cea68fb832db1d8d8ca0fb62e
MD5 8f2981c3beae984fff7d91d0cf5d7cf0
BLAKE2b-256 e00830fe9a22692f523535567aa70d28d53d144e59cf2e11c33f25bec01e54d5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for engramport_langchain-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 19d5d906487a266fc93a6dd8112309ae7b37627486ff7518a06939dbfe022dcf
MD5 b86c1f60d29efdf93a7b26b5b983a07a
BLAKE2b-256 479ba23f16144d5930ac656205f27f8b9311d3fc5e0592cc3cd45ee975ce5745

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