LangGraph integration

Stateful graphs. Stateful memory.

LangGraph gives you precise control over agent state as it flows through graph nodes. Hebbrix makes that state persistent, so it survives restarts, sessions, and the jump from one user to the next. You define the graph state. We run the memory underneath it.

how it works

Every graph node reads and writes shared memory

Create one Hebbrix client and carry the end user's id in your graph state. Any node can search that user's memory before acting and store what it learned after. The memory isn't scoped to a single node. It's shared across the whole graph and every future run.

graph_state.py
import os
from typing import TypedDict
from langgraph.graph import StateGraph
from hebbrix import SyncMemoryClient

mem = SyncMemoryClient(api_key=os.environ["HEBBRIX_API_KEY"])
COLLECTION_ID = os.environ["HEBBRIX_COLLECTION_ID"]

class AgentState(TypedDict, total=False):
    user_id: str  # your app's id for the end user
    input: str
    context: list
    output: str

def intake_node(state):
    # Load this user's context before reasoning
    ctx = mem.search(state["input"], collection_id=COLLECTION_ID,
                     user_id=state["user_id"])
    return {"context": ctx}

def respond_node(state):
    response = call_your_llm(state["input"], state["context"])
    # Store what this interaction taught us
    mem.memories.create(
        collection_id=COLLECTION_ID,
        user_id=state["user_id"],
        content=state["input"] + " → " + response,
        infer=True,  # extract facts from the turn
    )
    return {"output": response}

graph = StateGraph(AgentState)
graph.add_node("intake", intake_node)
graph.add_node("respond", respond_node)

Cross-run persistence

Every time your graph runs, it can reach every memory stored in every prior run. User preferences, past decisions, and earlier context are all available to every node.

Shared state across nodes

In-graph state is temporary. It lives for one run. Hebbrix memory sticks around, so a fact learned in the intake node is still available to the respond node three runs later.

Knowledge graph across graph runs

Each stored memory is analyzed for entities and relationships. Your graph can query "what's the relationship between X and Y?" even if they were mentioned in different runs months apart.

LangGraph nodes reading from and writing to one shared Hebbrix memory store across runs
what this makes possible

Three things LangGraph agents can't do without persistent memory

01

Learn from prior runs

An agent that ran last Tuesday remembers what happened. Next Tuesday's run picks up from there instead of from zero.

02

Reason about relationships

The knowledge graph connects entities across all runs. "Who authorized the decision?" is answerable even if the answer came from three separate graph executions.

03

Personalize across users

Pass each end user's user_id (and a collection per team or project) and every user gets their own context from the same graph code.

Your graph deserves memory that persists

Free tier. No credit card. Add persistent memory to your LangGraph agents today.