LangChain Memory

Persistent Memory Backend for LangChain Agents

LangChain's built-in memory stores are ephemeral — they live in RAM and die when your process restarts. AgentMind gives your LangChain agents durable, cross-session, cross-agent memory for $0.01 per operation.

Why LangChain's default memory isn't enough

ConversationBufferMemory

Grows unbounded. Sends entire history every call. Token costs explode.

AgentMind stores history externally. Retrieve only what you need.

ConversationSummaryMemory

Summarises context, losing important details. Breaks on restart.

Store full context permanently. Retrieve by key in under 50ms.

VectorStoreRetrieverMemory

Requires a separate vector DB. Expensive to run and maintain.

AgentMind is a single HTTP API. No infrastructure to manage.

Multi-agent context sharing

No native way for separate LangChain agents to share memory.

Same agent_key = shared memory. Multiple agents, one store.

Drop-in replacement — Python example

No new dependencies required. Just HTTP requests.

from langchain_core.messages import HumanMessage, AIMessage
import requests

AGENT_KEY = "your_agentmind_key"
BASE = "https://agentmind.dev"
HEADERS = {"X-API-Key": AGENT_KEY}

class AgentMindMemory:
    """Drop-in memory backend for LangChain agents."""

    def save_context(self, session_id: str, messages: list) -> None:
        """Persist conversation history to AgentMind."""
        requests.post(f"{BASE}/api/ac/memory", headers=HEADERS, json={
            "agent_key": AGENT_KEY,
            "memory_key": f"session_{session_id}",
            "memory_value": str(messages),
            "memory_type": "context"
        })

    def load_memory(self, session_id: str) -> list:
        """Load previous context for this session."""
        res = requests.get(
            f"{BASE}/api/ac/memory",
            headers=HEADERS,
            params={"agent_key": AGENT_KEY, "memory_key": f"session_{session_id}"}
        )
        if res.ok and res.json().get("memory"):
            return eval(res.json()["memory"]["memory_value"])
        return []

# Usage with any LangChain agent
memory = AgentMindMemory()
history = memory.load_memory("user_42")  # Loads previous session
# ... run your agent ...
memory.save_context("user_42", history)  # Persists for next time

Everything LangChain memory should be

Survives agent restarts and deployments
Shared across multiple agents and instances
Searchable — list all memories for a session
Typed — context, preference, workflow, fact
No vector DB to manage or pay for
Works in Python, TypeScript, curl
OpenAPI spec for auto-binding
Scales to millions of memories

Upgrade your LangChain agents today

Free tier included. No infrastructure to spin up.

Get API Key Free