Skip to main content
Connect Dify to cognee’s AI memory engine with the Cognee tool plugin. Remember text, recall it with automatic search routing, keep per-conversation session memory, and manage datasets directly from your Dify apps and workflows. No code required. The plugin talks to the Cognee HTTP API, so it works with both Cognee Cloud and a self-hosted Cognee server. It is tested with Cognee v1.6.1. Other versions may expose different API endpoints.

Setup

Install the Cognee plugin in your Dify workspace, then configure the provider credentials: You need either an API key or both an email and a password. If you set both, the plugin uses the API key. On save, the plugin runs a health check against the server. It then lists datasets with the API key, or logs in with the email and password.

Cognee Cloud

  1. Get your tenant URL and API key from the Cognee Cloud dashboard.
  2. Enter them as Cognee Server URL and API Key. Leave the email and password empty.

Self-hosted server

Run a Cognee 1.6.1 server that the plugin can reach:
For Docker, put your LLM_API_KEY in a .env file next to the compose file, then run docker compose up -d. Verify that the server is up:
Then configure the plugin with http://localhost:8000 and either an API key or the email and password.
From Cognee 1.6, the default user has a password only if the server was started with DEFAULT_USER_PASSWORD set. Without it, email and password login fails with “This Cognee user has no password”. Both options above set the variable. You can also use an API key instead. See Default user credentials.
To use an API key with a self-hosted server, create one with POST /api/v1/auth/api-keys:
Paste the returned key into API Key and leave the email and password empty.
If the plugin runs on your host and not inside Docker, use localhost. If the plugin also runs in Docker, use host.docker.internal. Change the default credentials before production use.

Tools

The five memory tools cover most workflows: The lower-level tools give you finer control:
Remember, Cognify, Improve and Update Data can run for a long time on large datasets. If they time out, raise Dify’s own limits, such as PLUGIN_DAEMON_TIMEOUT and GUNICORN_TIMEOUT in Dify’s docker/.env.

Typical Workflow

  1. Remember to store text and build the memory in one step.
  2. Recall before the LLM node, wiring its answer (or results_text) into the prompt.
For chat memory across runs, pass the conversation ID as Session ID to Recall. Then add a Remember Entry node after the LLM node with the same Session ID. Run Improve with those session IDs from time to time to save them into the graph. Use Create Dataset, Add Data or Add File, then Cognify instead of Remember when you need data IDs, need to upload files, or want to run cognify separately. Use Search instead of Recall to pick the search type yourself. To remove data, use Forget, Delete Dataset or Delete Data.

Migrating from Cognee (Self-Hosted)

Earlier versions shipped a separate Cognee (Self-Hosted) plugin (provider topoteretes/cognee_sdk) for email and password login. The Cognee plugin replaces it. It has the same tools, parameters and output variables, plus API-key auth and the tools that used to be cloud-only. An installed cognee_sdk plugin keeps working but gets no more updates. To switch:
  1. Install Cognee alongside it and configure the same server URL and credentials (or an API key).
  2. In each workflow, replace every cognee_sdk tool node with the same tool from Cognee. In agent apps, swap the tool in the agent’s tool list.
  3. Uninstall cognee_sdk.

Trigger Cognee over HTTP (no plugin)

If you already run the conversational layer in Dify and just want to pull memory into a prompt with minimal setup, skip the marketplace plugin and call Cognee’s REST API directly from a Dify HTTP Request node. This works against any self-hosted Cognee OSS server — all routes live under /api/v1/*. See the HTTP API reference and the Deploy a REST API server guide.

1. Get a token

Unless the server runs with auth off (ENABLE_BACKEND_ACCESS_CONTROL=false), first exchange credentials for a JWT. POST /api/v1/auth/login expects form-encoded fields:
The response is { "access_token": "...", "token_type": "bearer" }. Store access_token in a Dify variable and send it as Authorization: Bearer {{access_token}} on every later call. Tokens expire after JWT_LIFETIME_SECONDS (default 3600), and are revoked earlier if the user’s password changes (see Session revocation on password change).

2. Search from your workflow

Add an HTTP Request node that queries memory before your LLM node, passing the user’s message as the query:
Set "only_context": true to get back the prompt Cognee would have sent (instead of a Cognee-generated answer) and feed it to your own model. See search basics for the available search_type values.
To ingest and process data over HTTP too, use POST /api/v1/add (multipart form: data files + datasetName) followed by POST /api/v1/cognify (JSON: { "datasets": ["my-dataset"] }). Point the URL at whichever backend you deploy — http://localhost:8000 for a local server, or your hosted host name.

Plugin source

View the Cognee Dify plugin on GitHub