AI coding agents can generate a function, fix a bug, or scaffold an application in minutes. The harder question is whether what they produce is actually correct, safe, and compatible with the system you're changing. A polished demo rarely captures what "good code" looks like in a real production codebase - where dependencies, architecture, security requirements, and old trade-offs all matter.
And this gap is starting to hurt teams using "AI software factories": workflows where agents write a lot of the code, while people and systems steer the work and verify the output. Sonar CEO Tariq Shaukat made a version of this point at the AI Dev conference in New York. Code is getting easier to generate; confidence in it is still harder to earn. For engineering leaders, that's not a sign AI coding "failed." It's a reminder that generating code and proving it's fit for use are two different jobs.
This article lays out a pragmatic way to think about verification, risk, and how software engineers' roles are shifting. You'll see what context to give agents, where automation actually makes sense, and why adding more agents doesn't automatically make the result more reliable.
Why does AI-generated code need human verification?
AI-generated code needs verification because a plausible answer isn't the same thing as a correct change to a real system. An agent can produce code that passes a narrow test while missing a security issue, breaking an established pattern, or causing problems elsewhere in the codebase. The bigger and more consequential the change, the less you can trust what a local demo tells you.
Clean examples are not production systems
A lot of coding demos are built around small, controlled tasks. The model gets a clear request, a limited set of files, and an obvious way to test the result. That's great for showing what a tool can do - but it doesn't prove the same tool can work safely across a large, interdependent application.
In a mature codebase, the right implementation often depends on conventions that are only partially documented: how permissions are handled, which libraries the team allows, where business rules actually live, and why a check that looks redundant exists. A developer who already knows the system will usually look for those constraints. An agent won't necessarily guess them. Without guidance, it may pick the shortest path to "looks working" instead of the path that fits your system.
Repeated checks can produce different findings
At the conference, Shaukat described running Claude Code against the same codebase three times. The runs turned up 40 issues, then 11, then 18. It's anecdotal, not a controlled benchmark - but it points to an operational reality: an agent's review can vary between runs.
That matters when teams treat model output like a pass-or-fail verdict. If one run looks clean and another finds something serious, you still need a reliable way to separate signal from noise. You can ask a second agent to adjudicate, but that can add yet another source of variability. More outputs aren't automatically stronger evidence.
Verification is about evidence, not distrust
Reviewing AI-generated work doesn't mean you have to inspect every line by hand. Teams already use automated tests, monitoring, and existing processes for human-written code. The goal is to gather evidence that matches the risk: tests that exercise the behavior, checks for security and quality, plus human review when system knowledge or accountability is required.
One useful distinction is between confidence in the tool and confidence in a specific change. A team might have evidence that an agent is reliable on a narrow, repeatable task - while still needing to verify each change's context. Confidence comes from measuring outcomes over time, not from taking the model's own claim at face value.
How should teams verify AI-generated code?
Start by defining what "a good result" means before asking an agent to produce anything. Verification falls apart when the task is fuzzy, acceptance criteria aren't defined, and review only begins after the code already exists. The agent needs constraints, and the team needs a way to judge the output against them.
Specify behavior and boundaries
A solid task definition covers more than the requested feature. It should spell out the expected behavior, the relevant files or components, constraints from your existing architecture, and conditions that would make the change unacceptable. For example, a payment-related change might define what should happen after a failed transaction, how retries should behave, and which service owns the business logic.
You also need a definition of done that's actually checkable. Depending on the task, that can include:
- Required tests and what those tests must cover.
- Security or privacy conditions that must remain true.
- Architecture and codebase conventions the change must follow.
- Compatibility requirements (including what API behavior must stay the same).
- Evidence the agent should provide, like which files changed and what checks it ran.
This isn't busywork. Clear constraints help the agent avoid optimizing for a narrow reading of the request.
Put expertise into the workflow
Teams often carry domain knowledge in people's heads, scattered docs, review comments, and existing tests. If that knowledge isn't available to the agent, it can't reliably apply it. The practical work is to bring the relevant expertise into the coding workflow: instructions, repository guidance, reusable checks, and examples of what should pass (and what should fail).
This also applies to automated review. A generic instruction like "check for security issues" leaves too much room for interpretation. A better check names the type of issue, explains what conditions make it a real finding, and includes examples of false positives. The point isn't to make the model "infallible." It's to narrow the task and make the output easier to evaluate.
Build a layered verification loop
A reliable workflow uses different kinds of evidence rather than leaning on a single agent review. One workable sequence looks like this:
- Clarify the task: state desired behavior, constraints, and acceptance criteria.
- Generate the change: ask the agent to work within the relevant scope and explain its decisions.
- Run deterministic checks: use tests, static analysis, formatting rules, and security checks where appropriate.
- Review the change: inspect the diff for scope, architecture, and behavior, with human attention scaled to risk.
- Observe after release: use monitoring and user or operational feedback to catch issues pre-release checks missed.
Each layer catches different failure modes. Tests can confirm specified behavior, but they can't prove the specification is complete. Human review can catch mismatches with business intent, but it may miss a reproducible edge case that tests would expose. In practice, combining checks beats assuming any single layer settles the question.
Don't add agents just to increase confidence
Running multiple agents can make sense when they have distinct jobs - for example, one agent generates code and another checks a defined security property. But asking multiple general-purpose agents the same broad question isn't a substitute for a good verification plan. It can increase cost and review time while producing conflicting outputs that still require someone to decide what's real.
Add agents when you can explain what new evidence each one contributes. If the "extra value" is just more opinions, refine the task definition or the checks first.
When can a software factory run autonomously?
Autonomy should be assigned based on consequences, not on excitement about automation. A workflow that's fine for an internal formatting task might be wrong for code that touches customer data, controls access, or affects a regulated process. The real question isn't whether an agent can complete the task. It's what happens if the result is wrong, and how quickly you can detect and contain that failure.
Use a risk-based factory model
Shaukat described three broad operating modes: dark, dim, and light factories. They're useful for talking about oversight - not as rigid industry standards.
- Dark factory: work proceeds with little or no routine human review. This can work for low-impact, reversible tasks where automated checks provide strong evidence and failures are easy to detect.
- Dim factory: some work is automated, with oversight focused on higher-risk changes or exceptions. This is a plausible default for many large organizations because risk varies across systems and tasks.
- Light factory: people review work closely, or human review is required by company rules or applicable regulation. This fits when consequences are high or when the process demands explicit accountability.
The label alone doesn't make a workflow safe. A dark factory still needs clear boundaries, monitoring, and a way to stop or undo a bad change. A light factory can still fail if reviewers are overloaded or don't have the context to judge what they're seeing.
Score tasks by impact and reversibility
Before automating, assess at least four factors: the potential harm of an error, the strength of available checks, how easy it is to roll back, and whether policy or regulation requires human review. A low-impact change with reliable tests and a straightforward rollback is a better automation candidate than a change that could expose sensitive data or disrupt a critical service.
| Task profile | Typical approach | Why |
|---|---|---|
| Repetitive, low-impact, easy to reverse | High automation, sampled review | A failure is contained and can be detected quickly |
| Moderate impact, good automated coverage | Agent work with risk-based human review | Tests help, but system context still matters |
| High impact, weak checks or difficult rollback | Close human review and staged release | A mistake may be costly or hard to contain |
| Review required by policy or regulation | Documented human approval | The process needs an accountable reviewer |
This is a starting point, not a compliance verdict. A US financial services team, a UK health provider, and a small product company may have different obligations and different real-world failure costs. Teams should map their own policies and applicable regulations, rather than assuming a generic "automation category" is enough.
Earn autonomy with operational evidence
Increase automation only after you've seen it perform reliably on the work it will actually receive. Track issues caught after release, escaped defects, false alarms, review effort, and rollback frequency. A model that looks great on toy examples may struggle on your repository, your developers' instructions, or your production constraints.
Keep a clear way to intervene. That means knowing who owns the workflow, how to stop it, how to revert a change, and how incidents feed back into prompts, tests, and review rules. Autonomy without observability isn't "efficiency." It's just less visibility into how work makes it to production.
What changes for human software engineers?
AI shifts effort away from typing every line and toward deciding what should be built, providing the context needed to build it, and establishing evidence that the result is acceptable. The work changes shape - it doesn't vanish. Someone still needs to understand the product, the system, and the consequences of a bad decision.
Engineers define intent and quality
A short prompt like "build a reporting page" leaves too many decisions open: which data is authoritative, who can access it, how errors should appear, and how the page fits the existing application. Engineers and product teams have to translate broad intent into concrete behavior, constraints, and a definition of done.
That takes judgment across product and technical boundaries. A change can satisfy the immediate request and still make the product harder to maintain, create a confusing user experience, or send information to the wrong audience. Agents can help explore options and draft implementation details, but people still have to decide which trade-offs are acceptable.
Context becomes part of the engineering system
In traditional development, teams often rely on experienced engineers to carry architectural and historical context. In an agent-assisted workflow, that context has to be usable right where the work happens. It can live in repository instructions, tests, examples, architecture notes, or automated policy checks.
This isn't a one-time "write the prompt" task. Codebases change, conventions drift, and product requirements evolve. Teams need to keep the instructions and checks current - just like they maintain build pipelines and developer documentation. If the guidance goes stale, automation can repeat the wrong assumption faster and more consistently than a person ever would.
Review becomes more selective, not optional
Engineers may write less of the implementation while spending more time framing tasks, inspecting diffs, reviewing evidence, and handling exceptions. That can improve throughput when the work is well-scoped and repeatable. It can also turn into a bottleneck if every generated change lands in front of a small review group with no risk-based prioritization.
A practical operating loop looks like this:
- Let agents handle tasks that are bounded and testable.
- Use human attention for intent, architecture, risk, and exceptions.
- Feed production outcomes back into tests and workflow guidance.
- Measure whether the system reduces total delivery effort without increasing escaped defects.
That last point matters. Faster code generation isn't the same as faster, safer delivery. If the "saved time" just gets spent reconciling inconsistent outputs or fixing production problems, the gain hasn't really disappeared - it's moved somewhere else.
Key takeaways
- Treat code generation and code verification as separate capabilities.
- Give agents explicit context, constraints, and a checkable definition of done.
- Use multiple verification layers, but only when each layer adds useful evidence.
- Match human oversight to impact, reversibility, confidence, and applicable rules.
- Expand autonomy based on operational results, not impressive demonstrations.
Conclusion
AI coding agents can reduce the time and effort needed to produce code, but they don't remove the need to decide what the system should do - or to prove that a change is safe. The hard part is building a workflow where requirements, repository context, automated checks, and human review reinforce each other.
Start with bounded tasks and explicit acceptance criteria. Measure results in your own codebase, including defects that escape and the review work that still takes time. Then expand automation when the evidence supports it - and keep people close to decisions when the cost of being wrong is high.
