RepoDaily · 2026-06-27 · Security tool

Cognee: Self-Hosted AI Agent Memory with Tenant Isolation and Audit Trails

#9 Security tool Python +755 topoteretes/cognee Open repository

An open-source knowledge-graph engine that gives AI agents persistent memory across sessions, with per-user isolation, OTEL tracing, and a private deployment model that keeps data under your control.

Repo typeSecurity tool
Best forTeams building AI agents that need persistent, auditable memory without sending knowledge graphs to third-party SaaS memory providers.
Risk levelMedium
Time to evaluate2–4 hours for a local Docker deployment with OpenAI API key

Primary question: Does your agent layer need self-hosted, tenant-isolated long-term memory with full audit traceability?

92/100

RepoDaily adoption score

RepoDaily rates this as 92/100 (strong) for adoption: evidence, installation path, production risk, differentiation, license clarity, and AI/agent fit are scored from the article sources and adoption notes.

Directional score from RepoDaily sources and adoption notes, not a benchmark.Risk: Medium
100Evidence quality

5 source(s) across 3 source category/categories, plus a RepoDaily-specific evidence module when available.

100Installability

5 workflow step(s), 5 next-action step(s), and 5 command/install signal(s) were detected.

66Maintenance confidence

Trending momentum is +755 stars, with maintenance/release/issue signals counted when present.

96Production readiness

Risk is marked medium, with 8 security note(s) and 4 explicit skip condition(s).

97Differentiation

2 opportunity lens item(s), 4 alternative(s), and 3 type-specific section(s) support differentiation.

82License clarity

License source or license wording is present.

90Agent / AI fit

7 AI/agent-related signal(s) were detected in the article text and metadata.

Project overview

Cognee (v1.2.2, Apache-2.0) is a Python library and server that ingests unstructured data in any format, builds a self-hosted knowledge graph combining vector embeddings with graph reasoning, and exposes four operations — remember, recall, forget, and improve — as both a Python API and a CLI. The project targets developers who want AI agents to retain context across sessions without relying on external managed memory services. Period stars of 755 and trending rank 9 on 2026-06-27 place it among the fastest-climbing agent-infrastructure repos this week.

From a security perspective, Cognee distinguishes itself with explicit agentic user and tenant isolation, an OTEL (OpenTelemetry) collector for traceability, and audit traits built into its pipeline. The project publishes Docker images for both an API server (cognee/cognee on port 8000) and an MCP server (cognee/cognee-mcp on port 8001), allowing fully self-hosted deployments where no document content leaves the operator's infrastructure unless an external LLM provider is configured. The pyproject.toml actively excludes the vulnerable pydantic-settings range (GHSA-4xgf-cpjx-pc3j, versions 2.12.0–2.14.1) and documents the fix in 2.14.2+, demonstrating dependency hygiene as part of the build.

The project supports Python 3.10 through 3.14, ships with optional dependency groups for Neo4j, Postgres with PGVector, Redis, LangChain, LlamaIndex, Anthropic, Azure, and Ollama, and includes a research paper (Markovic et al., 2025, arXiv:2505.24478) on optimizing the interface between knowledge graphs and LLMs for complex reasoning. The SECURITY.md policy directs vulnerability reports to info@topoteretes.com and commits to rapid response, while the DCO requirement on all contributions ensures provenance tracking for every merged commit.

Problem it solves

  • AI agents lose context between sessions because stateless inference APIs have no built-in persistent memory layer.
  • Managed memory services route sensitive document content through third-party infrastructure, creating data-governance and compliance exposure.
  • Naive RAG pipelines retrieve by semantic similarity but miss relationship-based reasoning that a knowledge graph provides.
  • Multi-tenant agent deployments need per-user isolation so one tenant's queries cannot surface another tenant's ingested data.
  • Debugging agent hallucinations requires traceability — knowing which ingested source produced a given retrieval result.

