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.- 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/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