Cognee connector
API KeyAIDatabasesUse Cognee to recall, enrich, and manage your AI agent's memory in a knowledge graph.
Cognee connector
-
Install the SDK
Section titled “Install the SDK”Terminal window npm install @scalekit-sdk/nodeTerminal window pip install scalekit -
Set your credentials
Section titled “Set your credentials”Add your Scalekit credentials to your
.envfile. Find values in app.scalekit.com > Developers > API Credentials..env SCALEKIT_ENVIRONMENT_URL=<your-environment-url>SCALEKIT_CLIENT_ID=<your-client-id>SCALEKIT_CLIENT_SECRET=<your-client-secret> -
Set up the connector
Section titled “Set up the connector”Register your Cognee credentials with Scalekit so it can authenticate requests on your behalf. You do this once per environment.
Dashboard setup steps
Register your Cognee API key with Scalekit so it can authenticate requests on your behalf. You’ll need an API key and your Cognee Cloud API host from platform.cognee.ai.
-
Generate an API key
-
Sign in to platform.cognee.ai and go to Dashboard → API Keys.
-
Click Create API key, enter a name (e.g.,
Agent Auth), and confirm. -
Copy the key and note your API host (e.g.,
your-tenant.aws.cognee.ai) — you’ll need both in step 3.
-
-
Create a connection
In Scalekit dashboard, go to AgentKit > Connections > Create Connection. Find Cognee and click Create.
-
Create a connected account
Go to Connected Accounts for your Cognee connection and click Add account. Fill in the required fields:
-
Your User’s ID — a unique identifier for the user in your system
-
API Key — the API key you copied in step 1
-
API Host — your Cognee Cloud API host without the
https://prefix (e.g.,your-tenant.aws.cognee.ai) -
Click Save.
-
-
-
Make your first call
Section titled “Make your first call”quickstart.ts import { ScalekitClient } from '@scalekit-sdk/node'import 'dotenv/config'const scalekit = new ScalekitClient(process.env.SCALEKIT_ENV_URL,process.env.SCALEKIT_CLIENT_ID,process.env.SCALEKIT_CLIENT_SECRET,)const actions = scalekit.actionsconst connector = 'cognee'const identifier = 'user_123'// Make your first callconst result = await actions.executeTool({connector,identifier,toolName: 'cognee_list_datasets',toolInput: {},})console.log(result)quickstart.py import osfrom scalekit.client import ScalekitClientfrom dotenv import load_dotenvload_dotenv()scalekit_client = ScalekitClient(env_url=os.getenv("SCALEKIT_ENV_URL"),client_id=os.getenv("SCALEKIT_CLIENT_ID"),client_secret=os.getenv("SCALEKIT_CLIENT_SECRET"),)actions = scalekit_client.actionsconnection_name = "cognee"identifier = "user_123"# Make your first callresult = actions.execute_tool(tool_input={},tool_name="cognee_list_datasets",connection_name=connection_name,identifier=identifier,)print(result)
What you can do
Section titled “What you can do”Connect this agent connector to let your agent:
- Recall records — Search Cognee’s knowledge graph by meaning and get back an answer or matching context
- Improve records — Enrich a dataset’s knowledge graph with new text, or reprocess the existing graph to sharpen later recall
- Forget records — Permanently delete a dataset (by name or ID), a single data item, or just its memory graph
- List datasets — Discover the dataset names and UUIDs accessible to the connected account
- List dataset data — Inspect the individual data items stored in a dataset, with their UUIDs
- Check status — Check the processing status of a dataset’s ingestion or enrichment pipeline
- Create dataset — Provision a new, empty dataset up front by name
Common workflows
Section titled “Common workflows”Proxy API call
const result = await actions.request({ connectionName: 'cognee', identifier: 'user_123', path: '/api/v1/recall', method: 'POST', body: { query: 'What plan did Acme Corp sign up for?' },});console.log(result.data);result = actions.request( connection_name='cognee', identifier='user_123', path="/api/v1/recall", method="POST", json={"query": "What plan did Acme Corp sign up for?"},)print(result)Create a dataset
Provision an empty dataset up front by name. This is optional — cognee_improve creates a dataset automatically the first time you add data to it — but useful when you want the dataset’s UUID before ingesting anything.
result = actions.execute_tool( connection_name='cognee', identifier='user_123', tool_name="cognee_create_dataset", tool_input={"name": "sales_notes"})
print(result.result) # includes the new dataset's UUIDList datasets
Discover the dataset names and UUIDs available to the connected account. Use the returned UUIDs anywhere a tool accepts datasetId — cognee_recall, cognee_improve, cognee_forget, or cognee_check_status.
result = actions.execute_tool( connection_name='cognee', identifier='user_123', tool_name="cognee_list_datasets", tool_input={})
for dataset in result.result.get("datasets", []): print(f"{dataset['name']}: {dataset['id']}")Add data to a dataset
Add text to a dataset and build its knowledge graph in one call. This is the current workaround for cognee_remember (coming soon) — pass the content in data and cognee_improve ingests and graphs it the same way.
result = actions.execute_tool( connection_name='cognee', identifier='user_123', tool_name="cognee_improve", tool_input={ "data": "Acme Corp signed a 2-year contract on 2026-01-15 for the Enterprise plan.", "datasetName": "sales_notes", })
print(result.result)Check pipeline status
Poll the processing status of a dataset’s ingestion or enrichment pipeline — useful after calling cognee_improve with runInBackground: true, or to confirm the knowledge graph has finished building before recalling.
result = actions.execute_tool( connection_name='cognee', identifier='user_123', tool_name="cognee_check_status", tool_input={ "dataset": ["3fa85f64-5717-4562-b3fc-2c963f66afa6"], "pipeline": ["cognify_pipeline"], })
print(result.result)Recall by meaning
Search a dataset’s knowledge graph with a natural-language question. cognee_recall returns a graph-grounded answer by default — use searchType to switch retrieval strategies.
result = actions.execute_tool( connection_name='cognee', identifier='user_123', tool_name="cognee_recall", tool_input={ "query": "What plan did Acme Corp sign up for, and when?", "datasets": ["sales_notes"], "topK": 10, })
print(result.result.get("answer"))List the data in a dataset
Inspect the individual data items stored in a dataset, with their UUIDs. Use a returned dataId with cognee_forget to delete a single item instead of the whole dataset.
result = actions.execute_tool( connection_name='cognee', identifier='user_123', tool_name="cognee_list_dataset_data", tool_input={"dataset_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6"})
for item in result.result.get("data", []): print(f"{item['id']}: {item.get('name', 'untitled')}")Consolidate session memory
Bridge memory cached under a session ID into the permanent knowledge graph, so it becomes searchable by cognee_recall outside that session.
result = actions.execute_tool( connection_name='cognee', identifier='user_123', tool_name="cognee_improve", tool_input={ "datasetName": "sales_notes", "sessionIds": ["agent-run-1718000000"], "runInBackground": True, # return immediately; graph builds server-side })
print(result.result)Delete a dataset, an item, or everything
cognee_forget deletes at three levels of scope — a single data item, a whole dataset, or (with everything) every dataset on the account. Each level is permanent and cannot be undone.
# Delete a single data itemresult = actions.execute_tool( connection_name='cognee', identifier='user_123', tool_name="cognee_forget", tool_input={ "datasetId": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "dataId": "7b1c9f0e-2c3d-4e5f-8a9b-0c1d2e3f4a5b", })print(result.result)# Delete an entire dataset by nameresult = actions.execute_tool( connection_name='cognee', identifier='user_123', tool_name="cognee_forget", tool_input={"dataset": "sales_notes"})print(result.result)End-to-end workflow: create, improve, check status, recall, list, forget
A typical Cognee session provisions a dataset, adds data to it, waits for the graph to build, queries it, inspects what’s stored, and cleans up when it’s no longer needed.
# 1. Create the dataset up front to get its UUIDcreate_result = actions.execute_tool( connection_name='cognee', identifier='user_123', tool_name="cognee_create_dataset", tool_input={"name": "support_thread_4821"})dataset_id = create_result.result["id"]
# 2. Add data and build the knowledge graph (cognee_remember workaround)actions.execute_tool( connection_name='cognee', identifier='user_123', tool_name="cognee_improve", tool_input={ "data": "Customer reported a login failure on 2026-02-03. Root cause: expired SSO certificate. Resolved by rotating the certificate.", "datasetId": dataset_id, "runInBackground": True, })
# 3. Poll until the enrichment pipeline finishesstatus_result = actions.execute_tool( connection_name='cognee', identifier='user_123', tool_name="cognee_check_status", tool_input={"dataset": [dataset_id]})print(status_result.result)
# 4. Recall the relevant context once processing completesrecall_result = actions.execute_tool( connection_name='cognee', identifier='user_123', tool_name="cognee_recall", tool_input={ "query": "Why did the customer's login fail, and how was it fixed?", "datasets": ["support_thread_4821"], })print(recall_result.result.get("answer"))
# 5. List what's in the dataset before deciding to clean it uplist_result = actions.execute_tool( connection_name='cognee', identifier='user_123', tool_name="cognee_list_dataset_data", tool_input={"dataset_id": dataset_id})print(f"{len(list_result.result.get('data', []))} item(s) in the dataset")
# 6. Forget the dataset once the thread is closed and no longer neededactions.execute_tool( connection_name='cognee', identifier='user_123', tool_name="cognee_forget", tool_input={"datasetId": dataset_id})LangChain integration
Let an LLM decide which Cognee tool to call based on natural language. This example builds an agent that can create datasets, enrich memory, recall it, inspect it, and clean it up on demand.
from langchain_openai import ChatOpenAIfrom langchain.agents import AgentExecutor, create_openai_tools_agentfrom langchain_core.prompts import ( ChatPromptTemplate, SystemMessagePromptTemplate, HumanMessagePromptTemplate, MessagesPlaceholder, PromptTemplate)
# Load all Cognee tools in LangChain format. Use page_size=100 so connector tool lists are not truncated.tools = actions.langchain.get_tools( identifier='user_123', providers=["COGNEE"], page_size=100)
prompt = ChatPromptTemplate.from_messages([ SystemMessagePromptTemplate(prompt=PromptTemplate( input_variables=[], template=( "You are an assistant with access to Cognee memory tools. " "Use cognee_list_datasets to discover existing datasets, cognee_create_dataset " "to provision a new one, cognee_improve to add or enrich data in a dataset, " "cognee_check_status to confirm a pipeline has finished, cognee_recall to search " "stored memory by meaning, cognee_list_dataset_data to inspect what a dataset " "contains, and cognee_forget to delete a dataset or data item. cognee_remember " "is not available yet — use cognee_improve with the data field instead. Always " "confirm before calling cognee_forget." ) )), MessagesPlaceholder(variable_name="chat_history", optional=True), HumanMessagePromptTemplate(prompt=PromptTemplate( input_variables=["input"], template="{input}" )), MessagesPlaceholder(variable_name="agent_scratchpad")])
llm = ChatOpenAI(model="gpt-4o")agent = create_openai_tools_agent(llm, tools, prompt)agent_executor = AgentExecutor(agent=agent, tools=tools, verbose=True)
result = agent_executor.invoke({ "input": "Remember that Acme Corp renewed their contract today for the Enterprise plan, then tell me what we know about Acme Corp."})print(result["output"])Tool list
Section titled “Tool list”Use the exact tool names from the Tool list below when you call execute_tool. If you’re not sure which name to use, list the tools available for the current user first.
cognee_check_status#Check the processing status of Cognee datasets' pipelines. Use this to track an Improve run started with runInBackground=true, or to confirm ingestion/graph-building has completed before recalling.2 params
Check the processing status of Cognee datasets' pipelines. Use this to track an Improve run started with runInBackground=true, or to confirm ingestion/graph-building has completed before recalling.
datasetarrayoptionalJSON array of dataset UUIDs to check (from List datasets). Omit to get status for all datasets you can read.pipelinearrayoptionalJSON array of pipeline names to check: 'add_pipeline' or 'cognify_pipeline'. Omit to default to cognify_pipeline.cognee_create_dataset#Create a new, empty Cognee dataset by name. Returns the dataset's UUID. Datasets are also created automatically by Improve, so use this only when you want to provision a dataset up front.1 param
Create a new, empty Cognee dataset by name. Returns the dataset's UUID. Datasets are also created automatically by Improve, so use this only when you want to provision a dataset up front.
namestringrequiredName of the dataset to create. If a dataset with this name already exists for the account, the existing one is returned.cognee_forget#Forget stored data in Cognee memory. Deletes a dataset (by name or UUID), a single data item, or the memory graph of a dataset. This action is permanent and cannot be undone. Provide either dataset or datasetId; set everything only to wipe all datasets.5 params
Forget stored data in Cognee memory. Deletes a dataset (by name or UUID), a single data item, or the memory graph of a dataset. This action is permanent and cannot be undone. Provide either dataset or datasetId; set everything only to wipe all datasets.
dataIdstringoptionalUUID of a single data item to remove from a dataset. Requires datasetId.datasetstringoptionalName of the dataset to delete. Provide either this or datasetId. With memoryOnly=true, only the memory graph is cleared and the dataset is kept.datasetIdstringoptionalUUID of the dataset to delete. Alternative to dataset. Also required when deleting a single data item via dataId.everythingbooleanoptionalDANGER: when true, permanently deletes ALL datasets and all memory owned by the account. Use with extreme caution.memoryOnlybooleanoptionalWhen true and a dataset is given, delete only the memory graph (graph nodes) while keeping the dataset and its raw data.cognee_improve#Improve stored memory by running Cognee's enrichment pipeline (the 'memify'/cognify step) over a dataset. It re-processes and enriches the knowledge graph with entities and relationships, sharpening later recall. Runs over the existing graph when no data is supplied.6 params
Improve stored memory by running Cognee's enrichment pipeline (the 'memify'/cognify step) over a dataset. It re-processes and enriches the knowledge graph with entities and relationships, sharpening later recall. Runs over the existing graph when no data is supplied.
datastringoptionalOptional custom text to enrich the graph with. When omitted, the existing knowledge graph is used as the input.datasetIdstringoptionalUUID of the dataset to improve. Alternative to datasetName; required for datasets shared with you.datasetNamestringoptionalName of the dataset to improve. Resolved against datasets owned by the authenticated user.nodeNamearrayoptionalJSON array of node-set tags to scope the enrichment to.runInBackgroundbooleanoptionalIf true, the request returns immediately while the graph builds server-side. If false (default), the request blocks until enrichment finishes, which can take minutes for large datasets.sessionIdsarrayoptionalJSON array of session IDs whose cached memory should be bridged into the permanent graph during this pass.cognee_list_dataset_data#List the individual data items stored in a Cognee dataset, with their UUIDs. Use the returned data IDs with Forget to remove a single item, or to inspect what a dataset contains.1 param
List the individual data items stored in a Cognee dataset, with their UUIDs. Use the returned data IDs with Forget to remove a single item, or to inspect what a dataset contains.
dataset_idstringrequiredUUID of the dataset whose data items to list. Get it from List datasets.cognee_list_datasets#List the Cognee datasets accessible to the connected account, with their names and UUIDs. Use this to discover dataset identifiers to pass to Recall, Improve, Forget, or the status check.0 params
List the Cognee datasets accessible to the connected account, with their names and UUIDs. Use this to discover dataset identifiers to pass to Recall, Improve, Forget, or the status check.
cognee_recall#Recall data previously saved to Cognee memory. Runs a semantic search over the knowledge graph (and, optionally, session memory) and returns an answer or matching context. Use searchType to control the retrieval strategy.8 params
Recall data previously saved to Cognee memory. Runs a semantic search over the knowledge graph (and, optionally, session memory) and returns an answer or matching context. Use searchType to control the retrieval strategy.
querystringrequiredThe natural-language question or search query to run against stored memory.datasetsarrayoptionalJSON array of dataset names to search. Names resolve only to datasets owned by the caller. Omit to search all accessible datasets.nodeNamearrayoptionalJSON array of node-set tags to restrict results to (the node_set values used when the data was remembered).scopearrayoptionalJSON array selecting which memory sources to include, e.g. 'graph', 'session', 'triplets'. Omit to use the default graph search.searchTypestringoptionalRetrieval strategy. GRAPH_COMPLETION (default) returns graph context plus an LLM answer. RAG_COMPLETION uses classic retrieval-augmented generation. CHUNKS and SUMMARIES return raw matching content. FEELING_LUCKY auto-selects a strategy.sessionIdstringoptionalSession whose cached memory entries should also be searched. Pair with scope including 'session' to recall data saved with a session_id.systemPromptstringoptionalOptional instructions that guide how the answer is generated for completion-type search strategies.topKintegeroptionalMaximum number of results to consider during retrieval. Defaults to 15.