---
question: What does a workflow expose as tools or HTTP?
kind: overview
---

# Workflows

A workflow is business logic in an in-engine module: one named intent, such as "summarize an entity" or "reward long-term customers". It reads the knowledge graph, calls integrations, and returns structured data. Agents use it as tools, and the API publishes it as a `POST` route.

A workflow is Python code, so Nexus has no screen that writes, runs or deletes one. Its tasks happen in the CLI, in Python and over the REST API.

<!-- matrix -->

## Key concepts

- **The class.** `Workflow[Parameters]` from `naas_abi_core.workflow`, with a `WorkflowConfiguration` dataclass and a `WorkflowParameters` Pydantic model. `abi new workflow` writes all three in `<Name>Workflow.py`.
- **`run(parameters)`.** The logic. It takes the parameters model and returns a dict, a list of dicts or a Pydantic model.
- **Discovery.** The engine loads every `Workflow` subclass under the module's `workflows/` folder when it starts, and builds it with `New()` or an empty `<Name>WorkflowConfiguration()`. A workflow whose configuration needs arguments is skipped: it has no tools and no route, and the reason is logged at debug level only.
- **`as_tools()`.** Returns the LangChain tools an agent calls. It is abstract on `Expose`: every workflow implements it.
- **`as_api(router)`.** Inherited from `Expose`. When `run` is real and takes a Pydantic model, the API mounts `POST /workflows/<class_name_in_snake_case>`, with the same bearer key as the agents.
- **In-engine only.** `abi new workflow` refuses to run inside a remote module. There, put the logic in a plain function that an agent tool or a `@job` calls.
- **Workflow or pipeline.** A workflow returns data. A [pipeline](/user-guide/build/knowledge-graph/creating-a-pipeline) returns RDF for the knowledge graph.

The Nexus Marketplace shows a **Workflow Templates** tile marked Coming soon.
