The Cognee connector lets your AI agent act in each user's Cognee account. Each user connects their own Cognee API key once, and Scalekit sends it with every call, so your agent never handles credentials. It comes with 17 tools.
- Tools
- 17
- What they doRead · write · destructive
- 10 · 5 · 210 read5 write2 destructive
- Users sign in with
- API key
Setup
Install the SDK
Terminal window npm install @scalekit-sdk/node dotenvTerminal window pip install scalekit-sdk-python python-dotenvSet 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>Create the Cognee connection
In AgentKit > Connections, create a Cognee connection. The name you give it is the
connection_nameyour code passes. See Configure connections.Console steps with screenshots
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.
-
-
Authorize a user and make your first call
quickstart.mts import { ScalekitClient } from '@scalekit-sdk/node'import 'dotenv/config'import { createInterface } from 'node:readline/promises'const scalekit = new ScalekitClient(process.env.SCALEKIT_ENVIRONMENT_URL,process.env.SCALEKIT_CLIENT_ID,process.env.SCALEKIT_CLIENT_SECRET,)const actions = scalekit.actionsconst connector = 'cognee'const identifier = 'user_123'// Generate an authorization link for the userconst { link } = await actions.getAuthorizationLink({ connectionName: connector, identifier })console.log('Authorize Cognee:', link)const rl = createInterface({ input: process.stdin, output: process.stdout })await rl.question('Press Enter after authorizing...')rl.close()// Make your first callconst result = await actions.executeTool({connector,identifier,toolName: 'cognee_check_status',toolInput: {},})console.log(result)Terminal window npx tsx quickstart.mtsquickstart.py import osfrom scalekit import ScalekitClientfrom dotenv import load_dotenvload_dotenv()scalekit_client = ScalekitClient(env_url=os.getenv("SCALEKIT_ENVIRONMENT_URL"),client_id=os.getenv("SCALEKIT_CLIENT_ID"),client_secret=os.getenv("SCALEKIT_CLIENT_SECRET"),)actions = scalekit_client.actionsconnection_name = "cognee"identifier = "user_123"# Generate an authorization link for the userlink_response = actions.get_authorization_link(connection_name=connection_name,identifier=identifier,)print("Authorize Cognee:", link_response.link)input("Press Enter after authorizing...")# Make your first callresult = actions.execute_tool(tool_input={},tool_name="cognee_check_status",connection_name=connection_name,identifier=identifier,)print(result)Terminal window python quickstart.pyEach user opens the link once and enters their Cognee credentials there. If your app already has a user's credentials, add the account from your backend instead, as the console steps above show. See Authorize a user for the full flow and statuses.
Tools
Pass the exact name toexecute_toolcognee_check_statusCheck the processing status of Cognee datasets' pipelines.Read-onlyCheck 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.
Inputs
datasetarray- JSON array of dataset UUIDs to check (from List datasets). Omit to get status for all datasets you can read.
pipelinearray- JSON array of pipeline names to check: 'add_pipeline' or 'cognify_pipeline'. Omit to default to cognify_pipeline.
cognee_get_dataset_data_rawDownload the original raw content of a single data item that was ingested into a Cognee dataset.Read-onlyGet raw data item
Download the original raw content of a single data item that was ingested into a Cognee dataset. Use List dataset data first to find a data item's ID.
Inputs
data_idstringrequired- UUID of the data item to download. Get it from List dataset data.
dataset_idstringrequired- UUID of the dataset that owns the data item. Get it from List datasets.
cognee_get_dataset_graphRetrieve the raw knowledge graph structure (nodes and edges) that Improve built for a Cognee dataset.Read-onlyGet dataset graph
Retrieve the raw knowledge graph structure (nodes and edges) that Improve built for a Cognee dataset. Use this to inspect exactly which entities and relationships were extracted, separate from running a Recall search over them.
Inputs
dataset_idstringrequired- UUID of the dataset whose graph structure to retrieve. Get it from List datasets.
cognee_get_dataset_schemaRetrieve the graph schema configuration (the entity and relationship types recognized when building the knowledge graph) for a Cognee dataset.Read-onlyGet dataset schema
Retrieve the graph schema configuration (the entity and relationship types recognized when building the knowledge graph) for a Cognee dataset.
Inputs
dataset_idstringrequired- UUID of the dataset whose schema to retrieve. Get it from List datasets.
cognee_list_dataset_dataList the individual data items stored in a Cognee dataset, with their UUIDs.Read-onlyList 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.
Inputs
dataset_idstringrequired- UUID of the dataset whose data items to list. Get it from List datasets.
cognee_list_datasetsList the Cognee datasets accessible to the connected account, with their names and UUIDs.Read-onlyList 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.
Inputs
This tool takes no inputs.
cognee_list_ontologiesList the OWL ontology files uploaded to this Cognee account.Read-onlyList ontologies
List the OWL ontology files uploaded to this Cognee account. Ontologies constrain the entity and relationship types extracted when datasets are processed by Improve.
Inputs
This tool takes no inputs.
cognee_recallRecall data previously saved to Cognee memory.Read-onlyRecall
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.
Inputs
querystringrequired- The natural-language question or search query to run against stored memory.
datasetsarray- JSON array of dataset names to search. Names resolve only to datasets owned by the caller. Omit to search all accessible datasets.
nodeNamearray- JSON array of node-set tags to restrict results to (the node_set values used when the data was remembered).
scopearray- JSON array selecting which memory sources to include, e.g. 'graph', 'session', 'triplets'. Omit to use the default graph search.
searchTypestring- Retrieval 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.one of
GRAPH_COMPLETIONRAG_COMPLETIONCHUNKSSUMMARIESHYBRID_COMPLETIONTRIPLET_COMPLETIONGRAPH_COMPLETION_DECOMPOSITIONGRAPH_SUMMARY_COMPLETIONGRAPH_COMPLETION_COTGRAPH_COMPLETION_CONTEXT_EXTENSIONNATURAL_LANGUAGECYPHERTEMPORALFEELING_LUCKYCODING_RULESCHUNKS_LEXICALAGENTIC_COMPLETION sessionIdstring- Session whose cached memory entries should also be searched. Pair with scope including 'session' to recall data saved with a session_id.
systemPromptstring- Optional instructions that guide how the answer is generated for completion-type search strategies.
topKinteger- Maximum number of results to consider during retrieval. Defaults to 15.
cognee_recall_historyGet the authenticated user's history of prior recall (search) queries and results, each with id, text, user, and created_at.Read-onlyRecall history
Get the authenticated user's history of prior recall (search) queries and results, each with id, text, user, and created_at. Note: verified against the live API — this is a GET on the same path as the existing Recall tool's POST (/api/v1/recall), not a separate /history sub-path; the two are distinguished by HTTP method.
Inputs
This tool takes no inputs.
cognee_visualizeGenerate a human-viewable HTML visualization of a dataset's knowledge graph — an interactive page with nodes and edges — distinct from Get dataset graph, which returns the raw node/edge JSON.Read-onlyVisualize
Generate a human-viewable HTML visualization of a dataset's knowledge graph — an interactive page with nodes and edges — distinct from Get dataset graph, which returns the raw node/edge JSON. By default renders a bounded subgraph around relevant seed nodes (from a semantic query, or the graph's highest-degree nodes); pass full=true to render the entire graph. Note: verified against the live API — this is a GET with query parameters, not a POST as originally listed.
Inputs
dataset_idstringrequired- UUID of the dataset to visualize. Get it from List datasets.
fullboolean- Render the entire graph instead of a bounded subgraph around seed nodes.default
false max_nodesinteger- Hard cap on rendered nodes after neighborhood expansion (1-5000). Defaults to 500.default
500 neighborhood_depthinteger- k-hop neighborhood depth for subgraph expansion around seed nodes (1-10). Defaults to 2.default
2 neighborhood_seed_top_kinteger- Maximum number of seed nodes used to start subgraph expansion (1-100). Defaults to 10.default
10 querystring- Query string whose nearest vector-search hits seed the subgraph. Omit to seed from the graph's highest-degree nodes.
cognee_create_datasetCreate a new, empty Cognee dataset by name.WriteCreate 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.
Inputs
namestringrequired- Name of the dataset to create. If a dataset with this name already exists for the account, the existing one is returned.
cognee_dataset_schema_updateStore or update the graph schema (entity/relationship type constraints) and/or custom extraction prompt for a dataset.WriteUpdate dataset schema
Store or update the graph schema (entity/relationship type constraints) and/or custom extraction prompt for a dataset. The existing Get dataset schema tool only reads this configuration; this tool writes it. Provide graph_schema, custom_prompt, or both — omitted fields are left unchanged.
- Idempotent
Inputs
dataset_idstringrequired- UUID of the dataset whose schema to update. Get it from List datasets.
custom_promptstring- Custom entity-extraction prompt to store for this dataset. Used during Improve/Remember instead of the default prompt.
graph_schemaobject- JSON object defining the entity/relationship type constraints (graph schema) to store for this dataset.
cognee_improveImprove stored memory by running Cognee's enrichment pipeline (the 'memify'/cognify step) over a dataset.WriteImprove
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.
Inputs
datastring- Optional custom text to enrich the graph with. When omitted, the existing knowledge graph is used as the input.
datasetIdstring- UUID of the dataset to improve. Alternative to datasetName; required for datasets shared with you.
datasetNamestring- Name of the dataset to improve. Resolved against datasets owned by the authenticated user.
nodeNamearray- JSON array of node-set tags to scope the enrichment to.
runInBackgroundboolean- If 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.
sessionIdsarray- JSON array of session IDs whose cached memory should be bridged into the permanent graph during this pass.
cognee_remember_entryStore a single typed memory entry directly into the session cache (or, for skill runs, the permanent graph), bypassing the bulk ingest+cognify flow used by Improve/Remember.WriteRemember Entry
Store a single typed memory entry directly into the session cache (or, for skill runs, the permanent graph), bypassing the bulk ingest+cognify flow used by Improve/Remember. The entry object must include a 'type' discriminator set to one of: 'qa' (fields: question, answer, context, feedback_text, feedback_score), 'trace' (fields: origin_function, status ['success'|'error'], method_params, method_return_value, memory_query, memory_context, error_message), 'feedback' (fields: qa_id — the entry_id from a prior qa entry — feedback_text, feedback_score), or 'skill_run' (fields: selected_skill_id, task_text, result_summary, success_score [0-1], feedback [-1 to 1], error_type, error_message, started_at_ms, latency_ms, candidate_skill_ids, task_pattern_id, router_version, tool_trace, node_set). session_id is required for qa/trace/feedback entries; skill_run entries can persist with or without one.
Inputs
entryobjectrequired- The typed memory entry object. Must include a 'type' key set to 'qa', 'trace', 'feedback', or 'skill_run', plus that type's fields (see tool description for the full field list per type).
dataset_idstring- UUID of an existing writable dataset. Takes precedence over dataset_name and is required to target a dataset shared with you by ID.
dataset_namestring- Target dataset name. Defaults to main_dataset.default
main_dataset session_idstring- Session this entry belongs to. Required for qa/trace/feedback entries; optional for skill_run entries.
skill_improvementobject- Optional structured feedback for improving a skill, attached alongside a skill_run entry.
cognee_skill_ingestIngest a reusable skill from inline SKILL.md markdown text, without uploading a file.WriteIngest Skill
Ingest a reusable skill from inline SKILL.md markdown text, without uploading a file. This is the JSON-native companion to the multipart-only Remember endpoint's skills mode (content_type=skills) — it reuses the same skills ingestion pipeline for no-code clients. Either dataset_name or dataset_id must be provided.
Inputs
skills_textstringrequired- Inline SKILL.md markdown content to ingest as a Skill node.
dataset_idstring- Target dataset UUID (alternative to dataset_name).
dataset_namestring- Target dataset name (created if it does not exist). Required unless dataset_id is given.
skill_namestring- Name/slug for the skill. Defaults to 'skill' if omitted.
cognee_forgetForget stored data in Cognee memory.DestructiveForget
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.
- Idempotent
Inputs
dataIdstring- UUID of a single data item to remove from a dataset. Requires datasetId.
datasetstring- Name of the dataset to delete. Provide either this or datasetId. With memoryOnly=true, only the memory graph is cleared and the dataset is kept.
datasetIdstring- UUID of the dataset to delete. Alternative to dataset. Also required when deleting a single data item via dataId.
everythingboolean- DANGER: when true, permanently deletes ALL datasets and all memory owned by the account. Use with extreme caution.
memoryOnlyboolean- When true and a dataset is given, delete only the memory graph (graph nodes) while keeping the dataset and its raw data.
cognee_ontology_deleteDelete an uploaded OWL ontology by its key, exactly as provided at upload time.DestructiveDelete ontology
Delete an uploaded OWL ontology by its key, exactly as provided at upload time. Use List Ontologies to find available keys.
- Idempotent
Inputs
ontology_keystringrequired- Key of the ontology to delete, exactly as provided at upload time.
No tools match.
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.data) # 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.data.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: pass the content in data, and cognee_improve ingests and graphs it.
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.data)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.data)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.data.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.data.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.data)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.data)# 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.data)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.data["id"]
# 2. Add data and build the knowledge graphactions.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.data)
# 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.data.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.data.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. 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"])