Autonomous Code Review in Healthcare: How AI Agents Ship PRs Without Breaking Production
I run AI agents that write code for a healthcare data platform. They pick up tasks from the backlog, write the code, add tests, open a pull request, respond to automated code review findings, and push fixes until the PR is clean. Then they stop and wait for me to merge.
That last sentence is the important one. The agents never merge their own work. No autonomous merge to the main branch. Ever.
If you work in healthcare technology, you know why that matters. We operate under HIPAA, our data pipelines feed clinical dashboards, and a bad deploy can break the metrics that providers rely on during morning huddles. So the idea of an AI agent pushing code straight to production sounds insane. But the idea of an AI agent doing the repetitive 80% of development work and then handing off to a human for the final call? That is practical. And it is what I actually do.
The Architecture
I have an autonomous agent running on Hermes Agent. It works off a task queue. When it picks up a task, it follows the same workflow a human developer would:
- Pull latest from the default branch
- Create an
agent/*branch - Write the code, keep the diff small and single-purpose
- Add or update tests
- Validate in a non-prod environment only
- Open the PR with a description that links the Jira issue, explains the change, and calls out the risk
Every one of those steps matters. The branch naming convention (agent/*) is how I filter agent PRs from human PRs in the pipeline. The small-diff rule keeps reviews fast. The non-prod validation rule is non-negotiable because we are in a regulated environment.
The Quality Gate
This is where it gets interesting. I use CircleCI for continuous integration, and I added CodeAnt as an AI-assisted quality gate. CodeAnt reviews every PR automatically, whether it came from a human or an agent.
The agent's job is to resolve every Critical and High finding from CodeAnt before it reports back to me. If CodeAnt flags a Medium or Low that is reasonable and does not expand scope, the agent fixes that too. The agent pushes fixes iteratively until the PR is clean.
This creates a tight loop: the agent writes code, CodeAnt reviews it, the agent fixes what CodeAnt found, CodeAnt reviews again. Most of the time, by the time I look at the PR, the obvious problems are gone. I am reviewing the architecture decision, not catching missing null checks.
I also run a contract ledger that validates specific changes. If someone removes a dbt model, renames a column, or changes a data contract, the ledger catches it and the CI gate fails. This matters because in healthcare data engineering, a renamed column can silently break a downstream clinical dashboard that nobody notices for three weeks. The contract ledger prevents that class of problem for both human and agent PRs.
Why Human-in-the-Loop Is Not a Limitation
People hear "human must approve merges" and think the system is not really autonomous. That is the wrong framing. The autonomy is in the execution. The human checkpoint is in the judgment.
Think about what a human developer actually does in a healthcare shop. They spend time understanding the compliance context, checking whether a change touches PHI, making sure the data contracts are intact, and deciding whether the approach is right. The coding itself, the test writing, the linting, the back-and-forth on review comments, that is the time-consuming mechanical work. That is what the agent owns.
The human owns the decision. The agent owns the delivery.
This split also means I can give the agent work that would otherwise sit in the backlog for weeks because nobody has bandwidth. Test coverage improvements. Schema documentation. Incremental refactors. Bug fixes that are important but never urgent enough to prioritize. The agent clears that queue, and I review the output in minutes instead of spending hours writing the code myself.
The Hard Gates
I defined hard rules for the agent that are non-negotiable. These are not soft preferences. They are the boundary of its autonomy:
- Never modify production databases or schemas. Read-only against prod.
- Never expose PHI in code, tests, logs, commit messages, or PR descriptions.
- Never commit secrets.
- Never rewrite shared history or force-push to protected branches.
- Never grant or widen access permissions on its own.
Everything else, the agent owns. The gates are the boundary, not a checklist that pauses every action. The agent makes reasonable decisions within those boundaries and only escalates when something hits a gate or genuinely needs my input.
What This Actually Looks Like in Practice
On a typical day, I come in and there are one or two PRs waiting from the agent. I read the PR description, check that the tests pass, scan the diff for anything that touches PHI or data contracts, and either merge or leave a comment. The whole review takes five to fifteen minutes per PR.
If CodeAnt still has unresolved findings, the PR is not ready and I do not look at it. The agent knows to resolve those first. If the change is too big or the approach is wrong, I close the PR and explain why. The agent picks up the next task.
The result is that the engineering team ships more work without growing headcount. The agent handles the mechanical delivery. I handle the judgment calls. And nothing reaches production without a human making a deliberate decision to put it there.
That is the model. Not autonomous merges. Autonomous delivery with human gates. In healthcare, that distinction is the whole game.
Originally published on dev.to.