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

# Pipelines

A pipeline turns external data into RDF and inserts it into the triple store. It is a Python class in an in-engine module, under `pipelines/`: 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 for pipelines. A pipeline is code; the engine exposes it as a REST route and as agent tools, and module jobs run it on a schedule. The System app's Jobs tab shows those job runs.

## 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 engine imports every `.py` file under the module's `pipelines/` folder (not `*test.py`) and instantiates each `Pipeline` subclass. Nothing else registers it: delete the file and it is gone at the next start.
- **REST route.** A loaded pipeline whose `run` takes a parameters model gets `POST /pipelines/<class name in snake case>`, behind the engine's `ABI_API_KEY`. The response is the graph as Turtle.
- **Agent tools.** `as_tools()` returns the pipeline as LangChain tools. An agent adds them in its `New()`.
- **Module job.** The way to run a pipeline on a cron, an interval or an event, in a NATS project. Each job run is recorded with its status, logs and result.
- **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](/user-guide/build/knowledge-graph/generate-python-classes).
- **In-engine only.** `abi new pipeline` refuses to run inside a remote module. There, write through `self.engine.services.triple_store` from a plain async function and run it from a `@job`.

```text
Integration (raw API data)  →  Pipeline.run  →  Triple store
                                   ↑
          POST /pipelines/…  ·  agent tool  ·  module job  ·  abi run script
```
