Platform · Open reference architecture

Governed AI agents for data engineering

Spark Declarative Pipelines, Spark Connect, Kubernetes and a governed Iceberg REST catalog

Agents write pipeline specs; the platform decides what they are allowed to touch.

KubernetesAWSLaptop (Docker)Any cloudUpdated 2026-11-21

In one paragraph

Governed AI data engineering is an architecture in which AI agents author data pipelines but never hold direct power over data. The agent writes declarative Spark Declarative Pipelines specs as a pull request; CI dry-runs them against the real catalog; a controller applies approved changes. Each tenant reaches Spark only through one identity-pinned Spark Connect ingress behind mTLS, executors run as Kubernetes pods, and a governed Iceberg REST catalog authorizes every request and vends storage credentials scoped to that tenant. Each layer owns one job, so a mistake in one does not become a breach in another.

Platform

Spark Declarative Pipelines, Spark Connect, Kubernetes and a governed Iceberg REST catalog

Sources

Ingestion

Open lakehouse platform

Engine access

Execution

Data foundation

Governance

Operations

Serving

Teams

Lit boxes are part of this architecture, with the versions its reference repo pins. Switch to Full platform to see every capability. Select any box or team for details. marks a swappable choice.

When to use it

  • You want AI agents to build or change pipelines without giving them production credentials.
  • You need per-tenant isolation on shared Spark infrastructure.
  • You want defects caught before any data is processed.

When to pick something else

  • A single-user sandbox: the masterclass's local agent chapter is the lighter starting point.

Walkthrough

How data moves through it

  1. 1

    Agent proposes

    The agent writes Spark Declarative Pipelines specs and opens a pull request; it has no direct write path.

  2. 2

    CI dry-runs

    CI runs the pipeline in dry-run mode against the real catalog, catching structural defects before any data is processed.

  3. 3

    Identity-pinned ingress

    The tenant's client certificate reaches Envoy, which routes by its SPIFFE URI SAN to that tenant's Spark Connect server.

  4. 4

    Executors run

    Kubernetes schedules executor pods that do the work.

  5. 5

    Catalog authorizes

    Lakekeeper with OpenFGA authorizes each table operation and vends STS credentials scoped to the tenant's prefix.

Bill of materials

Components and versions

Versions are the ones pinned in the reference repositories below.
CapabilityComponentRole in this architectureVersionLicense
SourcesSource systemsAI coding agentWrites inert pipeline specs as a pull request
AI and agentsAgent harness and policyOmnigentAgent harness with tools and policies
AI and agentsModels and gatewayOllamaLocal model for the course's agent chapterMIT
Engine accessSpark Connect sessionsSpark ConnectThe single identity-pinned ingress per tenant4.1.2Apache-2.0
ExecutionBatch and SQLApache SparkExecutors do the work4.1.2Apache-2.0
ExecutionDeclarative pipelinesSpark Declarative PipelinesDeclarative authoring: specs, not imperative jobsSpark 4.1.2Apache-2.0
Data foundationCatalog and credentialsLakekeeperor Unity Catalog OSS, Apache PolarisGoverned Iceberg REST catalog with per-principal authorization and credential vending0.13.1Apache-2.0
Data foundationOpen table formatApache Icebergor Delta LakeTables under per-tenant prefixes1.11.0Apache-2.0
Data foundationObject storageAmazon S3or MinIOData under per-tenant prefixes with STS-scoped credentials
GovernanceAccess control and policyEnvoymTLS on :15009; routes each client certificate to its tenant1.31.5Apache-2.0
GovernanceAccess control and policyOpenFGAAuthorization model behind the catalog1.14.0Apache-2.0
OperationsRuntime, CI/CD and IaCGitOps CI gatePR-only output, dry run against the real catalog, reconcile
OperationsRuntime, CI/CD and IaCKubernetesClient-mode driver plus executor pods on EKSEKS 1.31Apache-2.0

People and agents

Who works with it

Data engineers

Pipelines that are correct, idempotent and cheap to rerun.

Works with: Batch and SQL, Declarative pipelines, Open table format

AI agents

Tools with clear arguments, a sandbox to write into, fast feedback from dry runs, and version-pinned context.

Works with: Spark Connect sessions, Declarative pipelines

ML and AI engineers

Reproducible models, traced and evaluated agents, and a model gateway they control.

Works with: Models and gateway, Agent harness and policy

Analysts and analytics engineers

One definition of each metric, fast SQL, and dashboards that match.

Works with: Batch and SQL

Platform engineers

A platform that is boring to run: deployable from code, observable, with identities for every person, service and agent.

Works with: Object storage, Catalog and credentials, Runtime, CI/CD and IaC, Spark Connect sessions

Governance and security

Policies that hold in every engine and for every agent, lineage for audits, and least privilege by default.

Works with: Access control and policy, Catalog and credentials, Agent harness and policy

Run it

Reference code

open-lakehouse/safe-spark-agents-paperKubernetesAWSLaptop (Docker)

Working paper, reproducible study and open reference architecture for safe, governed AI data engineering on Apache Spark.

cd study
python3 analysis/analyze.py results/results.powered.AB.n12.final.jsonl --tasks config/TASKS.lock.json --assume-backend local
open-lakehouse/lakehouse-masterclassApache-2.0Laptop (Docker)

Chapter 3 runs an agent on Omnigent with a local Ollama model, MCP tools and ALLOW, DENY and ASK policies; chapter 13 has a coding agent operate the stack through AGENTS.md.

Early-stage agent skills for the open lakehouse, driven by a connection profile instead of hardcoded hosts (lakehouse-core ships today).

Caveats from the reference repos

  • The isolation proof runs on one Spark Connect server per tenant; a shared-server design is described as frontier work in the paper.
  • The five isolation links are proven one at a time, not as one composed request.
  • Unity Catalog OSS 0.5.0, evaluated as an alternate catalog, could not do per-principal authorization on its Iceberg REST path.

Industry lenses

Where this architecture shows up

Each card opens the board with that industry's sources. Full industry pages: Payments and fintech, Cybersecurity.

Answers

Frequently asked questions

How do you let AI agents build data pipelines safely?
Give them a declarative output and no direct path to data: the agent writes Spark Declarative Pipelines specs as a pull request, CI dry-runs them against the real catalog, and execution happens through an identity-pinned Spark Connect ingress with a catalog that authorizes every table operation.
Do declarative pipelines catch more agent mistakes?
In the safe-spark-agents study (528 runs: 22 tasks, 12 seeds, 2 arms), the Spark Declarative Pipelines dry run caught 79 structural defects before any data was processed, against 0 for the imperative arm. SDP output was 49% fewer lines at about 2.3 times the tokens.