Why agents need memory
Your agents run thousands of tasks but start from scratch every time. Customer context is lost between sessions. Proven workflows are forgotten. Mistakes get repeated. Mengram gives agents persistent memory across 3 dimensions:- Facts (semantic) — what the agent knows about users, systems, policies
- Events (episodic) — what happened in past runs, with outcomes
- Workflows (procedural) — learned step-by-step procedures with success/failure tracking
The agent memory loop
Quick start
Key parameters
| Parameter | Purpose | Example |
|---|---|---|
agent_id | Scope memories per agent — one API key, many agents | "support-bot", "devops-agent" |
run_id | Track which run produced a memory | "run-42", session IDs |
user_id | Isolate memories per end-user | "alice", "customer-123" |
app_id | Separate environments | "prod", "staging" |
add(), search(), search_all(), and other endpoints.
Filtering by agent
Search only memories from a specific agent:Procedural learning
Mengram extracts step-by-step workflows from agent conversations and tracks which ones succeed. Agents get better over time without retraining.Agent mode extraction
By default, Mengram only extracts facts from the user role — assistant responses are treated as context only. When you passagent_id, Mengram automatically switches to full extraction — remembering both what the user asked and what the agent did:
| Scenario | Extracts from | How |
|---|---|---|
No agent_id | User messages only | Default for chatbots |
With agent_id | All speakers | Automatic for agents |
| Override | Your choice | Set agent_mode=False to force user-only even with agent_id |
Multi-agent systems
Multiple agents can share the same memory pool or be isolated:Framework integrations
| Framework | Guide | What it does |
|---|---|---|
| CrewAI | CrewAI Integration | 5 memory tools for persistent crews |
| LangChain | LangChain Integration | MengramRetriever for RAG chains |
| OpenClaw | OpenClaw Plugin | 12 tools, auto-recall, auto-capture |
| Claude Code | Claude Code | Full memory loop with hooks |
| MCP Server | MCP Server | 29 tools for Claude Desktop, Cursor, Windsurf |
| Claude Managed Agents | Managed Agents | 29 MCP tools for Anthropic’s hosted agents |
| n8n | n8n Integration | HTTP nodes for any workflow |