Files
wehub-resource-sync c889a57b6b
Test Suites / Build CI Environment (push) Has been cancelled
Test Suites / Basic Tests (push) Has been cancelled
Test Suites / End-to-End Tests (push) Has been cancelled
Test Suites / CLI Tests (push) Has been cancelled
Test Suites / Slow End-to-End Tests (push) Has been cancelled
Test Suites / Graph Database Tests (push) Has been cancelled
Test Suites / Vector DB Tests (push) Has been cancelled
Test Suites / Temporal Graph Test (push) Has been cancelled
Test Suites / Search Test on Different DBs (push) Has been cancelled
Test Suites / Example Tests (push) Has been cancelled
Test Suites / Notebook Tests (push) Has been cancelled
Test Suites / OS and Python Tests Ubuntu (push) Has been cancelled
Test Suites / OS and Python Tests Extended (push) Has been cancelled
Test Suites / LLM Test Suite (push) Has been cancelled
Test Suites / S3 File Storage Test (push) Has been cancelled
Test Suites / Run Integration Tests (push) Has been cancelled
Test Suites / MCP Tests (push) Has been cancelled
Test Suites / Docker Compose Test (push) Has been cancelled
Test Suites / Docker CI test (push) Has been cancelled
Test Suites / Relational DB Migration Tests (push) Has been cancelled
Test Suites / Distributed Cognee Test (push) Has been cancelled
Test Suites / DB Examples Tests (push) Has been cancelled
Test Suites / Test Completion Status (push) Has been cancelled
Test Suites / Claude Code Review (push) Has been cancelled
Test Suites / basic checks (push) Has been cancelled
build | Build and Push Cognee MCP Docker Image to dockerhub / docker-build-and-push (push) Has been cancelled
Scorecard supply-chain security / Scorecard analysis (push) Has been cancelled
build | Build and Push Docker Image to dockerhub / docker-build-and-push (push) Has been cancelled
Weighted Edges Tests / Test Weighted Edges Core Functionality (3.11) (push) Has been cancelled
Weighted Edges Tests / Test Weighted Edges Core Functionality (3.12) (push) Has been cancelled
Weighted Edges Tests / Test Weighted Edges with Different Graph Databases (kuzu, kuzu) (push) Has been cancelled
Weighted Edges Tests / Test Weighted Edges with Different Graph Databases (neo4j, neo4j) (push) Has been cancelled
Weighted Edges Tests / Test Weighted Edges Examples (push) Has been cancelled
Weighted Edges Tests / Code Quality for Weighted Edges (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 13:02:24 +08:00
..

Cognee Examples

This directory contains 60+ runnable example scripts that demonstrate cognee's features end-to-end. They double as the smoke-test corpus that the team uses to verify behaviour across the SDK.

New here? Start with demos/simple_cognee_example.py (the canonical remember → recall flow), then follow the quickstart map below.

🚀 Quickstart map (5 examples to start with)

Example What you'll learn
demos/simple_cognee_example.py Canonical remember → recall pipeline
demos/remember_recall_improve_example.py The v1.0 memory API (remember, recall, improve, forget)
guides/agent_memory_quickstart.py Wrap an LLM agent with cognee memory
guides/graph_visualization.py Render the resulting knowledge graph
demos/start_local_ui_frontend_example.py Launch the cognee UI alongside the API server

📁 Top-level layout

Folder Purpose Count
configurations/ Database & permissions configuration recipes 8
custom_pipelines/ Build your own pipeline / extend cognify 7
database_examples/ Smoke tests per supported backend 5
demos/ Feature demos — broadest coverage 22
guides/ Short focused how-to guides 13
integrations/ Integrations Hub — first-class SaaS connectors (Gmail, …) 1
pocs/ Research-grade proofs of concept (entity disambiguation, canonicalization, prefetch) 7

Most runnable demos and backend examples use the v1.0 memory API (remember, recall, forget, improve). The lower-level add, cognify, search, and prune calls are intentionally kept in examples that demonstrate pipeline internals, permissions, relational migrations, or research POCs.

🔧 configurations/ — backend & permissions setup

Database configuration

Script Demonstrates
database_examples/ladybug_graph_database_configuration.py Ladybug (default) graph backend
database_examples/neo4j_graph_database_configuration.py Neo4j graph backend
database_examples/neptune_analytics_aws_database_configuration.py AWS Neptune Analytics graph backend
database_examples/pgvector_postgres_vector_database_configuration.py Postgres + pgvector hybrid (vector + relational in one)

Permissions / multi-tenancy (set ENABLE_BACKEND_ACCESS_CONTROL=True)

Script Demonstrates
permissions_example/tenant_role_setup_example.py Create tenants and assign roles
permissions_example/tenant_role_constraints_example.py Constrain what a role can do
permissions_example/user_permissions_and_access_control_example.py Per-user dataset access control
permissions_example/data_access_control_example.py Filter retrieval by ACL

🔄 custom_pipelines/ — extend cognify

Script Demonstrates
custom_cognify_pipeline_example.py Replace the default cognify task list with your own
memify_coding_agent_rule_extraction_example.py Distill coding-agent traces into reusable rules
relational_database_to_knowledge_graph_migration_example.py Lift a SQL schema + data into a knowledge graph
agentic_reasoning_procurement_example.py Multi-step reasoning over a procurement dataset
dynamic_steps_resume_analysis_hr_example.py Pipeline that branches based on resume content
organizational_hierarchy/organizational_hierarchy_pipeline_example.py Org-chart ingestion (high-level API)
organizational_hierarchy/organizational_hierarchy_pipeline_low_level_example.py Same dataset via the low-level Task API

🗄️ database_examples/ — smoke tests per backend

Script Demonstrates
ladybug_example.py Ladybug (default) — graph
neo4j_example.py Neo4j — graph
neptune_analytics_example.py Neptune Analytics — graph
chromadb_example.py ChromaDB — vector
pgvector_example.py pgvector — vector + relational

🎯 demos/ — feature breadth

Script Demonstrates
simple_cognee_example.py Canonical remember → recall pipeline (start here)
comprehensive_example/cognee_comprehensive_example.py End-to-end with most features stitched together
remember_recall_improve_example.py v1.0 memory API (remember, recall, improve, forget)
conversation_session_persistence_example.py Session memory persisted across runs
session_feedback_example.py Capturing thumbs-up/down feedback on retrieval
session_feedback_lifecycle_demo/backend/app.py Full feedback-loop backend (FastAPI + cognee)
feedback_score_shifting_example.py How feedback nudges retrieval scores
references_example.py Search answers with lightweight evidence references
custom_graph_model_entity_schema_definition.py Define your own entity schema for graph extraction
custom_pipeline_single_object_example.py Run a custom pipeline on a single object
dynamic_multiple_weighted_edges_example.py Many-to-many edges with per-edge weights
nodeset_grouping_example.py Group nodes into named sets for filtered retrieval
temporal_awareness_example/temporal_awareness_example.py Time-aware retrieval (Event model)
ontology_reference_vocabulary/ontology_as_reference_vocabulary_example.py Ontology as a constraining vocabulary for extraction
web_url_content_ingestion_example.py Crawl a URL and cognify the content
dlt_ingestion_example.py Ingest via dlt sources
gmail_connector_example.py "Ask my inbox" — Gmail connector (incremental + forget-on-delete)
multimedia_processing/multimedia_audio_image_processing_example.py Audio + image ingestion
simple_document_qa/simple_document_qa_demo.py Q&A over a single document
simple_relational_database_migration_example/simple_relational_database_migration_example.py SQL → graph (small schema)
complex_relational_database_migration_example/complex_relational_database_migration_example.py SQL → graph (richer schema)
schema_inventory_demo.py Schema and entity inventory visualization
memory_provenance_demo.py Memory provenance projection and visualization
sync_local_to_cloud_example.py Sync a local dataset to Cognee Cloud
pipeline_api_proposal.py Proposal-style API exploration
start_local_ui_frontend_example.py Spin up cognee UI + backend

📘 guides/ — focused how-tos

Script Demonstrates
agent_memory_quickstart.py Wrap an LLM agent with cognee memory
improve_quickstart.py The improve step in the V2 API
recall_core.py recall semantics and parameters
temporal_recall.py Time-bounded recall queries
ontology_quickstart.py Supply a hand-written ontology
custom_data_models.py Custom DataPoint subclasses
custom_graph_model.py Custom graph model used by extraction
custom_prompts.py Override the LLM prompts used in the pipeline
custom_tasks_and_pipelines.py Author your own tasks and compose them
importance_weight.py Boost specific nodes in retrieval ranking
graph_visualization.py Render the resulting knowledge graph
low_level_llm.py Direct access to the LLM gateway (skip pipelines)
s3_storage.py Store data and metadata on S3
consolidate_entity_descriptions_example.py Merge near-duplicate entity descriptions

🧪 pocs/ — research / proofs of concept

These are exploratory scripts; conventions evolve faster here than in guides/ or demos/.

Script Demonstrates
disambiguation/disambiguate_entities.py Entity-disambiguation primitive
disambiguation/disambiguate_entities_example.py End-to-end disambiguation flow
disambiguation/extract_graph_from_data_with_entity_disambiguation.py Graph extraction with disambiguation enabled
post_extraction_canonicalization/post_extraction_canonicalization.py Canonicalize entities after extraction
post_extraction_canonicalization/post_extraction_canonicalization_example.py Worked example for the canonicalization flow
prefetch_disambiguation/prefetch_disambiguation.py Prefetch candidates before disambiguation
prefetch_disambiguation/prefetch_disambiguation_example.py Worked example combining prefetch + disambiguation

🔍 By feature (cross-folder index)

Same scripts, indexed by what they demonstrate.

Memory API (v1.0: remember / recall / improve / forget)

Session memory & feedback

Temporal awareness

Ontology

Multimedia & non-text ingestion

Connectors / Integrations Hub

SQL → knowledge graph

Custom pipelines / tasks

Multi-tenant / permissions

Backends

Visualization & UI

References / evidence

Storage backends

Disambiguation / canonicalization

⚙️ Running an example

# 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

For non-OpenAI providers (Anthropic, Bedrock, Ollama, fastembed, …) see the cognee docs and .env.template.

🤝 Contributing a new example

  1. Pick the right folder:
    • demos/ — broad feature demonstration
    • guides/ — small focused how-to
    • custom_pipelines/ — custom pipeline composition
    • pocs/ — research-shaped exploration
  2. Self-contained: an example should run with uv run python <path> after uv sync and a configured .env. No global setup.
  3. Add an entry to the appropriate table above.
  4. If your example demonstrates a feature, add it to the By feature cross-index too.

See CONTRIBUTING.md for the broader contribution flow.