October 28, 2026

Coding agents that open their own pull requests are the trend every engineering team is trying. This guide sets out what it takes to trust them.
To validate agentic code changes, treat every agent-written pull request as untrusted until a gate proves otherwise. That gate has five parts: a scope check on what the agent touched, diff-scoped tests, runtime and behavioural checks, an evaluation suite for the agent's task type, and a human review point that depends on how much autonomy you have given the agent. This post explains each part and how to wire it into CI so it runs on every agent change before merge.
For testing AI agents themselves, as products, see our hub post on testing agentic AI systems: workflows and tool calls. This post is about the code those agents write.
Code from an AI coding agent fails in different ways from code written by a person. A normal review process assumes the author understood the change; with an agent, that assumption does not hold.
None of this means agents are a bad idea. It means the checks that a careful reviewer runs in their head need to become automated checks that run every time.
Running the full test suite on every agent pull request is slow and, at agent volume, expensive. Diff-scoped selection runs the tests that cover what changed, plus a fixed safety net.
Flaky tests undermine all of this, because a gate that fails at random gets ignored. Our post on why Playwright and Selenium tests fail covers state leakage and selector drift, the two most common causes.
Unit tests show that functions return what the agent expected. Runtime checks show that the system still behaves the way your users expect. For agent-written changes, run at least these in a preview or staging environment:
Behavioural checks matter most where your tests are thin. If an agent changes code that no test covers, the runtime checks are the only thing standing between that change and your users.
An evaluation suite, or eval suite, is a fixed set of tasks with known good outcomes that you run against your agent setup. Tests check one change; evals check whether the agent, its prompts and its tools are still reliable across many changes.
| Eval type | What it measures | Example |
|---|---|---|
| Task replay | Can the agent still solve tasks it solved before | Re-run 20 past bug-fix tickets and check the same tests pass |
| Golden diffs | Does the agent's change match a reviewed reference change closely enough | Compare touched files and key lines with a human-approved fix |
| Negative tasks | Does the agent refuse or escalate when it should | Ask for a change to auth code without permission and expect a stop |
| Test integrity | Does the agent avoid weakening tests | Seed a failing test and check the agent fixes code, not the assertion |
Run the eval suite whenever you change the model, the prompts, the tools the agent can call or the repository rules it follows. Track the pass rate over time against a baseline; a drop is a reason to reduce the agent's autonomy until you know why.
Our guide to AI in software testing covers where AI helps in test design and where human judgement is still required.
Not every agent change needs the same review. Match the review to the autonomy you have given the agent and the risk of the files it touched.
| Autonomy level | What the agent may do | Human review point |
|---|---|---|
| Suggest | Proposes changes in the editor; a developer accepts them | Normal code review of the developer's pull request |
| Draft | Opens pull requests for low-risk tasks such as tests, docs and small fixes | One reviewer reads the diff and the gate report before merge |
| Merge on green | Merges its own changes in agreed low-risk areas when the gate passes | Sampled review after merge, plus a fast rollback path |
| Restricted areas | Changes to auth, payments, data migrations, infrastructure or CI config | Always two human reviewers, whatever the autonomy level |
Write the restricted areas down as path rules in the repository, so the gate can enforce them. Review the rules whenever an agent-written change causes an incident.
Label agent-authored pull requests automatically, then run a dedicated job for them. A simplified example:
# Merge gate for pull requests opened or edited by a coding agent
on: pull_request
jobs:
agent-gate:
if: contains(github.event.pull_request.labels.*.name, 'agent-authored')
steps:
- run: ./scripts/check-diff-scope.sh # files touched vs task scope
- run: ./scripts/select-tests.sh > selected.txt
- run: npm test -- $(cat selected.txt) # diff-scoped tests
- run: npm run test:contract # API and schema contracts
- run: npm run test:e2e:smoke # critical user flows
- run: npm run eval:agent-tasks # eval suite, compared to baseline
- run: ./scripts/require-review.sh # route by autonomy levelEach script maps to a section above. Fail fast on scope, run diff-scoped tests next, and leave the slower end-to-end and eval steps for last. Publish a short gate report as a pull request comment, so the reviewer starts from evidence instead of a raw diff.
The same thresholds you use for release gates apply here; our post on release gates in CI/CD explains how to set quality thresholds that block bad deployments.
For the end-to-end layer, TestInspector.ai gives agents a way in: MCP tokens let Claude Code, Cursor and Claude Desktop work with your test suite, and a CI/CD trigger API runs the suite from your pipeline. Tests can be exported to Playwright TypeScript if you want them in your own repository. If you would rather have a team build the gate, see Astaqc's test automation services.
Treat every agent-written pull request as untrusted until a gate passes. Check the scope of the diff, run diff-scoped tests and a fixed smoke suite, run contract, end-to-end and visual checks in a preview environment, run an eval suite for the agent's task type, and route the change to a human reviewer based on autonomy level and risk.
Agentic AI validation is the practice of checking the output and behaviour of AI agents that act on their own, such as coding agents that open pull requests. It covers the code they produce, the actions they take and whether they stay within the scope and permissions you set.
Agents can draft test cases from requirements, user stories or a diff, and can narrow down a defect by reading failing tests, logs and recent changes. Their output still needs checking: generated tests must be reviewed for weak assertions, and a suggested root cause should be confirmed by reproducing the failure.
Only in low-risk areas you have agreed in advance, when the full gate passes, with sampled review after merge and a fast rollback. Authentication, payments, data migrations, infrastructure and CI configuration should always have human review.
If your team is letting coding agents open pull requests, we can help you design the merge gate, the eval suite and the review rules, and wire them into your CI.
Astaqc's head office is in Mumbai, India. Email contact@astaqc.com or call or WhatsApp +91 98921 33545, 9am to 6pm IST, or use the contact form.
If you want automated regression coverage without building a framework, see TestInspector.ai. TestInspector.ai starts at USD 349.
Treat every agent-written pull request as untrusted until a gate proves otherwise.

Sign up to receive and connect to our newsletter