Skip to main content

Python API Reference

Complete reference for the cognee Python package. All functions are accessible directly from the top-level cognee module.
import cognee

# Core workflow
await cognee.add("Your data here")
await cognee.cognify()
results = await cognee.search("Your query")

Core Functions

add()

Ingest text, files, or structured data into the knowledge base.

cognify()

Transform raw data into a structured knowledge graph.

search()

Query the knowledge graph with multiple search modes.

memify()

Enrich an existing knowledge graph with custom extraction and enrichment tasks.

Data Management

datasets

List, create, and delete datasets.

update()

Update existing data items.

prune

Clean up data and system resources.

delete()

Delete data items (deprecated — use datasets).

Configuration & Utilities

config

Configure LLM providers, databases, chunking, and more.

SearchType

All available search modes and when to use them.

run_custom_pipeline()

Execute custom task pipelines.

Data Models

Key types: DataPoint, Task, PipelineRunInfo, SearchResult.