Data Engineering, Catalog and Quality Agents
Agents can find, explain and draft fixes quickly. Changing shared data still deserves the care of a software release.
Data engineering agents are most useful for finding datasets, explaining failures, drafting transformations and tests and preparing remediation. Let deterministic checks detect problems, let the agent gather evidence and propose changes, and require review, staging and verification before anything touches data that others depend on.
What you will learn: metadata discovery, quality dimensions and detection, root cause diagnosis, safe remediation, agent-assisted pipeline development, data incident handling and a reference architecture.
Prerequisites: Data Agents and AI Data Analysts and Knowledge Ingestion and Real-Time Pipelines.
The example runs in November 2026 with Python 3.13 and only the standard library. Table names, row counts and thresholds are invented. Real thresholds need to come from your data and the people who use it.
Where agents help data teams
| Activity | Agent contribution | Who decides |
|---|---|---|
| Discovery | Search the catalog and compare candidate datasets | Requester, with owner |
| Documentation | Draft descriptions from code and usage | Data owner |
| Quality | Suggest rules and summarize failures | Owner sets thresholds |
| Diagnosis | Collect changes, logs and lineage | Engineer confirms cause |
| Development | Draft transformations and tests | Code review |
| Operations | Prepare reruns and backfills | Approver, by impact |
Metadata and catalog discovery
A data catalog records what datasets exist, their columns, owners, descriptions, classifications, freshness and usage. For people it is a search tool. For agents it is the map that stops them guessing. A discovery agent takes a need such as "customer churn by plan" and returns a short list with reasons: this table is certified and updated daily; that one is a personal copy untouched for a year.
Ranking should use more than names:
- Certification or ownership status.
- Freshness and recent quality check results.
- Number of maintained consumers, as a hint of trust.
- Lineage from an authoritative source.
- Whether the requester is allowed to use it, and for what purpose.
Popularity can mislead, since a flawed table may be popular simply because it was found first. Show the evidence and let the owner be contacted. When descriptions are missing, an agent can draft them from transformation code, but mark drafts clearly. An unreviewed generated description will otherwise be read back later by another agent as fact, which is the loop that Metadata, Indexing, Quality and Lineage warns about.
Quality dimensions you can test
| Dimension | Example check | Common cause of failure |
|---|---|---|
| Freshness | Latest record is recent enough | Job did not run or source stalled |
| Volume | Row count near usual range | Filter bug or partial file |
| Schema | Columns and types as agreed | Upstream release |
| Completeness | Required fields filled | New optional form field |
| Uniqueness | Keys appear once | Replayed load |
| Validity | Values in allowed ranges and codes | New category or unit |
| Consistency | Totals agree across systems | Timing or logic differences |
| Accuracy | Sample matches the real world | Entry errors, hard to test automatically |
A dataset can pass every automated check and still be wrong. Checks prove that specific expectations hold, nothing broader.
Detection belongs in code
Run checks as part of the pipeline, with defined severity. A block-level check stops publication. A warning notifies the owner. Use fixed rules for things that must always hold, and statistical ranges for things that vary, such as daily volume. Ranges should respect weekly and seasonal patterns, and someone should review them, or a slow decline will become the new normal. A language model is a poor and expensive detector for arithmetic conditions. It is useful for proposing new rules from past incidents and for reading free text where no simple rule exists.
Diagnosis: find where it starts
One broken source can raise alerts on dozens of dependent tables. The first useful step is to follow lineage upstream and find the earliest place where checks fail while the inputs still pass. Then gather what changed there: code commits, schema changes, configuration, source system releases, job logs and volume history. An agent is good at collecting and summarizing this evidence. Ask it to list competing explanations and what observation would distinguish them, rather than to announce a single cause.
From alerts to a starting point
The program checks five assets for freshness, row count and null keys, walks the dependency graph, and reports where the fault begins and what is affected. It only proposes actions.
"""Check a daily load, find where the fault starts, and propose a fix."""
from statistics import median
UPSTREAM = {"raw_orders": [], "raw_customers": [],
"clean_orders": ["raw_orders"],
"order_facts": ["clean_orders", "raw_customers"],
"revenue_dashboard": ["order_facts"]}
HISTORY = {"raw_orders": [1010, 990, 1005, 1000, 995],
"raw_customers": [200, 202, 203, 204, 205],
"clean_orders": [1000, 981, 996, 992, 986],
"order_facts": [1000, 981, 996, 992, 986],
"revenue_dashboard": [30, 30, 30, 30, 30]}
TODAY = {
"raw_orders": {"rows": 1002, "hours_old": 3, "null_ids": 0},
"raw_customers": {"rows": 206, "hours_old": 2, "null_ids": 0},
"clean_orders": {"rows": 512, "hours_old": 2, "null_ids": 0},
"order_facts": {"rows": 512, "hours_old": 1, "null_ids": 0},
"revenue_dashboard": {"rows": 30, "hours_old": 1, "null_ids": 0},
}
def check(name):
now, usual = TODAY[name], median(HISTORY[name])
problems = []
if now["hours_old"] > 24:
problems.append(f"stale by {now['hours_old']} hours")
change = (now["rows"] - usual) / usual
if abs(change) > 0.2:
problems.append(f"row count {change:+.0%} against median {usual}")
if now["null_ids"]:
problems.append(f"{now['null_ids']} null keys")
return problems
def origins(failed):
"""A failing table is an origin if none of its inputs failed."""
return [t for t in failed if not any(u in failed for u in UPSTREAM[t])]
def downstream(table):
found = []
for name, inputs in UPSTREAM.items():
if table in inputs:
found += [name] + downstream(name)
return list(dict.fromkeys(found))
failed = {t: p for t in UPSTREAM if (p := check(t))}
for table in UPSTREAM:
print(f"{table:<18}", "; ".join(failed.get(table, ["checks pass"])))
for table in origins(failed):
print("\nFault starts at:", table)
print("Its inputs pass:", ", ".join(UPSTREAM[table]) or "none")
print("At risk downstream:", ", ".join(downstream(table)))
print("Proposed, waiting for approval:")
print(f" 1. hold publication of {', '.join(downstream(table))}")
print(f" 2. review the last change to the {table} transformation")
print(f" 3. rebuild {table} in a staging copy and rerun checks")
quiet = [t for t in UPSTREAM if t not in failed
and any(t in downstream(f) for f in failed)]
print("\nPassing own checks but built on bad input:", ", ".join(quiet))
Output:
raw_orders checks pass
raw_customers checks pass
clean_orders row count -48% against median 992
order_facts row count -48% against median 992
revenue_dashboard checks pass
Fault starts at: clean_orders
Its inputs pass: raw_orders
At risk downstream: order_facts, revenue_dashboard
Proposed, waiting for approval:
1. hold publication of order_facts, revenue_dashboard
2. review the last change to the clean_orders transformation
3. rebuild clean_orders in a staging copy and rerun checks
Passing own checks but built on bad input: revenue_dashboard
The most instructive line is the last one. The dashboard passes its own checks, because it always has thirty rows, one per day, even when each day's figures are built from half the orders. A monitor that watched only the dashboard would have stayed quiet. The program calls clean_orders the origin because its input passes, but that is a clue, not proof: the raw table could contain a subtle problem that its checks do not measure, such as a changed status code that the cleaning step now filters out. A person, or a further investigation step, has to confirm.
Remediation with guardrails
| Action | Reversibility | Suggested control |
|---|---|---|
| Notify owners and consumers | Not reversible, low impact | Automatic with templates |
| Pause publication | Easy to resume | Automatic for block-level checks |
| Quarantine bad records | Reversible if kept | Rule approved in advance |
| Rerun a job | Depends on idempotency | Allowed if proven safe to repeat |
| Backfill history | Costly to undo | Owner approval and staging comparison |
| Edit or delete values | Often irreversible downstream | Change request, backup, second reviewer |
Require that fixes are made in pipeline code or governed correction tables, never as silent manual edits that the next run overwrites or that nobody can explain. Check whether consumers have already exported or acted on the bad data. Restoring the table does not recall an email campaign or a payment file. Reliable Tool Execution and Error Recovery covers idempotency and compensation.
Agent-assisted pipeline development
A coding agent can draft a transformation from a description, but data work has hazards that application code does not: a wrong join can look plausible and flow into reports for weeks. Give the agent a structured brief and a safe place to work.
- Brief: inputs, target grain, keys, definitions, late data behavior, history rules and expected volumes.
- Workspace: a development environment with masked or synthetic data and no production write access.
- Tests: written from the brief, including duplicates, nulls, late arrivals and reruns.
- Comparison: differences between old and new outputs, summarized by key and period.
- Review: a pull request that shows the code, test results, cost estimate and downstream impact.
- Release: staged rollout with a rollback or rebuild plan.
The comparison step deserves attention. Reviewers can read code and still miss a change in results. A table of rows added, removed and altered makes the effect concrete. The general practices are in Issue-to-Pull-Request, Debugging and TDD Workflows and Code Review, Refactoring and Quality Measures.
Tests that catch data mistakes
| Test | Catches |
|---|---|
| Run twice on the same input | Duplicates from reruns |
| Totals before and after joins | Row multiplication or loss |
| Late and out-of-order records | Missed or double-counted data |
| Unknown category value | Silent drops |
| Empty input | Overwriting good data with nothing |
| Large input sample | Skew and runaway cost |
Data observability and incidents
Treat a serious data fault like a service incident, with severity, an owner, communication and a review. An agent can open the incident with the failing checks, affected assets and consumers, recent changes and a timeline, then keep the record current as people work. Group related alerts into one incident to avoid flooding responders. Do not let the agent close an incident because checks pass again; someone should confirm that affected data was rebuilt and that consumers were told.
Useful measures include time to detect, time to restore, the share of problems found by checks rather than by consumers, repeat incidents and alerts that led to no action. The last one matters because noisy checks train people to ignore all of them. See Loops, Performance, Incidents and Maturity.
Agentic data engineering reference architecture
Keep the orchestrator as the system that runs production jobs. The agent may request a run through a narrow interface with allowed job names and parameters, which the orchestrator validates. Give each agent its own identity so that its actions are visible in audit records, and scope secrets so that a development session cannot reach production. Network, Tenant and Multi-Agent Isolation and Durable Execution, Checkpoints and Approvals provide the underlying patterns.
Raise autonomy by evidence
| Level | Agent may | Move up when |
|---|---|---|
| 1. Explain | Summarize failures and likely causes | Engineers agree with diagnoses often |
| 2. Propose | Open pull requests and run plans | Proposals pass review with few changes |
| 3. Act on safe cases | Retry idempotent jobs, pause publication | No harmful actions over an agreed period |
| 4. Broader repair | Predefined repairs with automatic verification | Each repair type has its own record |
Grant each action type separately. Success at retries says nothing about the safety of backfills. Lower the level again after an incident or a major platform change.
Treat logs and data as untrusted
Log lines, file names, column descriptions and records can contain text from outside. An agent that reads them while holding the power to run jobs could be steered by planted instructions. Separate reading from acting, restrict action parameters to validated values and require approval for anything outside the predefined set. Mask personal data in the samples the agent sees.
Watch compute cost
Exploratory queries, profiling and repeated reruns can cost more than the model calls. Set limits per task, sample before scanning everything, reuse stored profile results and record cost in each pull request. A fix that doubles daily processing cost should be a visible decision. Agent Cost Model and Token Economics helps estimate the total.
Write handovers people can act on
An agent that finishes a diagnosis should leave a record that an engineer can use without rereading the whole run. Ask for the same short structure every time:
| Field | Content |
|---|---|
| What failed | Checks, assets, values and expected ranges |
| Where it seems to start | Earliest failing asset and the evidence for it |
| What was ruled out | Explanations examined and why they do not fit |
| Who is affected | Reports, exports, models and teams downstream |
| Proposed next step | Action, expected effect, cost and how to undo it |
| Open questions | What only a source owner can answer |
Link every statement to a log entry, query or commit. Mark anything inferred as inferred. When the engineer finds a different cause, record it beside the agent's proposal. Over time those pairs show which kinds of failure the agent diagnoses well, which is the evidence needed before widening what it may do by itself.
Common mistakes
| Mistake | Consequence | Instead |
|---|---|---|
| Model decides whether data looks wrong | Inconsistent detection | Coded checks with thresholds |
| Fixing the symptom table | Fault returns on the next run | Trace to the origin |
| Direct production edits | Untraceable and overwritten changes | Reviewed code or correction tables |
| Publishing generated descriptions unreviewed | Errors become reference material | Label drafts and assign owners |
| Rerunning non-idempotent jobs | Duplicate data | Prove repeat safety first |
| Closing on green checks | Consumers keep bad copies | Confirm rebuild and notification |
Checklist
- Important datasets have owners, descriptions and quality checks.
- Checks have severity and run before publication.
- Lineage lets responders find origins and consumers.
- The agent has read access scoped to its task and masked samples.
- Changes go through code review, tests and output comparison.
- Each automatic action is predefined, repeatable and logged.
- Backfills and edits need approval and a recovery plan.
- Incident reviews add checks and tests.
Frequently asked questions
Can an agent write our quality rules?
It can propose rules from profiles and past incidents. Owners should accept them, because a rule inferred from faulty history will protect the fault.
Do we need lineage before using agents?
Partial lineage for critical pipelines is a good start. Without it, diagnosis relies on guesswork and impact is easy to miss.
Is automatic remediation safe?
For narrow, repeatable and verifiable actions it can be. Anything that rewrites history or deletes records should keep a human approval.
How is this different from ordinary coding agents?
The output is shared data with downstream consumers, so tests must check results and effects as well as whether code runs.
References
- OpenLineage documentation
- W3C PROV overview
- Databricks: medallion lakehouse architecture
- Delta Lake documentation
Where to go next
Lineage, Governance, Lakehouse and Streaming Agents
Analyze impact and enforce policy.
Data Contracts, Access and Retention
Agree expectations with producers.
Sandboxes, Safety and Security for Coding Agents
Bound agents that write and run code.