---
question: What does a pipeline return to the caller?
kind: overview
---

> **You are reading the v2.x docs (engine modules). New projects use v3.** [Read this page in v3](/capabilities/build/pipelines/overview) · [Migrate from 2.x to 3.0](/capabilities/upgrade/migrate-to-3)

# Pipelines

A pipeline turns external data into RDF and inserts it into the triple store. It is a `naas_abi_core.pipeline.Pipeline` class under the module's `pipelines/` folder: its `run(parameters)` fetches data (usually through an integration), maps it to ontology classes, inserts the graph and returns it. `abi new pipeline` scaffolds the class.

<!-- matrix -->

Nexus has no screen that writes a pipeline. On ABI 3.x, in a NATS project, each pipeline class is also the durable workflow `pipeline.<slug>`: the System app's Jobs tab starts it, shows its runs and cancels them. ABI 2.x and 3.x without NATS have no durable runs and no System app.

## Key concepts

- **`run(parameters)`.** Takes a Pydantic parameters model and returns an `rdflib.Graph`. The usual class also calls `triple_store.insert(graph, graph_name)` before returning, so a run both stores and returns the triples.
- **Discovery.** At startup the module imports the files under its `pipelines/` folder (not the tests) and builds each `Pipeline` subclass, with `New()` or an empty `<Name>PipelineConfiguration()`. Nothing else registers it: delete the file and it is gone at the next start.
- **Durable workflow (ABI 3.x, NATS).** In a NATS project the class is published as `pipeline.<slug>` (the class name in snake case: `ItemsPipeline` is `pipeline.items_pipeline`). Its one step is `run`, with one attempt (a retry would write the triples twice) and one run at a time. A started run is recorded in System › Jobs. Its output is `{"format": "text/turtle", "triples": n, "data": "<turtle>"}`, with `data` replaced by a `note` above 60 KiB.
- **REST route.** A pipeline whose `run` takes a parameters model gets `POST /pipelines/<slug>` on the engine API, behind the engine's `ABI_API_KEY`, on ABI 2.x and 3.x. The response is the graph as Turtle.
- **Agent tools.** `as_tools()` returns the pipeline as LangChain tools. An agent adds them in its `New()`.
- **Schedules.** A pipeline has no schedule of its own. On ABI 3.x in a NATS project, a module job or a `@workflow` with triggers calls `run`, and each run is recorded with its status, logs and result. On ABI 2.x and 3.x without NATS, a Dagster orchestration calls it.
- **Generated classes.** `onto2py` turns the module ontology into Pydantic models with an `rdf()` method, so a pipeline can build entities instead of raw triples. See [Generate Python classes](/v2/capabilities/build/knowledge-graph/generate-python-classes).

```text
Integration (raw API data)  →  Pipeline.run  →  Triple store
                                   ↑
  POST /pipelines/…  ·  agent tool  ·  abi run script  ·  Dagster orchestration (2.x, 3.x without NATS)
  pipeline.<slug> (3.x NATS: System › Jobs, /api/workflows, other modules, module jobs)
```

Pipelines and workflows share their runtime: see [Workflows](/v2/capabilities/build/workflows/overview) for durable runs (ABI 3.x, NATS), and [Monitor and cancel a run](/v2/capabilities/build/workflows/monitor-and-cancel-a-run) for their steps.
