CO

Cognee

3,500PythonMemory

AI memory platform with knowledge graph for persistent, structured agent memory.

PythonMemoryKnowledge GraphMulti-hop Reasoning

Overview

Cognee is an open-source AI memory platform that provides persistent, structured memory for AI agents using a knowledge graph. Unlike simple vector databases, Cognee builds a knowledge graph representing entities, relationships, and facts extracted from conversations, enabling multi-hop reasoning and context-aware retrieval across sessions.

Features

  • Knowledge graph memory for structured knowledge representation
  • Multi-hop reasoning through graph traversal
  • Automatic entity extraction and resolution
  • Hybrid vector + graph retrieval
  • Temporal awareness for recency tracking
  • RESTful API for framework-agnostic integration

Installation

pip install cognee

Pros

  • +Graph-based memory enables multi-hop reasoning
  • +Automatic entity extraction reduces manual work
  • +Temporal tracking for recency-aware retrieval
  • +Framework-agnostic 鈥?works with any agent
  • +Open source with permissive license

Cons

  • More complex infrastructure than simple vector stores
  • Graph construction adds ingestion latency
  • Smaller community than Mem0 or AgentMemory
  • Requires schema design for optimal performance

Alternatives

Documentation

Cognee

Overview

Cognee is an open-source AI memory platform that provides persistent, structured memory for AI agents using a knowledge graph. It enables agents to store, retrieve, and reason over information across sessions, with a focus on creating a scalable memory layer that supports complex queries, relationships, and context-aware retrieval.

Unlike simple vector databases, Cognee builds a knowledge graph that represents entities, relationships, and facts extracted from conversations and documents. This graph-based approach allows agents to perform multi-hop reasoning, discover implicit connections, and maintain a rich, evolving understanding of the user's domain and preferences.

Features

  • Knowledge Graph Memory: Stores structured knowledge as a graph of entities and relationships rather than flat vectors.
  • Multi-hop Reasoning: Retrieve indirectly related information through graph traversal, enabling deeper context understanding.
  • Entity Extraction: Automatically extracts named entities, concepts, and their relationships from text.
  • Semantic Search: Combines vector similarity with graph relationships for more relevant retrieval.
  • Session Persistence: Memory persists across agent sessions, enabling cumulative learning.
  • Graph Visualization: Built-in tools to visualize the knowledge graph for debugging and insight.
  • API-first Design: RESTful API for easy integration with any agent framework.

Installation

Via pip

pip install cognee

Quick Start

from cognee import Cognee

# Initialize with your LLM provider
cog = Cognee(api_key="your-openai-key")

# Add documents or knowledge
cog.add("Claude Code is an AI coding assistant from Anthropic.")
cog.add("Anthropic was founded by Dario Amodei and Daniela Amodei.")
cog.add("Claude Code supports MCP servers for tool integration.")

# Query with context-aware retrieval
result = cog.query("What coding tools does Anthropic make?")
print(result)
# "Anthropic makes Claude Code, an AI coding assistant that supports MCP servers."

Core Concepts

Graph-based vs. Vector-only Memory

Most memory systems use vector embeddings alone, which can miss implicit connections. Cognee's knowledge graph explicitly models entities and their relationships, making it possible to answer questions like "Which frameworks does this team use?" by traversing the graph rather than relying purely on semantic similarity.

Entity Resolution

Cognee automatically resolves references to the same entity (e.g., "Anthropic" and "the company behind Claude") into a single node in the graph, preventing fragmentation.

Temporal Awareness

The platform tracks when facts were added or updated, allowing agents to understand the recency and evolution of information.

Advanced Features

  • Hybrid Retrieval: Combines vector search with graph traversal for optimal recall and precision.
  • Custom Schema: Define your own entity types and relationship schemas for domain-specific knowledge.
  • Bulk Ingestion: Process large document sets with batch operations.
  • Integration APIs: REST, gRPC, and WebSocket interfaces for flexible integration.

Examples

  • Persistent Coding Assistant: An agent that remembers project architecture decisions, code conventions, and past bug fixes across sessions.
  • Customer Support Agent: An agent that builds a knowledge graph of customer issues, solutions, and product features over time.
  • Research Assistant: An agent that maintains a graph of research papers, authors, and findings, enabling cross-paper discovery.

Pros

  • ✅ Graph-based memory enables multi-hop reasoning that vector-only systems cannot
  • ✅ Automatic entity extraction reduces manual knowledge engineering
  • ✅ Temporal tracking for recency-aware retrieval
  • ✅ Framework-agnostic — works with any agent or LLM
  • ✅ Open source with permissive license

Cons

  • ❌ More complex infrastructure than simple vector stores
  • ❌ Graph construction adds latency during ingestion
  • ❌ Smaller community and ecosystem than Mem0 or AgentMemory
  • ❌ Requires careful schema design for optimal performance

When to Use

Use Cognee when:

  • You need multi-hop reasoning — answering questions that require connecting disparate facts
  • You're building agents that need deep, evolving understanding of a domain
  • You want to visualize and inspect the knowledge your agent has accumulated
  • Simple vector similarity is not giving you the recall quality you need

Resources