### Quick Start Installation and Configuration Source: https://docs.cognee.ai/integrations/keywordsai-integration Provides a concise guide for installing the Keywords AI integration and configuring the necessary environment variables. This is a streamlined version of the full setup. ```bash pip install cognee-community-observability-keywordsai export MONITORING_TOOL=keywordsai export KEYWORDSAI_API_KEY= export LLM_API_KEY= ``` -------------------------------- ### Start Redis Server (Local) Source: https://docs.cognee.ai/core-concepts/sessions-and-caching Start a local Redis server instance using this command. Ensure Redis is installed on your system. ```bash # Or using local installation redis-server ``` -------------------------------- ### Install Project Dependencies Source: https://docs.cognee.ai/cognee-mcp/mcp-local-setup Install project dependencies using uv. Use --reinstall for the initial setup or if the environment seems stale. ```bash cd cognee-mcp uv sync --dev --all-extras --reinstall ``` -------------------------------- ### Install Cognee and Run API Client Source: https://docs.cognee.ai/integrations/dify-integration Installs the Cognee Python package and starts the API client. Requires an LLM_API_KEY to be set. ```bash pip install cognee==0.5.5 LLM_API_KEY=sk-your-openai-key-here python -m cognee.api.client ``` -------------------------------- ### Setup Python Environment for Cognee Source: https://docs.cognee.ai/guides/deploy-rest-api-server Create a virtual environment using 'uv' and activate it. Install Cognee with all extras using 'uv sync --all-extras'. ```bash uv venv && source .venv/bin/activate # Install with all extras uv sync --all-extras ``` -------------------------------- ### Full Session Example Source: https://docs.cognee.ai/guides/sessions Demonstrates initiating a conversation, performing follow-up questions within the same session, and starting a new, independent session. ```python import asyncio import cognee from cognee import SearchType async def main(): # Prepare knowledge base await cognee.add([ "Alice moved to Paris in 2010. She works as a software engineer.", "Bob lives in New York. He is a data scientist.", "Alice and Bob met at a conference in 2015." ]) await cognee.cognify() # First search - starts a new session (default user is used when none is passed) result1 = await cognee.search( query_type=SearchType.GRAPH_COMPLETION, query_text="Where does Alice live?", session_id="conversation_1" ) print("First answer:", result1[0]) # Follow-up search - uses conversation history result2 = await cognee.search( query_type=SearchType.GRAPH_COMPLETION, query_text="What does she do for work?", session_id="conversation_1" # Same session ) print("Follow-up answer:", result2[0]) # The LLM knows "she" refers to Alice from previous context # Different session - no memory of previous conversation result3 = await cognee.search( query_type=SearchType.GRAPH_COMPLETION, query_text="What does she do for work?", session_id="conversation_2" # New session ) print("New session answer:", result3[0]) # This won't know who "she" refers to asyncio.run(main()) ``` -------------------------------- ### Docker Setup for Redis Source: https://docs.cognee.ai/setup-configuration/vector-stores Starts a Redis instance with the Search module enabled using Docker. ```bash docker run -d --name redis -p 6379:6379 redis:8.0.2 ``` -------------------------------- ### Start Redis Server (Docker) Source: https://docs.cognee.ai/core-concepts/sessions-and-caching Run this command to start a Redis server using Docker. This is a quick way to get a Redis instance for local development or testing. ```bash # Using Docker docker run -d -p 6379:6379 redis:latest ``` -------------------------------- ### Start PostgreSQL Docker Compose Source: https://docs.cognee.ai/core-concepts/multi-user-mode/dataset-database-handlers/existing-dataset-database-handlers/pgvector Use Docker Compose to start a PostgreSQL instance if you are using the server setup provided by Cognee. ```bash docker compose --profile postgres up ``` -------------------------------- ### Install Modal CLI and Get Token Source: https://docs.cognee.ai/how-to-guides/cognee-sdk/deployment/modal Install the Modal CLI using pip and generate a new authentication token. Ensure you have Python and pip installed. ```bash pip install modal modal token new ``` -------------------------------- ### Quick Example: Add, Cognify, and Search Source: https://docs.cognee.ai/api-reference/introduction This example demonstrates a common workflow: adding data, processing it into a knowledge graph, and then searching that graph. It includes both Python and cURL examples. ```APIDOC ## Add Data ### Description Adds raw data to be processed into the knowledge graph. ### Method POST ### Endpoint /api/v1/add ### Request Body - **data** (string) - Required - The text data to add. ### Request Example ```json { "data": "AI is transforming how we work and live." } ``` ## Cognify Data ### Description Processes the added datasets into a knowledge graph. ### Method POST ### Endpoint /api/v1/cognify ### Request Body - **datasets** (array of strings) - Required - A list of dataset names to process. ### Request Example ```json { "datasets": ["main_dataset"] } ``` ## Search Knowledge Graph ### Description Searches the knowledge graph based on a query. ### Method POST ### Endpoint /api/v1/search ### Request Body - **query** (string) - Required - The search query. - **search_type** (string) - Required - The type of search to perform (e.g., GRAPH_COMPLETION). ### Request Example ```json { "query": "What is AI?", "search_type": "GRAPH_COMPLETION" } ``` ### Response #### Success Response (200) - **response** (object) - The search results. ### Response Example ```json { "response": { ... } } ``` ``` -------------------------------- ### Docker Setup for ChromaDB Source: https://docs.cognee.ai/setup-configuration/vector-stores Start a ChromaDB server using Docker. This command maps port 8000 from the container to the host. ```bash docker run -p 8000:8000 chromadb/chroma ``` -------------------------------- ### Install Cognee with uv Source: https://docs.cognee.ai/getting-started/installation Install Cognee using uv for default local databases. ```bash uv pip install cognee ``` -------------------------------- ### Install uv on Windows with PowerShell Source: https://docs.cognee.ai/getting-started/installation Install uv using the official standalone installer via PowerShell. ```powershell powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex" ``` -------------------------------- ### Install Cognee using Python with uv Source: https://docs.cognee.ai/getting-started/installation If uv is installed but not recognized, use this command to install Cognee. ```powershell python -m uv pip install cognee ``` -------------------------------- ### Run Cognee MCP via Stdio (Setup) Source: https://docs.cognee.ai/cognee-mcp/integrations/python-agent Clone the Cognee repository and install dependencies locally to use the stdio connection method. ```bash git clone https://github.com/topoteretes/cognee.git cd cognee/cognee-mcp uv sync --dev --all-extras ``` -------------------------------- ### Install Qdrant Adapter Package Source: https://docs.cognee.ai/core-concepts/multi-user-mode/dataset-database-handlers/existing-dataset-database-handlers/qdrant Install the necessary adapter package using pip. This command installs the Qdrant adapter for Cognee. ```bash pip install cognee-community-vector-adapter-qdrant ``` -------------------------------- ### Install Cognee with Groq extras Source: https://docs.cognee.ai/getting-started/installation Install Cognee with specific extras for Groq. ```bash uv pip install "cognee[groq]" ``` -------------------------------- ### Install Cognee OpenAI Agents SDK Source: https://docs.cognee.ai/integrations/openai-agents-sdk-integration Install the necessary package using pip. ```bash pip install cognee-integration-openai-agents ``` -------------------------------- ### Start Cognee API Server with Docker Compose Source: https://docs.cognee.ai/guides/deploy-rest-api-server Start the Cognee API server using Docker Compose. This command builds the necessary images and starts the container. Use 'docker compose ps' to check the status. ```bash docker compose up --build cognee # Check status docker compose ps ``` -------------------------------- ### Install @cognee/cognee-ts SDK Source: https://docs.cognee.ai/typescript/getting-started Install the SDK using npm. This command adds the necessary package to your project. ```bash npm install @cognee/cognee-ts ``` -------------------------------- ### Connect to Local Backend Source: https://docs.cognee.ai/core-concepts/main-operations/serve Start a local backend with the CLI and then connect the SDK to it by specifying the local URL. ```bash cognee serve ``` ```python await cognee.serve(url="http://localhost:8000") ``` -------------------------------- ### Complete Permission Setup Workflow Source: https://docs.cognee.ai/guides/permission-snippets Illustrates the full process of setting up permissions, including user and tenant creation, dataset authorization, and granting specific access rights. ```python from cognee.modules.users.methods import create_user, get_user from cognee.modules.users.tenants.methods import create_tenant, add_user_to_tenant from cognee.modules.data.methods import create_authorized_dataset from cognee.modules.users.permissions.methods import give_permission_on_dataset # 1. Create users user1 = await create_user("alice@company.com", "password123", is_superuser=True) user2 = await create_user("bob@company.com", "password456") # 2. Create tenant and add users await create_tenant("acme_corp", user1.id) # Refresh user1 to get tenant_id user1 = await get_user(user1.id) await add_user_to_tenant(user2.id, user1.tenant_id, user1.id) # 3. Create dataset dataset = await create_authorized_dataset("confidential_docs", user1) # 4. Grant different permissions await give_permission_on_dataset(user2, dataset.id, "read") # Read-only access ``` -------------------------------- ### Initialize Cognee schema with setup() Source: https://docs.cognee.ai/setup-configuration/relational-databases Run the `setup()` function to initialize the database schema, creating necessary tables. This is required if you encounter `DatabaseNotCreatedError` on a fresh Postgres database. ```python from cognee.modules.engine.operations.setup import setup await setup() ``` -------------------------------- ### Install and Use System Monitoring Tools Source: https://docs.cognee.ai/how-to-guides/cognee-sdk/deployment/ec2 Installs htop, iotop, and nethogs for system resource monitoring. Use htop for interactive process viewing, df -h for disk space, and free -m for memory usage. Monitor the Cognee service status and logs using systemctl and journalctl. ```bash # Install monitoring tools sudo apt install htop iotop nethogs -y # Check system resources htop df -h free -m # Monitor Cognee service sudo systemctl status cognee sudo journalctl -u cognee -f ``` -------------------------------- ### Install Cognee via Package with UV Source: https://docs.cognee.ai/getting-started/llm-quickstart-skill Installs Cognee using the 'uv' package manager in a new virtual environment. This is the fastest setup for new applications or notebooks. ```bash uv venv source .venv/bin/activate uv pip install cognee ``` -------------------------------- ### Install Databases and Qdrant Source: https://docs.cognee.ai/how-to-guides/cognee-sdk/deployment/ec2 Installs PostgreSQL and Neo4j databases, and sets up Qdrant vector database using Docker. Ensure PostgreSQL user and database are created. ```bash # Install PostgreSQL sudo apt install postgresql postgresql-contrib -y sudo -u postgres createuser --interactive cognee sudo -u postgres createdb cognee # Install Neo4j wget -O - https://debian.neo4j.com/neotechnology.gpg.key | sudo apt-key add - echo 'deb https://debian.neo4j.com stable 4.4' | sudo tee /etc/apt/sources.list.d/neo4j.list sudo apt update && sudo apt install neo4j -y # Install and configure Qdrant docker run -d --name qdrant -p 6333:6333 qdrant/qdrant ``` -------------------------------- ### Install Cognee with Distributed Support and Setup Modal Source: https://docs.cognee.ai/guides/distributed-execution Install the necessary Cognee extras for distributed execution and configure your Modal environment. This includes setting up your Modal account and creating a secret for environment variables. ```bash pip install cognee[distributed] modal setup modal secret create distributed_cognee ``` -------------------------------- ### Docker Compose for Postgres Source: https://docs.cognee.ai/setup-configuration/relational-databases Start the Postgres service using Docker Compose. Ensure you have Docker installed and configured. ```bash docker compose --profile postgres up -d ``` -------------------------------- ### Set up Cognee Environment Source: https://docs.cognee.ai/how-to-guides/cognee-sdk/deployment/ec2 Creates a virtual environment, installs Cognee with development dependencies, and configures essential environment variables for API keys and database connections. ```bash # Create virtual environment python3 -m venv cognee-env source cognee-env/bin/activate # Install Cognee with all dependencies uv sync --dev --all-extras --reinstall # Set up environment variables cat > .env << EOF OPENAI_API_KEY=your-openai-api-key POSTGRES_URL=postgresql://user:pass@localhost:5432/cognee NEO4J_URL=bolt://neo4j:password@localhost:7687 QDRANT_URL=http://localhost:6333 COGNEE_HOST=0.0.0.0 COGNEE_PORT=8000 EOF ``` -------------------------------- ### Prerequisites for Recall Operation Source: https://docs.cognee.ai/core-concepts/main-operations/recall Populate memory with `remember()` before calling `recall()`. This example demonstrates basic setup and a recall query. ```python import cognee await cognee.remember("Einstein was born in Ulm.") # creates databases + ingests results = await cognee.recall("Where was Einstein born?") ``` -------------------------------- ### Run Cognee Local UI with Backend Source: https://docs.cognee.ai/cognee-cloud/local-ui Combines adding sample data, building the knowledge graph, and starting the UI with the backend. Ensure to handle KeyboardInterrupt for graceful shutdown. ```python import asyncio import os import signal import time import cognee async def main(): # Add sample data await cognee.add( "Natural language processing (NLP) is an interdisciplinary subfield of computer science and information retrieval." ) await cognee.add( "Machine learning (ML) is a subset of artificial intelligence that focuses on algorithms and statistical models." ) # Build the knowledge graph await cognee.cognify() # Start the UI and backend child_pids = [] server = cognee.start_ui( pid_callback=child_pids.append, port=3000, open_browser=True, start_backend=True, backend_port=8000, ) if server: print("UI available at http://localhost:3000") print("Press Ctrl+C to stop...") try: while server.poll() is None: time.sleep(1) except KeyboardInterrupt: server.terminate() server.wait() for pid in child_pids: if pid != server.pid: os.kill(pid, signal.SIGTERM) else: print("Failed to start the UI server.") if __name__ == "__main__": asyncio.run(main()) ``` -------------------------------- ### Run Startup Migrations Source: https://docs.cognee.ai/core-concepts/sessions-and-caching Execute this command to create the necessary relational database tables for session lifecycle metadata. This ensures Cognee can persist session information. ```python await cognee.run_startup_migrations() ``` -------------------------------- ### Quick Start: Agent with Cognee Tools Source: https://docs.cognee.ai/integrations/strands-integration Initialize an agent with Cognee tools for remembering and recalling information. Optionally, start with a fresh memory state. ```python import os import cognee from cognee_integration_strands import cognee_tools, run_cognee_task from strands import Agent from strands.models.openai import OpenAIModel run_cognee_task(cognee.forget(everything=True)) # optional: start fresh model = OpenAIModel(client_args={"api_key": os.getenv("LLM_API_KEY")}, model_id="gpt-4o") agent = Agent(model=model, tools=cognee_tools()) # Store information agent("Remember that we signed a contract with Meditech Solutions for £1.2M.") # Retrieve it (even from a fresh agent — memory is persistent) print(agent("What is the value of the Meditech Solutions contract?")) ``` -------------------------------- ### Run OpenClaw Setup Source: https://docs.cognee.ai/integrations/openclaw-integration Execute the OpenClaw setup command. Use the --hybrid flag to keep built-in memory enabled alongside Cognee. ```bash openclaw cognee setup ``` ```bash openclaw cognee setup --hybrid ``` -------------------------------- ### Get Cognee Log File Location Source: https://docs.cognee.ai/setup-configuration/logging Run this Python snippet after importing cognee to retrieve the exact path of the log file. Ensure cognee is installed and imported before execution. ```python from cognee.shared.logging_utils import get_log_file_location print(get_log_file_location()) ``` -------------------------------- ### Create Knowledge Graph Source: https://docs.cognee.ai/guides/graph-visualization Starts from a clean state and ingests text to build the graph in one call. Ensure you have completed the Quickstart and have some remembered data or an existing knowledge graph. ```python await cognee.forget(everything=True) await cognee.remember( ["Alice knows Bob.", "NLP is a subfield of CS."], self_improvement=False, ) ``` -------------------------------- ### Create Environment File Source: https://docs.cognee.ai/cognee-mcp/mcp-local-setup Create a .env file to store your LLM API key. Replace 'your-openai-api-key' with your actual key. ```bash LLM_API_KEY="your-openai-api-key" ``` -------------------------------- ### Quick Start: LangGraph Agent with Cognee Memory Source: https://docs.cognee.ai/integrations/langgraph-integration Integrate Cognee's sessionized memory tools into a LangGraph agent and invoke it asynchronously. This example demonstrates storing and retrieving information using natural language. ```python import asyncio from langchain.agents import create_agent from langchain_core.messages import HumanMessage from cognee_integration_langgraph import get_sessionized_cognee_tools async def main(): # Build sessionized memory tools (omit the arg to auto-generate a session ID) add_tool, search_tool = get_sessionized_cognee_tools("user-123") # Create an agent with memory agent = create_agent( "openai:gpt-4o-mini", tools=[add_tool, search_tool], ) # Store and retrieve information (note: must use await with .ainvoke()) response = await agent.ainvoke({ "messages": [ HumanMessage(content="Remember: I like pizza and coding in Python") ] }) print(response["messages"][-1].content) if __name__ == "__main__": asyncio.run(main()) ``` -------------------------------- ### Create Cognee Quickstart Skill Directory Source: https://docs.cognee.ai/getting-started/llm-quickstart-skill Creates the necessary directory structure for the Cognee quickstart skill within the .claude/skills path. ```bash mkdir -p .claude/skills/cognee-quickstart ``` -------------------------------- ### Multi-Tenant Application Setup with Cognee Tools Source: https://docs.cognee.ai/integrations/langgraph-integration Isolate data per user or organization while sharing global knowledge. This snippet shows how to get sessionized Cognee tools for a specific user ID and create an agent with them. ```python # Per-user isolation add_tool, search_tool = get_sessionized_cognee_tools(session_id=user_id) agent = create_agent("openai:gpt-4o-mini", tools=[add_tool, search_tool]) ``` -------------------------------- ### Inject Context into LLM Calls with Cognee Source: https://docs.cognee.ai/cognee-mcp/integrations/python-agent This example shows how to retrieve context using the Cognee agent's `recall` tool and then use that context to inform an LLM's response. It requires the `openai` library to be installed. ```python import openai client = openai.AsyncOpenAI() async def answer_with_memory(session, question: str) -> str: result = await session.call_tool( "recall", arguments={ "query": question, "search_type": "GRAPH_COMPLETION", }, ) context = result.content[0].text response = await client.chat.completions.create( model="gpt-4o-mini", messages=[ {"role": "system", "content": f"Use this context to answer:\n\n{context}"}, {"role": "user", "content": question}, ], ) return response.choices[0].message.content ``` -------------------------------- ### Programmatic Directory Setup Source: https://docs.cognee.ai/setup-configuration/object-storage Configure Cognee's data and system root directories programmatically using environment variables and the Cognee SDK. ```python import os import cognee bucket = os.getenv("STORAGE_BUCKET_NAME", "my-cognee-bucket") data_dir = os.path.join("s3://", bucket, "data") system_dir = os.path.join("s3://", bucket, "system") cognee.config.data_root_directory(data_dir) cognee.config.system_root_directory(system_dir) ``` -------------------------------- ### Complete n8n Cognee Workflow Example Source: https://docs.cognee.ai/integrations/n8n-integration This JSON configuration defines a complete workflow using Cognee nodes in n8n. It includes nodes for adding data, cognifying it, and searching within the dataset. Ensure the 'type' and 'resource' fields match the installed Cognee nodes. ```json { "nodes": [ { "name": "Add Data", "type": "n8n-nodes-cognee.cognee", "parameters": { "resource": "addData", "operation": "add", "datasetName": "support_docs", "textData": ["FAQ: Reset password via account settings.", "Guide: Export data as CSV from dashboard."] } }, { "name": "Cognify", "type": "n8n-nodes-cognee.cognee", "parameters": { "resource": "cognify", "operation": "cognify", "datasets": ["support_docs"] } }, { "name": "Search", "type": "n8n-nodes-cognee.cognee", "parameters": { "resource": "search", "operation": "search", "searchType": "GRAPH_COMPLETION", "datasets": ["support_docs"], "query": "How do I export my data?", "topK": 5 } } ] } ``` -------------------------------- ### Quick Start: Add Cognee Memory Tools to Google ADK Agent Source: https://docs.cognee.ai/integrations/google-adk-integration Integrate Cognee's add_tool and search_tool into your Google ADK agent to enable persistent memory. This example demonstrates creating an agent, storing information, and retrieving it using natural language queries. ```python import asyncio from google.adk.agents import Agent from google.adk.runners import InMemoryRunner from cognee_integration_google_adk import add_tool, search_tool async def main(): # Create agent with memory agent = Agent( model="gemini-2.5-flash", name="assistant", description="An assistant with persistent memory", instruction="You are a helpful assistant with access to a knowledge base.", tools=[add_tool, search_tool], ) runner = InMemoryRunner(agent=agent) # Store information await runner.run_debug( "Remember: Acme Corp, healthcare, $1.2M contract" ) # Retrieve information events = await runner.run_debug( "What healthcare contracts do we have?" ) for event in events: if event.is_final_response() and event.content: for part in event.content.parts: if part.text: print(part.text) asyncio.run(main()) ``` -------------------------------- ### Setup Shared LLMGateway and Memory Utilities Source: https://docs.cognee.ai/guides/agent-memory-quickstart Initializes the Cognee environment, clears existing memory, and sets a baseline fact. This setup is shared by both agents. ```python import asyncio import os import warnings os.environ["LOG_LEVEL"] = "ERROR" os.environ["COGNEE_LOG_FILE"] = "false" warnings.filterwarnings("ignore") import cognee # noqa: E402 from cognee.infrastructure.llm.LLMGateway import LLMGateway # noqa: E402 SESSION_ID = "ticket_001" BUG = "Login fails with error XQ-99." FIX = "Set XQ_TOKEN=1 in the .env file." NO_INFO = "NO INFO AVAILABLE" async def setup() -> None: await cognee.forget(everything=True) await cognee.remember( ["Our app is a web service. Users log in to access their account."], self_improvement=False ) async def ask_llm(question: str, system_prompt: str) -> str: return await LLMGateway.acreate_structured_output( text_input=question, system_prompt=system_prompt, response_model=str, ) ``` -------------------------------- ### Install Cognee Plugin Locally for Development Source: https://docs.cognee.ai/integrations/openclaw-integration Install the Cognee plugin locally for development purposes. This involves navigating to the integration directory, installing dependencies, building the project, and then installing it locally. ```bash cd integrations/openclaw npm install && npm run build openclaw plugins install -l . ``` -------------------------------- ### Create and Activate Virtual Environment with uv Source: https://docs.cognee.ai/getting-started/installation Use uv to create a virtual environment and activate it. ```bash uv venv && source .venv/bin/activate ``` -------------------------------- ### Fallback Cognee Source Install Source: https://docs.cognee.ai/getting-started/llm-quickstart-skill Installs Cognee from source without development extras, used when the editable install with extras fails. ```bash uv pip install -e . ``` -------------------------------- ### Start llama-cpp-python Server Source: https://docs.cognee.ai/setup-configuration/llm-providers Start a local llama-cpp-python server to serve models. Ensure the model path is correct. ```bash python -m llama_cpp.server --model /path/to/your/model.gguf --port 8000 ``` -------------------------------- ### Start LiteLLM Proxy Source: https://docs.cognee.ai/integrations/aws-bedrock-integration Start the LiteLLM proxy server using your configuration file. The proxy will be accessible at `http://localhost:4000` by default. ```bash litellm --config config.yaml ``` -------------------------------- ### Install uv Package Manager Source: https://docs.cognee.ai/cognee-mcp/mcp-local-setup Install the uv package manager. Use Homebrew or the standalone installer for macOS/Linux, or PowerShell for Windows. ```bash # via Homebrew brew install uv # or via the standalone installer curl -LsSf https://astral.sh/uv/install.sh | sh ``` ```powershell # in PowerShell powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex" ``` ```bash pip install uv ``` -------------------------------- ### Install Cognee Ollama Extra Source: https://docs.cognee.ai/setup-configuration/embedding-providers Install the 'ollama' extra for Cognee if you are using Ollama embeddings. This ensures the necessary dependencies, including transformers, are installed. ```bash pip install 'cognee[ollama]' ``` -------------------------------- ### Full System Reset Example Source: https://docs.cognee.ai/python-api/prune Performs a full reset by removing raw files, graph and vector databases, metadata, and pipeline caches. Use with caution. ```python import cognee # Full reset: remove raw files, databases, and metadata await cognee.prune.prune_data() # wipes raw files from disk / S3 await cognee.prune.prune_system(metadata=True) # wipes graph, vector, relational DB, and cache ``` -------------------------------- ### Start Cognee Backend Instance Source: https://docs.cognee.ai/cognee-mcp/mcp-quickstart Run a Cognee backend instance using Docker. Ensure to replace 'your_api_key_here' with your actual LLM API key. ```bash docker run -e LLM_API_KEY=your_api_key_here -p 8080:8000 --rm -it cognee/cognee:main ``` -------------------------------- ### Install Memgraph Adapter Source: https://docs.cognee.ai/setup-configuration/community-maintained/memgraph Install the Memgraph adapter package using pip. Ensure Cognee is installed and environment is configured with LLM providers first. ```bash uv pip install cognee-community-graph-adapter-memgraph ``` -------------------------------- ### Install PGVector Dependencies Source: https://docs.cognee.ai/core-concepts/multi-user-mode/dataset-database-handlers/existing-dataset-database-handlers/pgvector Install the necessary dependencies for using PGVector with Cognee. Use `cognee[postgres]` for the standard installation or `cognee[postgres-binary]` for the binary version. ```bash pip install "cognee[postgres]" # or for binary version pip install "cognee[postgres-binary]" ``` -------------------------------- ### Example .env File Configuration Source: https://docs.cognee.ai/setup-configuration/overview An example of how to configure the `LLM_MODEL` setting within a `.env` file. This value will be used by Cognee if it's present in the `.env` file, overriding any `os.environ` setting for the same key. ```dotenv # .env LLM_MODEL="openai/gpt-5-mini" ``` -------------------------------- ### Complete Cognee Cloud Example Source: https://docs.cognee.ai/cognee-cloud/connections/cloud-sdk A full example demonstrating connection, data storage, retrieval, and disconnection using the Cognee Python SDK with Cognee Cloud. ```python 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()) ```