LangMem is LangChain's SDK for adding long-term memory to agents. pref0 is a hosted API for preference learning. Both help agents improve over time, but they differ in scope, output format, and ecosystem requirements.
| pref0 | LangMem | |
|---|---|---|
| What it stores | Structured preferences with confidence scores | Semantic, episodic, and procedural memories |
| Output format | Key-value preferences with scores | Raw memory fragments and prompt updates |
| Confidence over time | Yes — preferences compound across sessions | No — memories are stored without scoring |
| Framework | Framework-agnostic REST API | Python-only, LangGraph ecosystem |
| Infrastructure | Hosted API, no setup | Self-hosted, bring your own vector store |
| Best for | Learning how users want things done | General agent memory within LangGraph |
pref0 extracts structured key-value preferences with confidence scores — 'prefers TypeScript' at 0.85. LangMem stores raw memory fragments (semantic facts, episodic events, procedural rules) without structured preference output.
pref0 is a REST API that works with any language or framework. LangMem is a Python SDK designed for the LangGraph ecosystem. Switching frameworks means reimplementing your memory layer with LangMem, but pref0 preferences carry over.
pref0 is a hosted API — no vector databases, no embedding pipelines, no infrastructure. LangMem requires you to set up and manage your own storage backend (Postgres with pgvector, in-memory stores, etc.).
Yes. Use LangMem for general agent memory within your LangGraph pipeline. Use pref0 for structured preference learning. Inject pref0 preferences into the system prompt alongside LangMem's memory context.
LangMem is open source, but you pay for your own infrastructure (vector database, LLM API calls, hosting). pref0 has a free tier of 100 requests/month with no infrastructure costs.
LangMem is designed for the LangGraph ecosystem. Using it outside LangChain requires significant workarounds. pref0 works with any framework via REST API.
Your users are already teaching your agent what they want. pref0 makes sure the lesson sticks.