# Workflow as Code

> Writing the steps of a pipeline in a code file. No clicks in a tool.

**Field:** Data Engineering  
**Category:** Orchestration  
**Also known as:** Pipelines as Code, Workflows as Code, Orchestration as Code

## Think of it like

It is like a recipe written down, not kept in the cook's head. Anyone can read it, copy it and fix it.

## Definition

Workflow as code means writing a pipeline's steps in a code file, not in clicks on a screen. The file says which tasks exist and what order they run in. The orchestrator reads the file and draws the graph from it. Because it is code, it lives in version control. Changes get reviewed, and the workflow can be tested before it runs. Airflow, Dagster and Prefect all work this way.

## Example

Emma's team keeps every pipeline as a Python file in git. A change to the sales pipeline goes through review first. When a run breaks, git shows what changed and who changed it.

## Why it matters

Clicked-together pipelines are hard to review, copy or undo. Code can be read, tested and rolled back.

## Common mistake

Putting slow work, like a database query, at the top of the file. The tool reads the file often, so that work runs again and again.

## Three principles

- **One file.** Steps and order are written down.
- **In version control.** Every change has a history.
- **Reviewed and tested.** Like any other program.

## Related terms

- [Workflow Orchestration](https://learn.benibix.com/term/data/workflow-orchestration)
- [Airflow DAG](https://learn.benibix.com/term/data/airflow-dag)
- [Airflow TaskFlow API](https://learn.benibix.com/term/data/airflow-taskflow-api)
- [Version Control](https://learn.benibix.com/term/development/version-control)
- [Code Review](https://learn.benibix.com/term/development/code-review)
- [Python](https://learn.benibix.com/term/development/python)

![A code file called daily_sales.py on the left defines two functions, extract and load, each marked @task, and calls load(extract()). An arrow leads to a graph on the right: an extract box, then a highlighted load box, with a note that the return value is handed on.](https://learn.benibix.com/diagrams/dat2-workflow-as-code.svg)

---

Source: https://learn.benibix.com/term/data/workflow-as-code
Author: Behnia Zarei (a developer in Vienna, Austria, who builds and teaches data, AI and business intelligence at BENIBIX)
Publisher: BENIBIX Learn (https://learn.benibix.com/)
Last updated: 2026-11-17
Licence: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Quote freely with attribution.
