What matters in AI.

Subscribe

Learn / AI agents

Definition · AI agents

Declarative pipelines

A declarative pipeline is a data pipeline that describes the datasets you want, not the steps to build them. An engine such as Apache Spark Declarative Pipelines reads the description, finds the order of the steps and runs them. AI coding agents write such pipelines, and a dry run can find structural errors before any data moves.

Last reviewed

Key points

  • A declarative pipeline says what tables must exist and what they hold. The engine controls the sequence, the parallel work and the errors.
  • Apache Spark 4.1 added Spark Declarative Pipelines (SDP). Databricks gave the framework to Spark in June 2025.
  • A dry run reads and writes no data. It checks the code, the tables, the columns and the dependency graph.
  • In a Databricks test of 528 agent-built pipelines (October 2026), procedural pipelines used about 34 times the compute of declarative ones.
  • The dry run does not find incorrect logic. In the same test, about 3 in 10 builds of each type gave an incorrect answer with no error.

How a declarative pipeline works

You write what must exist. The engine finds how to make it. The Apache Spark guide says you “define what tables should exist and what their contents should be”.

The parts of a Spark Declarative Pipelines (SDP) project:

  • Datasets. Streaming tables, materialized views and temporary views.
  • Flows. A flow reads a source, applies your logic and writes to a dataset.
  • Source files. Python or SQL files with the definitions.
  • Spec file. spark-pipeline.yml names the pipeline, its files and its storage.

The engine finds the dependencies between datasets and sets the sequence. The Spark 4.1.0 notes say Spark also handles “checkpoints, and retries”.

A procedural pipeline lists the steps. A declarative pipeline lists the datasets, and the engine plans the steps after a dry run.
A procedural pipeline lists the steps. A declarative pipeline lists the datasets, and the engine plans the steps after a dry run.

Why declarative pipelines matter for AI agents

A dry run gives a coding agent a fast and cheap test. spark-pipelines dry-run reads and writes no data. It finds three types of error:

  1. Syntax errors in Python or SQL.
  2. Analysis errors, such as a table or a column that does not exist.
  3. Graph errors, such as cyclic dependencies.

Procedural code has no such gate. A structural error shows only at the broken step, on the cluster.

Databricks tested 528 pipelines that one agent made on Opus 4.8 (October 2026). The numbers are a vendor claim.

Result, 264 builds of each type Procedural Declarative
Builds that finished 255 258
Compute, executor-seconds 596 17
Median lines of code 131 64
Stopped at dry run not applicable 55
Silent bugs (no error, incorrect answer) 73 (27.7%) 85 (32.2%)
LLM tokens, median cost about $0.26 about $0.50

In practice

Three places use the term today:

  • Apache Spark. SDP is in release 4.1.0 (SPARK-51727). Databricks announced the gift of its “core declarative ETL framework” on 11 June 2025.
  • Databricks Lakeflow. Databricks says Lakeflow pipelines “are built on Apache Spark Declarative Pipelines”.
  • Qlik Talend Cloud. Pipelines are YAML files that “AI coding agents can plan, generate, validate, and modify”. Qlik puts a human in the loop review before deployment.

A person must also read the logic, because the engine cannot check intent.

Trade-offs

Gain Cost
Structural errors found before the run More LLM tokens for each build (about 2.3 times in the Databricks test)
About half the code to review Silent logic bugs at the same rate
In the same test, 19 procedural builds used an in-memory shortcut. No declarative build used it.

The Databricks test used one model, one agent and 22 tasks. The 34 times figure is one result, not a general law.

Where definitions disagree

The term has two uses.

  • Data pipelines. Spark, Databricks Lakeflow and Qlik use the term in data engineering. The pipeline moves and changes data, and an agent can write it.
  • Agent workflows. Ivan Daunis (arXiv, December 2025) uses “declarative” for a language that describes the steps of an LLM agent. The same definition runs in Java, Python or Go. This is closer to an AI workflow than to a data pipeline.

The news phrase “the agent describes the result” fits the first use. Check which use a source means.

Questions and answers

Why do AI agents write declarative pipelines?

A declarative pipeline gives a coding agent a fast check. In Spark Declarative Pipelines, a dry run finds syntax errors, missing tables or columns and cyclic dependencies without data. In a Databricks test of 528 agent-built pipelines (October 2026), this cut compute by about 34 times. The same test found declarative builds used about 2.3 times more LLM tokens.

Does a declarative pipeline stop wrong results?

No. A dry run finds only structural errors. In the Databricks test, 27.7% of procedural and 32.2% of declarative builds ran cleanly and gave a wrong answer. The authors say logic still needs tests and review.

Is Spark Declarative Pipelines open source?

Yes. Databricks announced on 11 June 2025 that it gave its declarative ETL framework to Apache Spark. Spark Declarative Pipelines is part of Apache Spark from release 4.1.0.

Sources

  1. Built by agents: the case for Spark Declarative PipelinesDatabricks (Lisa Cao, Sudhanva Huruli), 23 Oct 2026
  2. Spark Declarative Pipelines Programming GuideThe Apache Software Foundation
  3. Spark Release 4.1.0The Apache Software Foundation
  4. Databricks Donates Declarative Pipelines to Apache Spark Open Source ProjectDatabricks, 11 Jun 2025
  5. Spark Declarative Pipelines on LakeflowDatabricks
  6. Agentic data engineering in Qlik Talend CloudQlik
  7. A Declarative Language for Building And Orchestrating LLM-Powered Agent WorkflowsarXiv (Ivan Daunis), 22 Dec 2025

In the news