---
question: Does deleting a pipeline remove the triples it wrote?
kind: task
via_web: na
via_cli: available
via_python: available
via_api: na
via_config: na
prereq: You need write access to the module's source. Nothing registers a pipeline outside its file, so deleting it is a code change plus a restart.
next:
  - /capabilities/build/knowledge-graph/creating-a-pipeline
  - /capabilities/build/pipelines/monitor-runs
---

# Delete a pipeline

A pipeline exists because its file is in the module's `pipelines/` folder: the engine imports every `.py` file there at startup, keeps each `Pipeline` subclass defined in it, and mounts its `POST /pipelines/<name>` route. Neither `config.yaml` nor the module's `__init__.py` lists it. Delete the file, remove what imports it, and restart the engine.

What can still point at it:

- **Agents** that import the class or its `as_tools()` in `New()`. Their import then raises `ModuleNotFoundError`, and the engine fails at startup until you remove it.
- **Module jobs** whose handler imports it. The job keeps firing, and each run fails.
- **Tests** next to it (`*_test.py`).

The triples it already wrote stay in the triple store. Deleting the pipeline does not remove them.

## Web UI

Not applicable. Nexus has no screen that lists or deletes pipelines: a pipeline is a file in an in-engine module. Use the CLI or Python on this page.

## CLI

### Find what uses it

```bash
grep -rn "ItemsPipeline" src/
```

Every hit outside the pipeline's own file is an import to remove: see the Python tab for agents and jobs.

### Remove the file

```bash
git rm src/my_module/pipelines/ItemsPipeline.py
```

Remove its test file too, if it has one (`ItemsPipeline_test.py`).

### Restart and check

Restart the engine, then check that the route is gone:

```bash
curl -s http://localhost:9879/openapi.json | jq '.paths | keys | map(select(startswith("/pipelines")))'
```

`items_pipeline` no longer appears. When no pipeline is left, the API has no Pipelines section at all.

## Python

### Remove it from agents

Drop the import and the tools from each agent's `New()`:

```python title="agents/MyAgent.py"
# Remove:
from my_module.pipelines.ItemsPipeline import ItemsPipeline, ItemsPipelineConfiguration
tools += ItemsPipeline(ItemsPipelineConfiguration()).as_tools()
```

### Remove its job

Delete the `@job` method on `ABIModule` that calls it, or point it at another pipeline. After the restart the job is no longer hosted. Its past runs stay in the System app until the [retention](/user-guide/build/pipelines/monitor-runs?via=config) prunes them.

### Delete the file

Delete `pipelines/ItemsPipeline.py` and its tests, then restart the engine. To keep the file but stop the engine from loading it, move it out of `pipelines/`: the engine only looks there.

## REST API

Not applicable. No route deletes a pipeline. Its `POST /pipelines/<name>` route disappears when the engine restarts without the file.

## Config

Not applicable. No `config.yaml` key lists or disables a single pipeline. `enabled: false` on the module under `modules:` unloads the whole module, all its pipelines, agents and jobs included.

## Remove its data

To also remove what the pipeline wrote, drop the named graph it inserted into, if nothing else writes there. From Python, `triple_store.drop_graph(URIRef("http://ontology.naas.ai/graph/my_module"))`. Check the graph name in the pipeline's `insert` call before you delete the file.
