Deployment facts
These facts anchor the rest of the guide:Executive summary
Cognee runs either embedded in a Python process or as a FastAPI service. Operationally, each deployment comes down to three independent choices:- Writer ownership: who owns writes
- Storage location: where graph, vector, and relational state live
- Reader access path: how readers reach memory
Pick-a-path decision tree
Start with writer ownership. The first “no” on single-writer ownership pushes you toward queueing or external backends.Storage model
Cognee has three independent storage layers:
Embedded storage is file-backed and easy to move. If
SYSTEM_ROOT_DIRECTORY is unset, Cognee resolves it to .cognee_system, so the default on-disk layout still lands under <SYSTEM_ROOT_DIRECTORY>/databases:
Concurrency and the write model
This is the primary production decision. Packaging is secondary.1. Embedded deployment
Cognee runs inside the calling Python process. Storage defaults to the local Cognee directories and can be moved withDATA_ROOT_DIRECTORY and SYSTEM_ROOT_DIRECTORY. One process owns the writer lock; there is no service boundary or cross-machine sharing unless the directory is mounted or copied.
Full embedded script
Full embedded script
2. Self-hosted service
- 2a. Docker Compose
- 2b. Helm on Kubernetes
- 2c. Sidecar
Use Compose to validate Cognee inside customer or on-prem infrastructure before moving to Kubernetes. Pin the image, persist data to a named volume, expose health checks, and load secrets from a managed source rather than plaintext See Docker Deployment for the full Compose workflow.
.env files.Full Compose skeleton
Full Compose skeleton
3. Scale-out patterns
Scale-out patterns are layered on top of a self-hosted deployment. They scale reads or isolate write jobs; they do not replace the write path.- 3a. Snapshot read replicas
- 3b. Queue-based write path
Use one writer to run Use this for heavy read traffic and static or slowly changing knowledge. Benchmark snapshot size because it drives reader cold-start time.
remember(), publish a snapshot to object storage, and let many readers pull the latest snapshot at startup. This scales reads without a clustered graph database, at the cost of freshness.Full reader deployment skeleton
Full reader deployment skeleton
4. Serverless and managed
Serverless patterns are useful for HTTP-fronted memory APIs and scheduled jobs. They are rarely the primary on-prem pattern.- 4a. Lambda read-only artifact
- 4b. Lambda mutable graph on EFS
Run This scales to zero and is rollback-friendly, but every knowledge update requires rebuilding and redeploying the snapshot.
remember() offline, package the resulting Kuzu/LanceDB files into the deployment artifact or Lambda layer, and open them read-only at runtime.Full read-only Lambda skeleton
Full read-only Lambda skeleton
Ephemeral cloud sandbox (Islo)
For a throwaway, HTTP-fronted API instance, Cognee ships a one-command deploy script that provisions an Islo cloud sandbox (2 vCPU / 4 GB / 10 GB), installscognee[api] into a dedicated virtualenv, starts the FastAPI server on port 8000, gates on the internal /health endpoint, and then prints a public share URL that expires after 24 hours.
cognee-api), so re-running the script while a previous deployment still exists fails with a name conflict — delete the old sandbox through the SDK first. You can still stop the sandbox separately when you want to pause it without recreating it. Best for demos and short-lived evaluation rather than durable state, since the share URL and sandbox are ephemeral. See distributed/deploy/README.md for the full runbook, required environment variables, and cleanup commands.
5. Externalized backends
Use external services for sustained multi-agent writes and independent scaling of each storage layer. This removes the file-backed graph single-writer ceiling once the graph tier is externalized.- Postgres or RDS for relational metadata
- pgvector, Qdrant, Pinecone, or ChromaDB for vectors
- Neo4j or the FalkorDB adapter for graph writes
- Cognee API pods configured as storage-backed application nodes with writable local paths for ingestion artifacts and caches
Full externalized backend skeleton
Full externalized backend skeleton
6. Cloud service mapping
The patterns are cloud-agnostic. The concrete services differ by platform.
Keep the hot graph on block storage or an external graph service. Use shared filesystems only when the pattern truly requires cross-process file sharing.
7. Production readiness
Schema migrations
- Relational: pin the Cognee version per environment and run migrations before deploying the live writer.
- Graph: additive model changes are safest. Renames, removals, and new required fields need a data migration or rebuild from source.
- Vector: rebuild collections when embedding dimension, distance metric, or metadata schema changes.
Backups, restore, and DR
- Embedded: route writes through one writer, then snapshot the data directory to object storage.
- Externalized: back up each tier independently, such as Postgres dumps, managed snapshots, graph dumps, and vector snapshots.
- Region failure: use cross-region snapshot replication and warm standby. Active-active DR is not a good fit for file-backed Kuzu.
- Test restore on every release.
Tenant isolation
LLM egress and authentication
- Use self-hosted vLLM, customer-approved proxies, Bedrock private access, Azure OpenAI in-subscription, or fully air-gapped patterns when egress is restricted.
- Front the Cognee API with the customer gateway. Terminate OIDC or mTLS there rather than exposing the Cognee port directly.
- Use service-to-service mTLS or cluster-native identity.
- Propagate user identity through a gateway-validated header when Cognee needs user-scoped access.
Appendix - options at a glance
For provider-specific configuration, see Graph Stores, Vector Stores, and Relational Databases.