---
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 of the module.
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 module builds each `Pipeline` subclass defined there and publishes it as the durable workflow `pipeline.<slug>`. Neither `config.yaml` nor the module's `__init__.py` lists it, unless the module names it in `pipelines = (...)` or binds it with `expose_pipeline`. Delete the file, remove what imports it, and restart the module.

What goes with it: the class, its agent tool, and `pipeline.<slug>` with the triggers its `job = JobSettings(...)` set. Its past runs stay in System › Jobs until the retention prunes them.

What can still point at it:

- **Agents** that take its tool: `self.get_pipeline_instance("items_pipeline")` in `on_initialized`, or an import of the class. The module then fails at startup until you remove them.
- **Callers by name** of `pipeline.items_pipeline`, in any module. The module's own `self.get_workflow(...)` raises `ValueError`, and `await self.engine.modules[id].get_workflow(...)` in another module raises `RPCError` (`WORKFLOW_NOT_FOUND`): a module that looks it up in `on_initialized` fails to start. `ABIClient(...).get_workflow(...)` and `ctx.call(...)` check nothing: their runs stay `QUEUED`, since no module takes them. Nexus answers 404.
- **Tests** next to it: `abi new pipeline` wrote `ItemsPipeline_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 deletes a pipeline: it is a file in a module. Use the CLI or Python on this page. After the restart, System › Jobs says `pipeline.<slug>` is not declared by any loaded or registered module anymore, and keeps its past runs.

## CLI

### Find what uses it

```bash
grep -rn "ItemsPipeline\|items_pipeline" src/
```

Every hit outside the pipeline's own file is an import or a call by name to remove: see the Python tab.

### Remove the file

```bash
git rm src/catalog/pipelines/ItemsPipeline.py src/catalog/pipelines/ItemsPipeline_test.py
```

### Restart and check

Restart the module, then check that `pipeline.items_pipeline` is gone from the workflows Nexus lists:

```bash
curl -s "http://localhost:9879/api/workflows" -H "Authorization: Bearer $ABI_API_KEY" \
  | jq '.workflows | map(select(.name == "pipeline.items_pipeline"))'
```

The answer is `[]`.

## Python

### Remove it from agents

Drop the tool from each agent built in `on_initialized`:

```python title="src/catalog/__init__.py"
# Remove:
tools += self.get_pipeline_instance("items_pipeline").as_tools()
```

### Remove its callers

Delete the `self.get_workflow("pipeline.items_pipeline")` calls of the module, and the `get_workflow(...)` and `ctx.call(...)` calls of other modules, or point them at another pipeline. The class's own schedule (`job = JobSettings(...)`) goes with the file.

### Delete the file

Delete `pipelines/ItemsPipeline.py` and its test, and its entry in `pipelines = (...)` if the module lists its pipelines, then restart. To keep the file but stop the module from building it, move it out of `pipelines/`: discovery only looks there.

## REST API

Not applicable. No route deletes a pipeline. Its `pipeline.<slug>` entry in `GET /api/workflows` disappears when the module restarts without the file.

## Config

Not applicable. No `config.yaml` key lists or disables a single pipeline.

## Remove its data

To also remove what the pipeline wrote, drop the named graph it inserted into, if nothing else writes there: `await self.engine.services.triple_store.drop_graph("http://ontology.naas.ai/graph/catalog")` from the module. Check the graph name in the pipeline's `insert` call before you delete the file.
