Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.cognee.ai/llms.txt

Use this file to discover all available pages before exploring further.

The Cognee Python SDK connects to Cognee Cloud via cognee.serve(). Once connected, all operations (remember, recall, forget, improve) route to your cloud tenant.
The same cognee package is used for both local and cloud workflows. The only difference is calling cognee.serve() to connect to a remote instance.

Install

pip install cognee

Complete example

import asyncio
import cognee

async def main():
    # Connect to Cognee Cloud
    await cognee.serve(
        url="https://your-tenant.aws.cognee.ai",
        api_key="your-api-key"
    )

    # Store content in memory — ingests, builds knowledge graph, enriches
    await cognee.remember(
        "Cognee Cloud automates knowledge graph creation in the cloud.",
        dataset_name="default_dataset",
    )

    # Retrieve from memory
    results = await cognee.recall(
        query_text="What does Cognee Cloud automate?",
    )
    for result in results:
        print(result)

    # Disconnect when done
    await cognee.disconnect()

asyncio.run(main())

What just happened

Connecting to cloud

Pass your tenant URL and API key to cognee.serve():
await cognee.serve(
    url="https://your-tenant.aws.cognee.ai",
    api_key="your-api-key"
)
Create an API key from the API Keys page in the Cognee Cloud console. You can find your tenant URL there as well.

Storing data

await cognee.remember(
    "Cognee Cloud automates knowledge graph creation in the cloud.",
    dataset_name="default_dataset",
)
remember ingests data and builds the knowledge graph in a single call. Data is organized by dataset for isolation and permissions. For more control, use the lower-level add and cognify operations separately.

Retrieving data

results = await cognee.recall(
    query_text="What does Cognee Cloud automate?",
)
recall auto-routes the query to the best retrieval strategy. For direct control over search types, see Search Basics.

Disconnecting

await cognee.disconnect()
Closes the connection to the cloud tenant. Credentials remain cached for the next session.

Next steps

Cloud functionality

Explore the full API surface available in Cognee Cloud.

Cloud MCP

Connect MCP-compatible clients to Cognee Cloud.