
AI agents can write functioning code faster than most engineering teams can review it. What they cannot yet do reliably is understand the assumptions embedded in a distributed system. This gap is where testing philosophy needs to change.
A recent integration testing project makes the case concretely. The task: build a testing framework for a distributed backend system whose application code had also been written by AI agents. The dependencies were mocked using in-memory versions, built from Docker images the agents assembled out of each service’s own build artifacts. The central engineering challenge was not standing up any single dependency – it was getting these in-memory services to interact correctly with each other while minimizing the number of testing specific blocks in the code required to get the setup working so as to keep the test environment faithful to production behavior.
Where AI agents accelerate development
AI agents excel at exploration. They surface frameworks and approaches an engineer might not reach for by default, and they compress the time needed to get a first working version of a component in place. For well-documented, well-understood patterns, this is a genuine advantage, and it’s the primary reason teams are turning to agents for this kind of infrastructure work in the first place.
Where AI agents introduce risk
The failures in this project were not loud. Nothing crashed. Instead, the agents made confident, incorrect assumptions and took undisclosed shortcuts to make components appear functional. Several patterns recurred:
- Assumed happy-path ordering in scenarios where message or request ordering was never actually guaranteed.
- Collapsed partial failure into full failure or full success, erasing the messiest and most important property of a distributed system.
- Worked around idempotency requirements silently, rather than surfacing that retry-safe design was needed.
- Assumed caching layers that did not exist, building logic around a performance characteristic the system never actually had.
- Carried assumptions and context from one service into another when constructing the integration test suite, treating knowledge specific to one service as if it applied uniformly across the boundary being tested.
Each of these surfaced only after the in-memory services were wired together and began behaving in ways that diverged from production expectations, at which point resolving the issue required a secondary investigation to trace the assumption back to its source.
The verification tradeoff
This is the central design question for any team testing AI-written code: how much of the agent’s work should be verified before it’s trusted?
Validate every assumption an agent makes, and the time advantage that justified delegating the work in the first place disappears. Leave assumptions unverified and correct only what surfaces later, and the team inherits a system whose failure points are unknown until something breaks. There is no universal answer, but wherever a team draws that line directly determines the quality and fidelity of the resulting test suite. A framework built on upfront verification is the product of deliberate design. A framework built on downstream correction is shaped as much by which mistakes happened to surface as by intentional decisions. The two are not equally trustworthy, even when both technically pass their tests.
The cost of recovery
Once an invalid assumption is identified, the next question is how much of the agent’s prior work can be salvaged.
Here, AI-written code differs meaningfully from human-written code. Correcting a person’s mistaken assumption typically means slow reconstruction and retracing their reasoning to understand what should have happened instead. An agent, by contrast, can take a corrected assumption and re-derive much of the affected work quickly, which makes recovery cheaper on average than the equivalent human error.
Cheaper does not mean cheap. A bad assumption discovered late, say after several dependent components were built on top of it, can still cost days of effort to unwind, even with an agent doing the rework. The cost of a wrong assumption scales with how long it survives undetected. That is the strongest argument for designing the testing strategy to surface bad assumptions early, rather than treating testing as a validation pass applied at the end.
What this means for testing strategy
Traditional testing philosophy assumes the code’s author understood the tradeoffs being made, and that tests exist primarily to catch implementation mistakes. That assumption does not hold for AI-written code. An agent optimizes for a plausible-looking solution, not necessarily a correct one, and that changes what a test suite needs to do.
Four adjustments follow directly:
- Test the assumptions, not just the outputs. Correct output for a given input is not sufficient evidence of correctness. Tests need to explicitly probe the distributed-systems edge cases – reordering, retries, partial failure, idempotence, etc. that agents are most likely to have glossed over.
- Compensate for the loss of visible reasoning. A human engineer’s shortcut usually leaves a trace e.g. a comment, a TODO, a flagged tradeoff. An agent’s shortcut is often indistinguishable from a deliberate decision. Testing has to substitute for that missing signal.
- Weight verification toward failure and concurrency scenarios. In-memory dependencies make it cheap to simulate the conditions e.g. dropped connections, out-of-order delivery, duplicate messages that are most likely to expose an agent’s invalid assumptions before they reach production.
- Design for early detection, not eventual correction. Because the cost of an undetected assumption compounds over time, the testing strategy needs to surface invalid assumptions as early in the build process as possible.
The larger shift
Heavy human correction was still required on this project – not because the agents lacked value, but because the correctness a distributed system demands cannot be verified by reading code that looks plausible. It has to be tested for, explicitly and adversarially.
This has implications beyond any single team’s workflow. As AI agents take on a larger share of infrastructure and application code, the volume of code that “looks right” without being verifiably right will only grow. Review processes built around human authorship, where a reviewer can reasonably infer intent from context, comments, and prior conversations, offer little protection against an author that has no intent to infer, only a plausible pattern to complete.
The organizations that adapt fastest will be the ones that treat this as a testing problem rather than a tooling problem. Better prompts and more capable models will not close this gap on their own, because the gap is not about capability, it is about the absence of a trace. An agent that makes a wrong assumption with total confidence looks, from the outside, identical to one that made the right call. The only way to tell the difference is to test for it.
That is the real shift testing philosophy needs to make: from verifying that code works to verifying that its author actually understood why. Most existing testing frameworks were never built to ask that question, and for AI-written code, it may be the only question that matters.