How it works

  1. Install with `uv pip install cognee` (Python 3.10–3.14 required) and set `LLM_API_KEY` as an environment variable or in a `.env` file copied from `.env.template`.
  2. Ingest data by calling `await cognee.remember("...")` which runs the add, cognify, and improve pipeline stages to build graph nodes and vector embeddings.
  3. Query with `await cognee.recall("...")` which auto-routes between vector similarity search and graph traversal based on query characteristics, optionally scoped to a session_id.
  4. Delete specific datasets with `await cognee.forget(dataset="main_dataset")` or purge all memory with `cognee-cli forget --all`.
  5. For Docker deployments, run `docker compose up` for the API server on port 8000, or add profiles like `--profile neo4j` or `--profile postgres` to attach graph or vector backends.

Product demo and interface preview

Cognee Demo
Cognee Demo — The official README demo showing Cognee's remember and recall pipeline in action, illustrating how ingested text becomes queryable graph memory. README.md image

Architecture: What Cognee Stores and How

Cognee's pipeline ingests raw data, splits it into chunks, generates vector embeddings (default LanceDB 0.24.3+, with optional FastEmbed and Postgres/PGVector backends), and simultaneously constructs a knowledge graph using cognitive-science-grounded ontology generation. The graph layer uses NetworkX 3.4.2+ for in-memory operations and optionally persists to Neo4j 5.28+ when the neo4j extra is installed.

The API exposes exactly four operations: remember (ingest + build), recall (query with auto-routing), forget (delete), and improve (refine the graph). Session-scoped memory uses a fast cache that syncs to the persistent graph in the background, so agents get low-latency reads for current-session context and durable recall across sessions. SQLAlchemy 2.0.39+ with aiosqlite manages relational metadata, while Alembic handles migrations with a cross-process file lock to prevent concurrent migration races.

Command and API Surface

  • `uv pip install cognee` — core install with LanceDB, OpenAI, and SQLite defaults.
  • `cognee-cli remember "text"` — CLI ingestion without writing Python.
  • `cognee-cli recall "query"` — CLI retrieval with auto-routed search.
  • `cognee-cli forget --all` — purge all stored memory.
  • `cognee-cli -ui` — launches local UI; requires Docker Desktop, Colima, or any OCI-compatible runtime.
  • `docker compose --profile neo4j up` — attach Neo4j as the graph backend.
  • `docker compose --profile postgres up` — attach Postgres with PGVector for embeddings.

Maintenance and Dependency Risk

Cognee declares 40+ runtime dependencies including openai, litellm, sqlalchemy, fastapi, lancedb, and rdflib. The optional-dependency surface spans 20+ extras (neo4j, postgres, langchain, llama-index, anthropic, ollama, scraping, tracing, etc.), meaning a production deployment pulls a wide transitive graph. The `[tool.uv]` section sets `exclude-newer = "2 days"` to avoid pulling packages younger than 48 hours, which reduces supply-chain risk but can delay adoption of urgent patches.

The pyproject.toml explicitly documents GHSA-4xgf-cpjx-pc3j (pydantic-settings vulnerability in 2.12.0–2.14.1) and uses an exclusion pattern `!=2.12.*,!=2.13.*,!=2.14.0,!=2.14.1` rather than a hard cap so the patched 2.14.2+ is picked up automatically. This is a deliberate, documented security posture — not a silent pin. The DCO sign-off requirement on every commit and the CODEOWNERS-based auto-review routing provide additional supply-chain integrity for contributions.

Who should pay attention?

Good fit if

  • Teams building multi-tenant agent platforms that need per-user data isolation and audit trails.
  • Organizations required to self-host AI infrastructure due to data residency or compliance requirements.
  • Developers who want a knowledge-graph alternative to flat vector-only RAG without building graph ingestion from scratch.
  • Anyone evaluating GraphRAG approaches who wants a working reference implementation with a peer-reviewed paper behind it.

Skip for now if

  • Projects that only need ephemeral session memory (a Redis cache or conversation buffer suffices).
  • Teams without a Python 3.10+ runtime or any OCI-compatible container runtime for the MCP server UI.
  • Deployments that cannot provision an LLM API key — Cognee requires one for the default pipeline.
  • Use cases where the 40+ dependency install footprint exceeds the value of graph-based retrieval.

