Cognee: Open-Source AI Memory Platform for Agents
Cognee gives AI agents memory that persists between sessions without requiring manual wiring of a graph database, vector store, and session cache, simplifying the setup for teams. Its Postgres integration is a genuine productivity win for development, though the real production path requires a graph-native backend. Consider Cognee if you need a pre-assembled memory layer for your agent.
What is Cognee?
Cognee is an open-source AI memory platform designed for agents to remember across sessions, ingesting documents to extract and store entities and relationships as a searchable knowledge graph. Backed by vector embeddings, it uses four API calls (remember, recall, forget, improve) for information storage, querying, deletion, and memory tuning. The platform runs locally, in Docker, or as a managed cloud service, and ships official clients for Python, Rust, and TypeScript.
Core Capabilities for Agent Memory
- โFour-operation API: remember, recall, forget, and improve for full memory lifecycle management
- โHybrid storage combining vector embeddings with graph relationships for meaning-based and structure-based retrieval
- โSession memory with background sync to the permanent knowledge graph
- โClaude Code plugin that captures prompts, tool traces, and responses into session memory and persists context across context resets
- โMulti-backend architecture: LanceDB, Postgres/pgvector, Neo4j, Qdrant, ChromaDB, Weaviate, Milvus, and more via community adapters
- โMulti-tenant isolation support with per-user, per-dataset graph and vector databases on compatible backends
- โDocker images for the API server and MCP server published on Docker Hub on every push to main
- โBenchmark results on the BEAM long-context benchmark: 0.79 at 100K tokens, 0.67 at 10M tokens
Real-World Applications of Cognee
- โขBuilding customer support agents that track interaction history, failed actions, and resolved cases across sessions
- โขCreating SQL copilots that distill and reuse expert-level query patterns and reasoning
- โขUnifying data from multiple company channels into a single knowledge graph that any agent can query
- โขGiving Claude Code persistent memory that survives context resets and session boundaries
- โขRunning an AI research assistant that maintains a growing ontology of papers, concepts, and their relationships
- โขBuilding domain-specific expert systems where agents learn from feedback and improve over time
Benefits of Using Cognee
- โSelf-hosted option means no vendor lock-in and no data leaving your infrastructure
- โRuns the entire memory stack on Postgres during development, reducing the number of services to manage
- โGraph-backed memory preserves relationships between facts, not just similarity
- โOfficial Rust and TypeScript clients extend the platform beyond Python-only projects
- โMulti-tenant isolation available for graph and vector layers on compatible backends
- โActive development with a published research paper backing the architecture decisions
Current Considerations and Trade-offs
- โณThe Postgres graph backend is explicitly a demo feature; production graph workloads need a graph-native database
- โณMulti-tenant isolation requires specific backends for both graph and vector layers; misconfiguration or unsupported backends will raise an error
- โณThe `AUTO_FEEDBACK` post-query tuning step adds latency to every read; it cannot be selectively applied per query
- โณNo offline mode documented; the LLM integration is a hard dependency for memory improvement and ontology generation
- โณDocker Desktop or an OCI-compatible runtime is required for the local UI, which may surprise developers expecting a CLI-only tool
Getting Started with Cognee
Install via pip, uv, or poetry. Python 3.10 to 3.14 is required. Run `uv pip install cognee` for the core package, or add `[postgres]` for the Postgres stack. Configuration is done through environment variables: set `LLM_API_KEY` for the language model, then point at your chosen backends with variables like `DB_PROVIDER`, `VECTOR_DB_PROVIDER`, and `GRAPH_DATABASE_PROVIDER`. A `.env.template` in the repo shows all available options. Docker users can pull `cognee/cognee:main` directly from Docker Hub or use the provided docker-compose file with optional profiles for the UI, MCP server, Postgres, and Neo4j.
Integrating Cognee into Your AI Agents
Import cognee in your async Python code and call the four operations. `await cognee.remember("your text here")` stores permanently in the knowledge graph. Pass `session_id` to route through session cache instead. `await cognee.recall("your query")` queries with automatic routing to the best retrieval strategy. `await cognee.forget(dataset="name")` deletes a dataset. Environment flags let you trade off memory quality for speed: `AUTO_FEEDBACK=false` disables the post-query self-tuning step, and `CACHING=false` disables session memory entirely. The CLI offers the same operations with `cognee-cli remember`, `cognee-cli recall`, and `cognee-cli forget --all`.
Exploring AI Agent Memory Solutions
Common Questions About Cognee
Yes. Cognee is released under the Apache-2.0 license. The repository, documentation, and source code are publicly available on GitHub.
The primary client is Python. Cognee also ships official clients for Rust (cognee-rs) and TypeScript (@cognee/cognee-ts), both available as separate repositories and published packages.
Both. You can self-host using Docker, Docker Compose, Modal, Railway, Fly.io, or Render with provided deployment scripts. Cognee Cloud offers a fully managed option. You can also connect any Python agent to a remote Cognee instance using cognee.serve(url, api_key).
Yes, with caveats. With ENABLE_BACKEND_ACCESS_CONTROL enabled, each user-dataset combination gets isolated graph and vector databases. Both layers must support isolation: compatible backends include Ladybug, Kuzu, and Neo4j for graphs, and LanceDB and PGVector for vectors.
Cognee supports multiple backends across three layers. Graphs: Ladybug, Kuzu (defaults), Neo4j, Neptune, Postgres (demo). Vectors: LanceDB (default), PGVector, Qdrant, ChromaDB, Weaviate, Milvus, plus community adapters. Sessions: Redis, Postgres, or SQLite.
No. The README explicitly marks the Postgres graph backend as a demo feature. The relational, vector, and session layers on Postgres are production-ready; the graph functionality on Postgres is not. Production graph workloads require a graph-native backend like Neo4j.
The problem it solves
Agent frameworks give you tools to think and act, but nothing remembers what happened last week, last month, or last quarter. Vector stores solve the retrieval problem but lose the relationships between facts. Rag systems need to be rebuilt for every session. Developers end up hand-rolling brittle context windows, losing the long-term learning that makes an agent actually useful over time.
Who should try it โ and who should skip
Reach for Cognee if you are building a multi-session AI agent and you do not want to assemble a memory stack from a vector store, a graph database, and a session cache. It is particularly useful for Python or TypeScript teams that want a self-hosted option with a research-backed architecture. The Postgres-integration makes it practical for solo developers and small teams who want a single-service memory layer during development. Skip it if your agents do not need persistent cross-session memory, if you are already invested in a different agent framework with its own memory system, or if you need production-grade graph isolation today and cannot wait for the managed offering.
Related repositories
Is cognee worth your time?
ChatGPT, Claude and Perplexity can all read this page. Ask one of them what it makes of cognee.
