> ## Documentation Index
> Fetch the complete documentation index at: https://docs.cognee.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# run_custom_pipeline()

> Run your own sequence of tasks as a Cognee pipeline with run_custom_pipeline().

# cognee.run\_custom\_pipeline()

```python theme={null}
async def run_custom_pipeline(
    tasks: list[Task] | list[str] | None = None,
    data: Any = None,
    dataset: str | UUID = 'main_dataset',
    user: User = None,
    vector_db_config: dict | None = None,
    graph_db_config: dict | None = None,
    incremental_loading: bool = False,
    data_per_batch: int = 20,
    run_in_background: bool = False,
    pipeline_name: str = 'custom_pipeline',
    data_cache: bool = False,
    skip_connection_test: bool = False,
)
```

## Description

Custom pipeline in Cognee, can work with already built graphs. Data needs to be provided which can be processed
with provided tasks.

Provided tasks and data will be arranged to run the Cognee pipeline and execute graph enrichment/creation.

This is the core processing step in Cognee that converts raw text and documents
into an intelligent knowledge graph. It analyzes content, extracts entities and
relationships, and creates semantic connections for enhanced search and reasoning.

Args:
tasks: List of Cognee Tasks to execute.
data: The data to ingest. Can be anything when custom extraction and enrichment tasks are used.
Data provided here will be forwarded to the first extraction task in the pipeline as input.
Data rows (cognee's Data model) are read again under the dataset lock, so tasks get
their current values; rows deleted since are dropped (a selection left empty runs
over no data, not the whole dataset), and a row of another dataset raises
CogneeValidationError.
dataset: Dataset name or dataset uuid to process.
user: User context for authentication and data access. Uses default if None.
vector\_db\_config: Custom vector database configuration for embeddings storage.
graph\_db\_config: Custom graph database configuration for relationship storage.
incremental\_loading: If True, only new or modified data will be processed to avoid duplication. (Only works if data is used with the Cognee python Data model).
The incremental system stores and compares hashes of processed data in the Data model and skips data with the same content hash.
data\_per\_batch: Number of data items to be processed in parallel.
run\_in\_background: If True, starts processing asynchronously and returns immediately.
If False, waits for completion before returning.
Background mode recommended for large datasets (>100MB).
Use pipeline\_run\_id from return value to monitor progress.
skip\_connection\_test: If True, skip the first-run LLM/embedding connection checks
for this pipeline. Use for pipelines whose tasks perform no LLM
or embedding calls.

## Parameters

**tasks** `list[Task] | list[str] | None` (default: None)

List of Task objects or task names defining the pipeline steps.

**data** `Any` (default: None)

Input data for the pipeline. Cognee `Data` rows are read again once the per-dataset lock is held: tasks get their current values, rows deleted in the meantime are dropped (a selection left empty runs over no data, not the whole dataset), and a row of another dataset raises `CogneeValidationError`. Other items pass through unchanged.

**dataset** `str | UUID` (default: 'main\_dataset')

Dataset name or UUID.

**user** `User` (default: None)

User performing the operation.

**vector\_db\_config** `dict | None` (default: None)

Override vector database configuration.

**graph\_db\_config** `dict | None` (default: None)

Override graph database configuration.

**incremental\_loading** `bool` (default: False)

Skip already-processed data.

**data\_per\_batch** `int` (default: 20)

Number of data items per batch.

**run\_in\_background** `bool` (default: False)

If true, return immediately and process in background.

**pipeline\_name** `str` (default: 'custom\_pipeline')

Name identifier for the pipeline run.

**data\_cache** `bool` (default: False)

Skip already-processed data. Enables the same per-document skipping as `incremental_loading`.

**skip\_connection\_test** `bool` (default: False)

Skip the first-run LLM and embedding connection checks, for pipelines whose tasks make no LLM or embedding calls.

> [!NOTE]
>
> `use_pipeline_cache` has been removed. Passing it raises a `TypeError`; drop the argument. A re-run skips already-processed data through `incremental_loading` (or `data_cache`) and per-document status instead — see [How re-runs avoid duplicate work](https://docs.cognee.ai/core-concepts/building-blocks/pipelines.md).

## Examples

```python theme={null}
import cognee
from cognee.modules.pipelines import Task

# Define custom tasks
async def my_extractor(data):
    # Custom extraction logic
    yield extracted_data

async def my_enricher(data):
    # Custom enrichment logic
    yield enriched_data

# Run a custom pipeline
await cognee.run_custom_pipeline(
    tasks=[
        Task(my_extractor),
        Task(my_enricher),
    ],
    data="Input data for the pipeline",
    dataset="my_dataset",
    pipeline_name="my_custom_pipeline",
)
```

See [Custom Tasks & Pipelines](https://docs.cognee.ai/guides/custom-tasks-pipelines.md) for a full guide.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.