Risks and cautions

Medium

Cognee ships Apache-2.0 with a documented vulnerability policy and DCO enforcement, but its wide dependency surface, beta maturity (Development Status 4 - Beta), and LLM API key requirement create moderate adoption risk.

  • Classified as Development Status :: 4 - Beta in pyproject.toml classifiers, not production-stable.
  • 40+ runtime dependencies plus 20+ optional extras create a large transitive dependency tree to audit.
  • The MCP server UI requires Docker Desktop or Colima — not a pure Python deployment.
  • The `exclude-newer = 2 days` uv policy could delay urgent dependency patches by up to 48 hours.
  • No published CVE track record yet given the project's relative youth and beta status.
  • SECURITY.md (https://github.com/topoteretes/cognee/blob/main/SECURITY.md) directs reports to info@topoteretes.com with 'SECURITY' in the subject line.
  • Agentic user and tenant isolation prevents cross-tenant data leakage in multi-user agent deployments.
  • OTEL collector and audit traits provide traceability for agent decisions and retrieval provenance.
  • Apache-2.0 license includes an explicit patent grant and termination clause (Section 3 of the LICENSE).
  • DCO sign-off required on every commit: `git commit -s` enforced via CONTRIBUTING.md.
  • pydantic-settings vulnerability (GHSA-4xgf-cpjx-pc3j) explicitly excluded in dependency spec with documented rationale.
  • Self-hosted deployment model: no document content leaves the operator's infrastructure unless an external LLM API is called.
  • CODEOWNERS file auto-routes PR reviews to domain owners based on changed directories.

Alternatives to compare

ApproachWhen to useTrade-off
Mem0
When you prefer a managed memory service with hosted plans and less infrastructure to run yourself.Freemium SaaS with self-hosted option
Zep
When you need temporal knowledge graph features with a focus on conversation history and entity tracking.Open-source self-hosted + managed cloud
Letta (formerly MemGPT)
When you want agent memory modeled as an operating-system-style memory hierarchy with context window management.Open-source (Apache-2.0)
LangGraph + checkpointer
When your agent framework is already LangChain-based and you only need conversation persistence, not a knowledge graph.Open-source (MIT)

What this trend reveals

Compliance-First Agent Memory

Cognee's tenant isolation, audit traits, and self-hosted deployment model align with GDPR, HIPAA, and SOC 2 requirements that prohibit routing sensitive data through third-party memory APIs.

Verify by deploying with `docker compose --profile postgres up` and confirming no outbound traffic except to your configured LLM provider endpoint.

GraphRAG Evaluation Harness

The evals optional dependency group includes plotly, pandas, scikit-learn, and locust, suggesting built-in support for benchmarking retrieval quality and load testing the memory pipeline.

Install with `uv pip install 'cognee[evals]'` and inspect the test suite at cognee/tests/ for benchmark entry points.

Best next action

Run the Colab Walkthrough Locally

Cognee publishes an end-to-end Colab notebook covering core features. Forking it locally with your own documents gives you a working knowledge graph in under an hour.

  1. Open the Colab walkthrough linked in the README to understand the remember/recall/forget/improve cycle.
  2. Install locally: `uv pip install cognee` and copy `.env.template` to `.env` with your `LLM_API_KEY`.
  3. Run `cognee-cli remember "Your first document"` then `cognee-cli recall "What did you store?"`.
  4. Launch `cognee-cli -ui` (requires Docker) to inspect the generated knowledge graph visually.
  5. Review pyproject.toml optional-dependencies to select backend extras (neo4j, postgres, langchain) for your target architecture.

RepoDaily verdict

Cognee delivers a credible open-source alternative to managed agent-memory services by combining a self-hosted knowledge graph with tenant isolation, audit traces, and a four-operation API that is simple to integrate. Its beta status, wide dependency surface, and LLM-key requirement mean production deployments need a thorough security and dependency review — but the documented CVE exclusions, DCO enforcement, and Apache-2.0 licensing provide a solid governance foundation for teams that need data-sovereign agent memory.

Sources