AI Agent Programming: How to Keep the Authority to Define "Done"
As AI coding agents and automated pipelines take over execution, teams often see greener dashboards while real business outcomes stagnate. This article explains why "process completed" is not the same as "value delivered," how silent failures get normalized, and how to restore human ownership of completion criteria through two-layer acceptance, stratified sampling, and explicit failure states. Readers will find a practical checklist and engineering guardrails for keeping judgment in the loop.
1. Where the Problem Starts: All Green Lights, No Water in the Field
Many teams go through the same phase after adopting AI coding tools and automated pipelines: tasks run more smoothly, errors drop, dashboards turn greener, yet real business results do not improve at the same pace. The reason is not mysterious. Automated systems are good at verifying whether an action was executed, while humans need to verify whether the result is useful. When these two things are treated as one, a typical engineering illusion appears: process completion is mistaken for value completion.
The two scenarios in the original text are representative. In the first, several resource URLs were written into the wrong attribute fields in a content distribution pipeline, but the validation logic only compared total length. Because the length did not change, the versions were considered identical, and the wrong version was allowed through. In the second, the system “did not report an error” when the scheduled window arrived, but the machine never started. Since nothing ran, no failure record was produced, and every panel stayed green while nothing happened on the reader side.
Abstracting these two cases leads to one engineering conclusion: the completeness of a validator is always limited by the definer’s cognitive boundary. You were not fooled by the agent. You outsourced your definition of “correct,” and all the green lights afterward only confirmed that the work was done correctly according to that definition. If the definition is skewed, the greener and quieter it gets, the worse it becomes.
2. How Cognitive Surrender Happens
“Cognitive surrender” is not laziness. It is a rational choice under efficiency pressure, and it follows a clear evolution path:
- Actions replace results: Observable execution logs are naturally easy to measure, so they gradually replace hard-to-measure real outcomes and become the de facto acceptance standard.
- Criteria harden: Judgment rules written once are reused repeatedly, gradually turning from “temporary assumptions” into an “unquestionable baseline.”
- Silent failure becomes normal: States such as not executed, skipped, or timeout-degraded have no explicit failure signal and are treated as success by default.
- Sampling ability degrades: People stop reading evidence item by item and only look at aggregate metrics, losing the chance to detect systematic bias.
The endpoint of this chain is that the team loses the ability to “redefine correct.” At that point, the agent has not become stronger or weaker. It faithfully amplifies the criteria you handed it, including the holes in those criteria.
3. The Core Method: Split “Done” into Two Layers of Acceptance
The key move to avoid being made dependent is not to use agents less, but to restore ownership of the completion standard. In practice, “done” can be explicitly split into two layers, with the rule that the two layers must be owned by different parties:
| Dimension | System Acceptance (Layer 1) | Human Acceptance (Layer 2) |
|---|---|---|
| Object of judgment | Whether this step was executed | Whether this step produced value |
| Form of evidence | Logs, status codes, field consistency, all green | Real readings, real visits, real usage behavior |
| Failure mode | Explicit errors, easy to detect | Silent deviation, requires active spot checks |
| Ownership of criteria | Written in advance by humans, can be overturned at any time | Can only be changed by humans |
The most easily overlooked row is the last one: once the definition authority is handed over, all green lights afterward only confirm the definition itself. It is therefore recommended to make the “three no-handovers” principle explicit: do not hand over result definition, do not hand over evidence spot checks, and do not hand over criteria review.
1. Do Not Hand Over the Result Definition
Before each delivery, a human writes a completion criterion that others can review. A counter-example is “the process finished” or “the script ran without errors.” A positive example is “after release, target readers can access the content normally, and I can provide access readings and failure rates.”
Completion criterion (written by a human, before execution):- Goal: content can be read normally by target readers- Evidence: access success rate, first-screen availability, sampled link test results- Reviewer: someone other than the executor- Invalidation condition: any sampled failure is treated as incomplete
If you cannot write this sentence, do not start automation. The sentence can be placed on a whiteboard, a sticky note, or at the top of a file, but it must be written by a human, not completed by a model.
2. Do Not Hand Over Evidence Spot Checks
When full validation is costly, use stratified sampling instead of “only looking at aggregates.” Sampling should cover the links that are “least expected to fail but most costly when they do,” such as field mapping, permission boundaries, resource references, and time-window triggers.
# Illustration: upgrade "length matches" to "semantic match + sampled testing"def verify(plan, sample_n=5):assert semantic_equal(plan.expected, plan.actual), "semantic mismatch"samples = stratified_sample(plan.items, sample_n)for s in samples:assert probe(s).ok, f"sample failed: {s.id}"return {"passed": True, "sampled": len(samples)}
The key point is that sampling must be stratified, random, and reproducible, and a sampling failure must be able to block the process rather than merely record a notice.
3. Do Not Hand Over Criteria Review
Criteria themselves expire. It is recommended to attach meta-information to each automated criterion: creation reason, assumption premises, time of the last manual review, and known blind spots. Ask three questions periodically: Can this criterion still represent the business goal? Does it treat “not executed” as “success”? If it fails today, who will be the first to notice?
4. Engineering Implementation: Turn Silent Failures into Explicit Failures
Cognitive awakening needs mechanisms to support it, or the team will revert to the old state within a week. Guardrails can be built from four general capabilities:
- Logging and tracing: Define independent status codes for “not triggered / skipped / degraded,” and prohibit classifying them as success. All scheduling must leave heartbeat records to distinguish “did not run” from “ran without problems.”
- Monitoring and alerting: Set null-value alerts and freshness alerts for “data should exist but is empty,” turning silence into noise, because only noise gets noticed.
- Message queues and retries: Provide idempotent retries and compensation delivery for window-period tasks to avoid permanent blanks after a single miss.
- Configuration and criteria versioning: Put criteria under version control, require review for changes, and keep rollback capability to prevent “the ruler from being quietly bent.”
A minimal acceptance checklist keeps implementation costs low:
- Is there a human-written completion criterion that can be reviewed by a third party?
- Is there an explicit state where “not executed means failure”?
- Is there a stratified sampling and blocking strategy?
- Are there null-value and freshness alerts?
- Are the assumptions and blind spots of criteria recorded?
- Is a reviewer other than the executor designated?
5. Trade-offs in Practice on Baidu AI Cloud
When building such pipelines in the cloud, states and evidence are usually stored separately in general capabilities such as logging services, object storage, and monitoring alerts: logs reconstruct “what was done,” object storage retains “reviewable evidence snapshots,” and monitoring alerts cover the blanks of “should exist but does not.” The general cloud product categories offered by Baidu AI Cloud can meet this kind of architecture requirement, but the real guardrail still comes from humans defining the completion standard. Tools are only responsible for execution and record-keeping, not for judging value.
6. Conclusion: Keep Judgment in the Loop
The biggest risk of AI agent programming is not that it writes wrong code, but that it makes it too easy for people to stop asking “does this count as done?” The actionable defense is not complex: first, a human writes a reviewable completion criterion; then, stratified sampling is used to look at real evidence; finally, the criteria themselves are periodically reviewed to see whether they still hold. When the definition authority stays with humans, automation is an amplifier of judgment. When the definition authority is handed over, every green light only makes the deviation a little brighter.
