Skip to main content
Cognee provides memory for agents built with any framework. Three integration methods are available: the Python SDK, an MCP server, and the REST API.

Python SDK

Works with any agent framework. Install Cognee, connect to your tenant, and call remember / recall from your agent code.
pip install cognee
import cognee

# Connect to Cognee Cloud (opens browser for login)
await cognee.serve()

# Store knowledge from your agent
await cognee.remember("User prefers dark mode and concise answers.")

# Retrieve relevant context
results = await cognee.recall("What are the user preferences?")

# Disconnect when done (credentials saved for next session)
await cognee.disconnect()
The SDK is framework-agnostic. Call remember() and recall() from within tool functions, hooks, or middleware — regardless of whether you use LangGraph, CrewAI, OpenClaw, AutoGen, or a custom framework. See the integration guides for framework-specific examples.

MCP server

Cognee runs as a Model Context Protocol server. Any MCP-compatible client (Claude Desktop, Cursor, VS Code Copilot) can use it as a tool provider. Start the server:
cognee mcp --transport sse --port 8001
Add to your MCP client config:
{
  "mcpServers": {
    "cognee": {
      "url": "http://localhost:8001/sse"
    }
  }
}
Available tools:
ToolDescription
rememberIngest data and build the knowledge graph in one call
recallRetrieve information from the knowledge graph
cognifyBuild the knowledge graph from ingested data
searchQuery the knowledge graph with a specific search type
forget_memoryRemove data from the knowledge graph
improveEnrich the knowledge graph with additional processing
list_dataList datasets and their data items
deleteDelete specific data from a dataset
delete_datasetDelete an entire dataset
pruneReset the knowledge graph
save_interactionLog user-agent interactions
cognify_statusCheck the status of the cognify pipeline
For detailed setup per client, see the MCP integration guides.

REST API

Use the REST API directly from any language. Authenticate with an API key from the API Keys page.
# Store knowledge (ingests and builds graph in one call)
curl -X POST https://your-tenant.aws.cognee.ai/api/v1/remember \
  -H "X-Api-Key: your-key" \
  -F "data=@document.pdf" \
  -F "datasetName=agent_data"

# Retrieve from memory
curl -X POST https://your-tenant.aws.cognee.ai/api/v1/recall \
  -H "X-Api-Key: your-key" \
  -H "Content-Type: application/json" \
  -d '{"query": "What do we know?"}'
For lower-level control, you can use add + cognify + search separately. See the HTTP API reference for details on these and other endpoints.

Sharing datasets with agents

Once an agent is connected, you can share specific datasets with it from the Connections page. This grants the agent read access to the dataset through the dataset permissions system.