Skip to main content

Data Models

Key Pydantic models and types used in the cognee Python API.

SearchResult

Returned by cognee.search().

PipelineRunInfo

Returned by cognee.add(), cognee.cognify(), and pipeline functions.
Status values: PipelineRunStarted, PipelineRunYield, PipelineRunCompleted, PipelineRunAlreadyCompleted, PipelineRunErrored

Task

Wraps a callable for use in pipelines.
Callable
required
The function to execute. Can be an async generator, generator, coroutine, or regular function.
dict
default:"{\"batch_size\": 1}"
Task configuration, primarily batch size.

DataPoint

The public base class for all user-defined graph entities. Extend DataPoint to create custom node types that Cognee can index, search, and connect in the knowledge graph.
Key methods: to_json(), from_json(), to_dict(), from_dict(), update_version() See DataPoints and Custom Data Models for usage details.

KnowledgeGraph

Default graph model used by cognify() as an internal LLM extraction format. The LLM populates this structure while processing documents; it is not exported from the top-level cognee package and is not intended for user extension.
Node and the Edge type nested inside KnowledgeGraph are used as internal pipeline types during extraction, rather than as user-facing extension points. For custom entities and application models, use DataPoint subclasses instead.

Node (internal)

Edge (internal)

Exceptions

All cognee exceptions inherit from CogneeApiError: