Setup
Edit
.env with your preferred configuration. See Setup Configuration guides for all available options.Deployment Methods
- Docker
- Python (Local)
Start Server
Access API
- API: http://localhost:8000
- Documentation: http://localhost:8000/docs
Agent Mode
Cognee can run in agent mode, which tracks active agent connections and shuts the server down once they all disconnect. This is intended for ephemeral deployments where an external orchestrator launches a Cognee server for one or more agents and tears it down when they finish. Enable agent mode in either of two ways:- The default port becomes
8011(instead of8000). The CLI flag overrides theCOGNEE_AGENT_MODEenv var.HTTP_API_PORTstill wins if you set it explicitly. - A background watchdog starts after the first
POST /api/v1/agents/registercall and checks the active connection count every 60 seconds. When the count drops to zero, the watchdog sendsSIGTERMto the server process. - The server stays alive indefinitely while waiting for the first registration — the watchdog does not arm until then.
POST /api/v1/agents/register on connect and POST /api/v1/agents/unregister
on disconnect; see the Agent Management accordion below for the full surface.
Authentication
IfREQUIRE_AUTHENTICATION=true in your .env file:
- Register:
POST /api/v1/auth/register - Login:
POST /api/v1/auth/login - Use token: Include
Authorization: Bearer <token>header or use cookies
Python SDK Client
After deploying the server, connect the Python SDK to your running instance usingcognee.serve():
serve():
CloudClient returned by serve() exposes four methods that map to the server’s V2 endpoints: remember() (ingest + cognify), recall() (search), improve() (enrich graph), and forget() (delete). Call await cognee.disconnect() to revert to local mode.
Uploading skills
client.remember(..., content_type="skills") ingests local SKILL.md files as Skill nodes. Pass either a single SKILL.md file path or a directory; directories are searched recursively for SKILL.md files. The client reads the local file contents and uploads their bytes (preserving the relative folder layout), so the path is resolved on the caller’s machine rather than on the server:
FileNotFoundError when the path does not exist and ValueError when a directory contains no SKILL.md files.
When a skill push reaches the server without any file named
SKILL.md — for example a direct POST /api/v1/remember upload with content_type=skills whose uploaded files use other names — the server now ingests each uploaded file as an individual skill instead of skipping the push. Pushes that already contain SKILL.md files are ingested as before, preserving their folder layout.HTTP API Examples
Authentication
Authentication
Register a user:Login and get token:
Dataset Management
Dataset Management
Create a dataset:List datasets:
Data Operations
Data Operations
- Cognee v1.0
- Legacy Operations
Remember data and build memory in one call:Recall from a dataset with explicit retrieval settings:Improve an existing dataset in the background:Forget only derived memory and keep the uploaded files:
Uploading files, raw text, and remote servers
Uploading files, raw text, and remote servers
Both Attach a file with curl’s To ingest raw text, write it to a file first and upload that file:You can attach multiple files by repeating
POST /api/v1/remember and POST /api/v1/add expect multipart/form-data, where data is one or more file uploads — not a JSON body or a plain form string. Sending text directly (for example -F "data=some text" or a JSON {"data": "..."} body) fails validation with:@ prefix instead:-F "data=@...". If you prefer to send raw strings as JSON, use the Python SDK (await client.remember("some text", ...)) or the POST /api/v1/skills JSON endpoint for skill markdown — the multipart endpoints always require file uploads.Targeting a remote (non-localhost) server: replace http://localhost:8000 with your server’s address, e.g. http://<host-or-ip>:8000 on a private network or https://cognee.example.com behind a reverse proxy. Bind the server to a reachable interface with --host 0.0.0.0 (see the Python (Local) tab), and keep authentication enabled whenever the server is not on a trusted, private network.Activity and Observability
Activity and Observability
The
/api/v1/activity router exposes endpoints for pipeline run history, trace data, tenant or agent monitoring, and dataset export. All endpoints require authentication.Reading the pipeline-runs feedEvery row carries a
kind discriminator (never null):"pipeline"— a pipeline run;pipeline_nameis set."operation"— a single-row operation record;pipeline_nameandstatusarenull, so status-based readers do not see these rows at all.
id, pipeline_name, status, dataset_id, dataset_name, owner_id, owner_email, created_at and pipeline_run_id keys, each row carries the operation columns below. All of them are nullable — rows written before this feature were not backfilled, and each writer sets only the subset it knows.Two values are easy to misread:
tokens_in/tokens_outofnullmeans not measured;0means measured zero. Do not conflate them, and do not use a truthiness check.- When
backgroundistrue, anoutcomeof"succeeded"means the work was accepted and started, not that it finished. Counting those rows as completions inflates any success-rate or cost figure derived from the feed.
tokens_* cannot be summed row by row either — a pipeline run contributes several rows sharing one pipeline_run_id, and parent_operation_id chains child totals into their parent. See what gets stored in a pipeline run record for the deduplication rules.Pagination. The response is a bare JSON array with no total — it has always been a top-level array, so no paging envelope was added. len(results) == limit means another page may exist.Visibility. Without dataset_id, the feed returns rows authored by the caller or their child agents, plus rows on any dataset shared with them. Note that recall, prune and multi-dataset search records carry no dataset_id, so passing dataset_id omits them entirely; passing a dataset_id the caller cannot read is still a 403.- Pipeline Runs
- Trace Buffer
- Dataset Export
LLM Utility Endpoints
LLM Utility Endpoints
When running Cognee as a server, two Optional
/api/v1/llm endpoints can help you bootstrap a custom extraction prompt from sample text:POST /api/v1/llm/infer-schema— analyze sample text and return a graph schemaPOST /api/v1/llm/custom-prompt— generate a custom extraction prompt from that schema
POST /api/v1/cognify.- Infer Schema
- Generate Prompt
- Use with Cognify
parameters keys for the LLM endpoints include temperature, max_tokens, top_p, and seed.Agent Management
Agent Management
The
/api/v1/agents router exposes two groups of endpoints: agent management
(create / list / get / delete an agent identity) and agent connections
(register, unregister, and inspect live sessions). All endpoints require
authentication. Agent identities are persisted as child users of the calling user,
keyed by UUID (agentId in API responses), and authenticate to Cognee using the API key returned
on creation — agents do not have passwords.RegisterAgentRequest body fields: agent_session_name (required — combined
with the caller’s user ID to form the connection ID), type
(sdk/api/mcp/claude_code/opencode/workflow/unknown, default api),
memory_mode (session/cognee/hybrid/none/unknown), session_id,
dataset_ids, dataset_names, source, origin_function, metadata.- Create an Agent
- Register a Connection
- Unregister
When the server runs in agent mode,
register and unregister
drive the auto-shutdown watchdog. The same agent_session_name registered twice
by the same user counts as a single connection — registration is idempotent on
the connection ID.Multi-tenant Operations
Multi-tenant Operations
Create tenant:Add user to tenant:Create role:Assign user to role:Grant dataset permissions:
API Reference
Explore all API endpoints
Setup Configuration
Configure providers and databases
MCP Integration
Set up AI assistant integration