AI Coding Agents and Constraint Decay: A Selection Framework for Reliable Delivery
Cheap inference and unreliable delivery are two different problems. This article examines constraint decay—the nonlinear drop in pass rates as structured requirements pile up—and why coding agents that write valid SQL still fail on enterprise naming, permissions, auditing, lineage, and performance rules. It covers what falling API prices change and what they don't, then lays out practical steps for data teams: making implicit contracts explicit as code, adding validation gates, using retrieval to supply context, rolling back in small steps, and building an evaluation set. It closes with a selection checklist for a low-cost environment.
1. Prices Dropped. Failures Didn’t.
Over the past two years, LLM inference costs have kept falling. One cloud provider permanently cut the API price of its flagship model to roughly 20% of the original, while pushing forward an engineering program for agentic coding. The industry has reshuffled at the capability level too: gaps between models are narrowing while price gaps widen, and the coding agent space has entered a “low price, high expectations” phase.
Engineering practice tells the other half of the story. A research paper on “constraint decay” drew heavy discussion in developer communities. Its core finding: as structured constraints accumulate, the assertion pass rate of coding agents drops by about 30% on average, and weaker configurations approach zero.
Put the two together and there is no contradiction: cheaper calls do not mean reliable delivery. For data teams, getting a model to produce a basic query has long stopped being the problem. The real problem is that failure rates climb sharply once it must simultaneously satisfy enterprise naming conventions, the permission model, audit requirements, lineage management, and performance constraints.
2. Constraint Decay: Why “Can Write SQL” and “Can Ship SQL” Are Different
1. What constraint decay is and how it shows up
Constraint decay means that as the number of structured requirements a task must satisfy at once grows, the probability that an agent’s output meets all of them falls nonlinearly. It isn’t the model getting dumber; it’s the coupling between constraints making the search space explode.
Assume each constraint is satisfied with probability 0.95. If 20 constraints were roughly independent, the probability of satisfying all of them would be about 0.95^20 ≈ 0.36. In reality constraints are not independent (naming conventions affect permission checks, permissions affect which tables are reachable), so decay is usually faster.
2. Framework sensitivity: constraint density decides the outcome
The key pattern in the research is “framework sensitivity”: agents do well under a minimal framework with very few rules, and degrade noticeably under frameworks dense with conventions and implicit norms. The same holds in the data domain:
- Single-table ad hoc query: few constraints, high success rate;
- Multi-table joins + layered modeling + unified metric definitions: dense conventions, success rate collapses;
- Add row-level permissions, masking policies, and audit trails: close to the “zero score” range.
3. Example: how constraints break a single generation
-- Counter-example: what models often produce, "technically correct, unusable in engineering"SELECT u.name, SUM(o.amount) AS totalFROM user u JOIN orders o ON u.id = o.user_idGROUP BY u.name;-- Engineering requirements: partition pruning, masking, unified metrics, naming conventions, audit fieldsSELECTCOALESCE(NULLIF(TRIM(u.user_name), ''), 'UNKNOWN') AS user_name_masked,SUM(o.paid_amount) / 100.0 AS paid_amount_yuan,MAX(ds) AS data_dateFROM dwd.dwd_user_df uJOIN dwd.dwd_order_di oON u.user_id = o.user_id AND o.ds = MAX(u.ds)WHERE o.ds BETWEEN '2026-07-01' AND '2026-07-31'AND o.order_status = 'PAID'GROUP BY 1;
The difference isn’t syntax, it’s the “implicit contract”: partition fields, amount units, status enums, null handling, masking rules, naming hierarchy. These contracts are usually scattered across documentation, code review comments, and historical tickets, so the model has no way to acquire them automatically.
3. What Falling Prices Changed, and What They Didn’t
What changed: you can run large-scale experiments, batch refactors, full code scans, and regression generation freely; caching and batching cut the cost of repeated long-context prefixes sharply, making calls in the hundreds of millions of tokens per day affordable.
What didn’t:
- Correctness is still a human responsibility, and output must be verifiable;
- Context quality sets the ceiling; dirty metadata and missing metric documentation directly amplify hallucination;
- Permissions and compliance cannot be outsourced to the model; least privilege and auditing must be enforced by the platform;
- Errors accumulate along long chains of tasks, so multi-step planning needs external checkpoints.
4. Putting It Into Practice on Data Teams
1. Make implicit constraints explicit
Establish a “constraints as code” spec file that the agent reads on every generation, so it always works from the same contract:
naming: { layers: [ods, dwd, dws, ads], suffix: { full: _df, incremental: _di } }partition: { field: ds, format: yyyy-MM-dd, required: true }metric: { amount_unit: cent, output_unit: yuan, rounding: half_up }security: { mask_fields: [phone, id_card], row_level_policy: required }audit: { columns: [created_by, created_at, source_task] }
2. Decompose the task and add validation gates
Turn “generate → static check → dry run → review” into a pipeline where every step has an automated gate: syntax parsing, partition-field existence checks, unit tests for metric definitions, and comparison of result row counts and variance against thresholds. Any failed gate triggers a rollback and regeneration, keeping errors from propagating downstream.
3. Fill the context gap with retrieval augmentation
Write table schemas, column comments, metric definitions, and strong historical queries into a searchable knowledge base, and retrieve relevant snippets automatically before generation. The closer the context is to the real contract, the weaker constraint decay becomes.
4. Move in small, rollback-friendly steps
Generate and dry-run in development branches and sandbox environments first, using canary releases and versioned task definitions so you can roll back quickly by version when something breaks. Containerized runtimes with unified logging and monitoring alerts make every generation observable and traceable.
5. Build an evaluation set instead of relying on gut feel
Collect 50–200 real tasks as a regression evaluation set, tracking three metrics: assertion pass rate, human rework time, and defect escape rate. Rerun it after every model swap or prompt strategy change, and decide with data rather than impressions.
5. Selection Checklist in a Low-Cost Environment
- Constraint adherence: first-pass rate under dense-convention scenarios;
- Verifiability: how easily it plugs into static checks and automated tests;
- Context engineering support: long-context stability, retrieval integration, and cache friendliness;
- Permissions and compliance: whether it can connect to unified identity, key management, and audit logs;
- Cost structure: beyond unit price, watch rework cost—one rework often cancels out the savings from dozens of calls.
6. Conclusion
A price war lowers the bar for “usable” to almost nothing, but the bar for “deliverable” is set by constraint governance. What data teams really need to build is not a hunt for a cheaper model, but a way to turn conventions, metric definitions, permissions, and auditing into machine-readable contracts, and to use a pipeline to lock agent output inside a verifiable cage. Do that, and low prices convert into productivity instead of more rework tickets.
