LangChain integration

LangChain handles the chain. Hebbrix handles the memory.

LangChain's built-in memory options live in Python objects. The moment your process restarts, they're gone. Hebbrix gives your chains memory that survives deployments, scales to millions of users, and gets sharper the more it's used.

$pip install hebbrix langchain-openai
how it fits

Where memory slots into your chain

Hebbrix wraps your LangChain call. It searches for context before the call and stores what was learned after. Your chain logic doesn't change.

User message Hebbrix memory.search() Context injection LangChain LLM Response memory.store()
A LangChain chain in an editor next to a panel showing the context Hebbrix recalled before the LLM ran
two ways to integrate

Pick the approach that fits your architecture

Option 1 · Drop-in

Automatic, zero-config

Point ChatOpenAI at Hebbrix's endpoint. Memory search and injection happen automatically around every LLM call. Your chain logic stays untouched.

drop_in.py
from langchain_openai import ChatOpenAI

llm = ChatOpenAI(
    base_url="https://api.hebbrix.com/v1",
    api_key="your_hebbrix_key",
    model="gpt-4"
)

# Use in any chain. Memory is automatic.
response = llm.invoke("What does Sarah prefer?")
# Hebbrix searches memories, injects
# context, then forwards to the LLM.
Option 2 · SDK

Full control

Run the Hebbrix Python SDK alongside your chains when you want to decide exactly when memory happens: store after a tool call, search before a chain invocation, on your terms.

sdk_approach.py
from hebbrix import MemoryClient
from langchain_openai import ChatOpenAI

llm = ChatOpenAI(model="gpt-4")

# MemoryClient is async-first
async with MemoryClient(api_key="YOUR_API_KEY") as mem:
    # Before chain: get relevant context
    memories = await mem.search("user preferences")
    ctx = "\n".join(m["content"] for m in memories)

    # After chain: store what was learned
    await mem.add(
        content="User asked about billing, wants email"
    )
worth knowing

LangChain built-in vs. Hebbrix memory

LangChain's memory modules are great for prototyping. Hebbrix is built for production agents.

LangChain built-inHebbrix
PersistenceIn-process; lost on restartCloud-persisted across sessions
SearchLast N messages or summary5-layer hybrid search
StructureFlat text buffer3-tier + knowledge graph
LearningNoneAutomatic RL (6 quality checks)
Multi-userManual implementationCollections with built-in scoping
DecayWindow eviction onlyEbbinghaus forgetting curve

Give your LangChain agent a memory upgrade

Free tier, no credit card. Enough to build a full prototype and decide for yourself if it's worth it.