### Install Dev Environment and Run Example Source: https://github.com/topoteretes/cognee/blob/main/examples/README.md Installs the development environment, configures API keys by copying a template and editing it, and then runs a simple Cognee Python example. ```bash # Install dev environment uv sync --dev --all-extras --reinstall # Configure API keys (one-time) cp .env.template .env # edit .env: set LLM_API_KEY (your OpenAI key) at minimum # Run any example uv run python examples/demos/simple_cognee_example.py ``` -------------------------------- ### Quickstart MCP Server with Docker Source: https://github.com/topoteretes/cognee/blob/main/AGENTS.md Launch the MCP server using Docker for a quick local setup. This example uses HTTP transport and environment variables for configuration. ```bash docker run -e TRANSPORT_MODE=http --env-file ./.env -p 8000:8000 --rm -it cognee/cognee-mcp:main ``` -------------------------------- ### Install Frontend Dependencies and Start Dev Server Source: https://github.com/topoteretes/cognee/blob/main/AGENTS.md Commands to install Node.js dependencies and start the Next.js development server for the Cognee frontend. Also includes commands for linting and building. ```bash cd cognee-frontend npm install npm run dev # Next.js dev server ``` ```bash npm run lint # ESLint ``` ```bash npm run build && npm start ``` -------------------------------- ### Install Daytona Python SDK and Run Sandbox Source: https://github.com/topoteretes/cognee/blob/main/distributed/deploy/README.md Install the Daytona Python SDK and set API keys. Then, run the provided Python script to start Cognee within a Daytona sandbox. ```bash pip install daytona export DAYTONA_API_KEY=your-key # from https://app.daytona.io export LLM_API_KEY=sk-xxx python distributed/deploy/daytona_sandbox.py ``` -------------------------------- ### Setup Cognee Development Environment Source: https://github.com/topoteretes/cognee/blob/main/CLAUDE.md Installs Cognee and its development dependencies using uv. Ensures pre-commit hooks are set up for code quality. ```bash uv venv && source .venv/bin/activate uv pip install -e . uv pip install -e ".[dev]" uv pip install -e ".[postgres,neo4j,docs,chromadb]" pre-commit install ``` -------------------------------- ### Install pre-commit and Install Hooks Source: https://github.com/topoteretes/cognee/blob/main/CONTRIBUTING.md Installs pre-commit and sets up the project's git hooks to ensure code style consistency. ```shell uv run pip install pre-commit && pre-commit install ``` -------------------------------- ### Install uv Package Manager Source: https://github.com/topoteretes/cognee/blob/main/cognee-mcp/README.md Install uv, a fast Python package installer, if you don't have it already. ```bash pip install uv ``` -------------------------------- ### Start the development server Source: https://github.com/topoteretes/cognee/blob/main/cognee-frontend/README.md Use these commands to launch the local development environment. ```bash npm run dev # or yarn dev # or pnpm dev # or bun dev ``` -------------------------------- ### Run Simple Cognee Example Source: https://github.com/topoteretes/cognee/blob/main/CONTRIBUTING.md Executes a simple example demonstrating Cognee functionality. Make sure to copy `.env.template` to `.env` and set your `OPENAI_API_KEY` as `LLM_API_KEY`. Also, run `uv sync` or set up a virtual environment. ```shell uv run python examples/demos/simple_cognee_example.py ``` -------------------------------- ### Create Daytona Sandbox and Install Cognee via CLI Source: https://github.com/topoteretes/cognee/blob/main/distributed/deploy/README.md Install the Daytona CLI using Homebrew. Create a new sandbox, then install the Cognee API package and run the Uvicorn server within the sandbox. ```bash brew install daytonaio/cli/daytona daytona create # Inside the sandbox: pip install 'cognee[api]' python -m uvicorn cognee.api.client:app --host 0.0.0.0 --port 8000 ``` -------------------------------- ### Start Cognee UI with Docker Compose Source: https://github.com/topoteretes/cognee/blob/main/README.md Add the 'ui' profile to Docker Compose to start the frontend interface. ```bash docker compose --profile ui up # + frontend on http://localhost:3000 ``` -------------------------------- ### Start Cognee API Server with Docker Compose Source: https://github.com/topoteretes/cognee/blob/main/README.md Use this command to start the main Cognee API server using Docker Compose. ```bash docker compose up ``` -------------------------------- ### Install Cognee using uv Source: https://github.com/topoteretes/cognee/blob/main/README.md Install the Cognee library using the uv package manager. Ensure you have Python 3.10 to 3.14 installed. ```bash uv pip install cognee ``` -------------------------------- ### Execute Cognify Pipeline with Example Data Source: https://github.com/topoteretes/cognee/blob/main/notebooks/cognee_demo.ipynb Retrieves a default user, fetches a specific dataset by name, and then initiates the cognify pipeline with the dataset and user. Ensure the 'example' dataset exists and user authentication is configured. ```python from cognee.modules.users.methods import get_default_user from cognee.modules.data.methods import get_datasets_by_name from cognee.modules.users.methods import get_user default_user = await get_default_user() user = await get_user(default_user.id) datasets = await get_datasets_by_name(["example"], user.id) await run_cognify_pipeline(datasets[0], user) ``` -------------------------------- ### Install Optional Dependencies from Docker Hub Image Source: https://github.com/topoteretes/cognee/blob/main/cognee-mcp/README.md Runs a prebuilt cognee-mcp Docker image from Docker Hub, installing optional dependencies at runtime using the EXTRAS environment variable. ```bash # Install optional dependencies from Docker Hub image docker run \ -e TRANSPORT_MODE=http \ -e EXTRAS=aws,postgres \ --env-file ./.env \ -p 8000:8000 \ --rm -it cognee/cognee-mcp:main ``` -------------------------------- ### Install Cognee Tracing Source: https://github.com/topoteretes/cognee/blob/main/distributed/deploy/README.md Install the necessary package for enabling OpenTelemetry tracing in Cognee. ```bash pip install cognee[tracing] ``` -------------------------------- ### Install and Run MCP Server Locally Source: https://github.com/topoteretes/cognee/blob/main/AGENTS.md Commands to install development dependencies and run the MCP server locally. Supports stdio, SSE, and HTTP transports with configurable hosts and ports. ```bash cd cognee-mcp uv sync --dev --all-extras --reinstall uv run python src/server.py # stdio (default) ``` ```bash uv run python src/server.py --transport sse ``` ```bash uv run python src/server.py --transport http --host 127.0.0.1 --port 8000 --path /mcp ``` -------------------------------- ### Install Colima and Docker via Homebrew Source: https://github.com/topoteretes/cognee/blob/main/docs/docker-colima-setup.md Installs Colima and Docker using Homebrew on macOS or Linux. ```bash # macOS (Homebrew) brew install colima docker # Linux (Homebrew) brew install colima docker ``` -------------------------------- ### Start Colima Container Runtime Source: https://github.com/topoteretes/cognee/blob/main/docs/docker-colima-setup.md Starts the Colima VM. The recommended `--network-address` flag provides a host-reachable network address for better host-container communication. ```bash # Basic start colima start # Recommended: give the VM a host-reachable network address colima start --network-address ``` -------------------------------- ### Install Cognee Package Source: https://github.com/topoteretes/cognee/blob/main/notebooks/ontology_demo.ipynb Installs the Cognee package. This is a prerequisite for using the framework. ```python # Install required package # !pip install cognee ``` -------------------------------- ### Configure and perform text translation Source: https://github.com/topoteretes/cognee/blob/main/cognee/tests/tasks/translation/README.md Example showing how to set translation configuration and perform a direct text translation. ```python import cognee from cognee.tasks.translation import translate_text # Configure translation (optional - defaults to LLM provider) cognee.config.set_translation_config( provider="llm", # Uses configured LLM (default) target_language="en", # Target language code confidence_threshold=0.7 # Minimum confidence for language detection ) # Translate text directly result = await translate_text( text="Bonjour le monde", target_language="en" ) print(result.translated_text) # "Hello world" ``` -------------------------------- ### Initialize and Deploy to Railway Source: https://github.com/topoteretes/cognee/blob/main/distributed/deploy/README.md Initializes a new Railway project and deploys it. Assumes the Railway CLI is installed and configured. ```bash railway init && railway up ``` -------------------------------- ### Install uv dependency manager Source: https://github.com/topoteretes/cognee/blob/main/cognee-starter-kit/README.md Install the uv package manager to manage project dependencies. ```bash pip install uv ``` -------------------------------- ### Start Cognee MCP in Cloud Mode via CLI Source: https://github.com/topoteretes/cognee/blob/main/cognee-mcp/README.md Use CLI flags to specify the Cognee Cloud or remote instance URL and API key when starting the server in Cloud Mode. ```bash python src/server.py --serve-url https://your-instance.cognee.ai --serve-api-key ck_... ``` -------------------------------- ### Start Cognee Visualization Server Source: https://github.com/topoteretes/cognee/blob/main/cognee/skill.md Launch a local server to interactively visualize the Cognee graph. Specify the port for the server. ```python await cognee.start_visualization_server(port=8080) ``` -------------------------------- ### Start Cognee MCP Server with Docker Compose Source: https://github.com/topoteretes/cognee/blob/main/README.md Add the 'mcp' profile to Docker Compose to start the MCP server. ```bash docker compose --profile mcp up # + MCP server on http://localhost:8001 ``` -------------------------------- ### Install Development Dependencies (Python) Source: https://github.com/topoteretes/cognee/blob/main/AGENTS.md Use this command to create or refresh the Python development environment and install all necessary development dependencies and extras. Requires Python >= 3.10 and < 3.14. ```bash uv sync --dev --all-extras --reinstall ``` -------------------------------- ### Run Cognee with Docker Compose (Neo4j) Source: https://github.com/topoteretes/cognee/blob/main/distributed/deploy/README.md Start Cognee using Docker Compose with Neo4j graph database integration. ```bash # With Neo4j graph database docker-compose --profile neo4j up ``` -------------------------------- ### Copy and Edit Environment File Source: https://github.com/topoteretes/cognee/blob/main/README.md Before starting Docker Compose, copy the template environment file and set your LLM_API_KEY. ```bash cp .env.template .env # then edit .env and set LLM_API_KEY ``` -------------------------------- ### Run Cognee with Docker Compose (Postgres) Source: https://github.com/topoteretes/cognee/blob/main/distributed/deploy/README.md Start Cognee using Docker Compose with PostgreSQL and pgvector support. ```bash # With Postgres + pgvector docker-compose --profile postgres up ``` -------------------------------- ### Set alternative translation providers Source: https://github.com/topoteretes/cognee/blob/main/cognee/tests/tasks/translation/README.md Examples for switching the translation provider to Google Cloud or Azure. ```python # Use Google Cloud Translate (requires GOOGLE_TRANSLATE_API_KEY) cognee.config.set_translation_provider("google") # Use Azure Translator (requires AZURE_TRANSLATOR_KEY and AZURE_TRANSLATOR_REGION) cognee.config.set_translation_provider("azure") ``` -------------------------------- ### Start Cognee with Postgres using Docker Compose Source: https://github.com/topoteretes/cognee/blob/main/README.md Add the 'postgres' profile to Docker Compose to include a Postgres database with PGVector. ```bash docker compose --profile postgres up # + Postgres/PGVector ``` -------------------------------- ### Install Cognee Memory Plugin for Claude Code Source: https://github.com/topoteretes/cognee/blob/main/README.md Install the Cognee memory plugin for Claude Code from the marketplace. This is a one-time setup. Ensure environment variables are set before launching Claude Code. ```bash claude plugin marketplace add topoteretes/cognee-integrations claude plugin install cognee-memory@cognee ``` -------------------------------- ### Minimal Environment Setup Source: https://github.com/topoteretes/cognee/blob/main/CLAUDE.md Configure essential environment variables for LLM API key and model. Defaults to OpenAI and local file-based databases if not specified. ```bash # Minimal setup (defaults to OpenAI + local file-based databases) LLM_API_KEY="your_openai_api_key" LLM_MODEL="openai/gpt-5-mini" # Default model ``` -------------------------------- ### Run Cognee Platform Examples Source: https://github.com/topoteretes/cognee/blob/main/CLAUDE.md Demonstrates how to run Cognee using its Python SDK or the command-line interface (CLI). Includes options for adding data, cognifying, searching, deleting, and launching the UI. ```bash uv run python examples/demos/simple_cognee_example.py cognee-cli add "Your text here" cognee-cli cognify cognee-cli search "Your query" cognee-cli delete --all cognee-cli -ui ``` -------------------------------- ### Reset Cognee System and Get Version Source: https://github.com/topoteretes/cognee/blob/main/notebooks/cognee_demo.ipynb Resets the Cognee system by pruning data and metadata, then prints the installed Cognee version. Requires the 'cognee' library to be imported. ```python # Reset the cognee system with the following command: import cognee await cognee.prune.prune_data() await cognee.prune.prune_system(metadata=True) print(cognee.__version__) ``` -------------------------------- ### Structured Output Framework Configuration Source: https://github.com/topoteretes/cognee/blob/main/CLAUDE.md Choose the framework for structured output. Defaults to 'instructor' (via litellm). Alternatively, use 'baml' which requires the 'baml' extra and specific BAML configurations. ```bash # Use Instructor (default, via litellm) STRUCTURED_OUTPUT_FRAMEWORK="instructor" # Or use BAML (requires baml extra: pip install cognee[baml]) STRUCTURED_OUTPUT_FRAMEWORK="baml" BAML_LLM_PROVIDER=openai BAML_LLM_MODEL="gpt-4o-mini" BAML_LLM_API_KEY="your_api_key" ``` -------------------------------- ### Install MCP Dependencies Locally Source: https://github.com/topoteretes/cognee/blob/main/cognee-mcp/README.md Install and reinstall dependencies for the Cognee MCP project using uv. This step is required when using a local Cognee installation. ```bash uv sync --reinstall ``` -------------------------------- ### Verify Cognee Installation Source: https://github.com/topoteretes/cognee/blob/main/notebooks/tutorial.ipynb Check the import path and installation status of the Cognee package. ```python import cognee import os from pathlib import Path print('🔍 Quick Cognee Import Check') print('=' * 30) print(f'📍 Cognee location: {cognee.__file__}') print(f'📁 Package directory: {os.path.dirname(cognee.__file__)}') # Check if it's local or installed current_dir = Path.cwd() cognee_path = Path(cognee.__file__) if current_dir in cognee_path.parents: print('🏠 Status: LOCAL DEVELOPMENT VERSION') else: print('📦 Status: INSTALLED PACKAGE') ``` -------------------------------- ### Install Cognee TypeScript Package Source: https://github.com/topoteretes/cognee/blob/main/README.md Use this command to install the @cognee/cognee-ts package for Node.js or browser environments. ```bash npm install @cognee/cognee-ts ``` -------------------------------- ### Entity Extraction System Example Source: https://github.com/topoteretes/cognee/blob/main/cognee/infrastructure/llm/prompts/extract_entities_system.txt Example response format for the entity extraction system. It includes entities with their name, type, and description. ```json { "entities": [ { "name": "Albert Einstein", "is_a": { "name": "PERSON", "description": "Entity type for person entities" }, "description": "A theoretical physicist who developed the theory of relativity." }, { "name": "Theory of Relativity", "is_a": { "name": "CONCEPT", "description": "Entity type for concept entities" }, "description": "A physics theory describing the relationship between space and time." }, { "name": "Princeton University", "is_a": { "name": "ORGANIZATION", "description": "Entity type for organization entities" }, "description": "An Ivy League research university in Princeton, New Jersey." } ] } ``` -------------------------------- ### Run Cognee with Docker Compose (Minimal) Source: https://github.com/topoteretes/cognee/blob/main/distributed/deploy/README.md Start Cognee using Docker Compose with a minimal configuration, including SQLite, LanceDB, and Ladybug, without external dependencies. ```bash # Minimal (SQLite + LanceDB + Ladybug - no external deps) docker-compose up cognee ``` -------------------------------- ### Launch Graph Visualization Server via Python Source: https://github.com/topoteretes/cognee/blob/main/CLAUDE.md Starts the visualization server programmatically using Python. Specify the desired port for the server. ```python from cognee.api.v1.visualize import start_visualization_server await start_visualization_server(port=8080) ``` -------------------------------- ### Start Cognee FastAPI Server Source: https://github.com/topoteretes/cognee/blob/main/AGENTS.md Directly start the FastAPI server for the Cognee API. This command is used to run the backend API service. ```bash uv run python -m cognee.api.client ``` -------------------------------- ### Start Cognee MCP in Cloud Mode via Environment Variables Source: https://github.com/topoteretes/cognee/blob/main/cognee-mcp/README.md Configure Cloud Mode by setting COGNEE_SERVICE_URL and COGNEE_API_KEY environment variables before running the server. This provides a zero-configuration startup. ```bash export COGNEE_SERVICE_URL="https://your-instance.cognee.ai" export COGNEE_API_KEY="ck_..." python src/server.py ``` -------------------------------- ### Install Cognee with Postgres Support Source: https://github.com/topoteretes/cognee/blob/main/README.md Install the Cognee package with the necessary dependencies for Postgres integration. This command ensures all required libraries for using Postgres as the memory backend are included. ```bash pip install "cognee[postgres]" ``` -------------------------------- ### Initialize Cognee and Add Multimedia Files Source: https://github.com/topoteretes/cognee/blob/main/notebooks/cognee_multimedia_demo.ipynb Initializes Cognee by pruning existing data and system state, then adds specified multimedia files (MP3 and PNG) to be processed for knowledge graph creation. ```python import cognee # Create a clean slate for cognee -- reset data and system state await cognee.prune.prune_data() await cognee.prune.prune_system(metadata=True) # Add multimedia files and make them available for cognify await cognee.add([mp3_file_path, png_file_path]) ``` -------------------------------- ### Create Minimal Environment File Source: https://github.com/topoteretes/cognee/blob/main/README.md Create a minimal .env file with your OpenAI API key for running Cognee containers. ```bash echo 'LLM_API_KEY="YOUR_OPENAI_API_KEY"' > .env ``` -------------------------------- ### Run Cognee with Docker Compose (Full Stack UI) Source: https://github.com/topoteretes/cognee/blob/main/distributed/deploy/README.md Start the full Cognee stack, including the user interface, using Docker Compose. ```bash # Full stack with UI docker-compose --profile ui up ``` -------------------------------- ### Run Cognee API Server Prebuilt Image Source: https://github.com/topoteretes/cognee/blob/main/README.md Run the prebuilt Cognee API server image, mapping port 8000 and using the environment file. ```bash docker run --env-file "./.env" -p 8000:8000 --rm -it cognee/cognee:main ``` -------------------------------- ### Install Optional Dependencies at Runtime in Docker Source: https://github.com/topoteretes/cognee/blob/main/cognee-mcp/README.md Runs the cognee-mcp Docker container with optional dependencies installed at runtime using the EXTRAS environment variable. Supports single or multiple comma-separated groups. ```bash # Install a single optional dependency group at runtime docker run \ -e TRANSPORT_MODE=http \ -e EXTRAS=aws \ --env-file ./.env \ -p 8000:8000 \ --rm -it cognee/cognee-mcp:main ``` ```bash # Install multiple optional dependency groups at runtime (comma-separated) docker run \ -e TRANSPORT_MODE=sse \ -e EXTRAS=aws,postgres,neo4j \ --env-file ./.env \ -p 8000:8000 \ --rm -it cognee/cognee-mcp:main ``` -------------------------------- ### Deploy Cognee to Modal Source: https://github.com/topoteretes/cognee/blob/main/distributed/deploy/README.md Installs the Modal CLI, sets the LLM API key, and deploys the FastAPI server. The endpoint URL will be available in the Modal dashboard. ```bash pip install modal && modal setup export LLM_API_KEY=sk-xxx bash distributed/deploy/modal-deploy.sh ``` -------------------------------- ### Start Cognee MCP Server with SSE Transport Source: https://github.com/topoteretes/cognee/blob/main/cognee-mcp/README.md Use this command to start the Cognee MCP server with Server-Sent Events (SSE) transport enabled. Ensure you have Docker and the necessary .env file. ```bash docker run -e TRANSPORT_MODE=sse --env-file ./.env -p 8000:8000 --rm -it cognee/cognee-mcp:main ``` -------------------------------- ### Start Cognee MCP Server in API Mode Source: https://github.com/topoteretes/cognee/blob/main/cognee-mcp/README.md Initiate the Cognee MCP server in API Mode by providing the URL and authentication token of the running Cognee FastAPI server. Ensure the FastAPI server is started first. ```bash # Start your Cognee FastAPI server first (default port 8000) cd /path/to/cognee python -m cognee.api.client # Then start the MCP server in API mode cd cognee-mcp python src/server.py --api-url http://localhost:8000 --api-token YOUR_AUTH_TOKEN ``` -------------------------------- ### Initialize Knowledge Graph Source: https://github.com/topoteretes/cognee/blob/main/notebooks/cognee_multimedia_demo.ipynb Use this command to trigger the cognify process for building the knowledge graph. ```python await cognee.cognify() ``` -------------------------------- ### Verify Docker Installation Source: https://github.com/topoteretes/cognee/blob/main/docs/docker-colima-setup.md Checks if the Docker daemon is running and accessible, and runs a test container. ```bash docker info # Should print server information without errors docker run --rm hello-world ``` -------------------------------- ### Deploy Cognee to Modal Source: https://github.com/topoteretes/cognee/blob/main/README.md Execute this script for serverless, auto-scaling, GPU workloads on Modal. ```bash bash distributed/deploy/modal-deploy.sh ```