Skip to content
All writing

Agentic delivery · Part 4 of 5

Guardrails for Agents in CI/CD

Agents propose, pipelines deploy: least privilege, required checks and audit trails for agentic delivery.

AIAgentic deliveryCI/CD

The further an agent's work travels towards production, the more the question changes from "is this code good?" to "what is this agent allowed to do?" CI/CD is where those permissions become real, and it is where the strongest guardrails belong.

This is the fourth of five notes on agentic delivery in the software development lifecycle.

Agents propose, pipelines deploy

The simplest rule is also the most important: agents do not deploy to production directly. They open pull requests, fix failing checks and answer review comments. Production changes go out through the same pipeline as everything else, triggered by a merge or a release that a person approved.

It is tempting to make an exception when an agent has shell access to a server and a fix looks small. Resist it. An ad hoc change made over a remote session leaves no review, no reproducible build and often no record. A pipeline gives all three, and it gives them every time, which is exactly the consistency that automated work needs.

Least privilege, for real

Agents should hold the narrowest credentials that let them do the task in front of them, and preferably none that outlive it.

  • Scope tokens to the repository and the action. An agent fixing a test does not need permission to change branch protection or manage secrets.
  • Keep secrets out of the agent's context. Deployment credentials belong in the CI system's secret store, used by the pipeline, not pasted into a session or a prompt. If a person needs to add a secret, the person adds it.
  • Separate environments. Credentials for development and preview environments should not work against production, and production credentials should only be usable from the production pipeline.

Make the pipeline the reviewer of last resort

Branch protection and required checks turn good intentions into rules that hold even when nobody is watching: tests and builds must pass, review must be complete, and production deploys only from the protected branch.

A few checks are especially worth having when agents do much of the work:

  • a build and test job that runs on every pull request, with no secrets, so that untrusted changes can be checked safely
  • separate deploy jobs that run only on trusted branches, gated by environment protection where the platform supports it
  • a smoke check after each deployment that fails the run if the site or service is not actually responding

Treat what agents read as data

Agents in CI read a lot of text written by other people and other tools: pull request descriptions, review comments, issue bodies, test output, logs. Some of it may be written to look like instructions. An agent should treat all of it as information to weigh, never as a command, and anything that asks it to escalate its own access, change a workflow's permissions or skip a check should go to a person.

The same applies to the pipeline itself. Workflows that run on contributions from outside the repository should not have access to secrets, and steps that comment back on a pull request should only touch comments they own.

Keep the trail

Every change an agent makes should be traceable: a commit with an attribution, a pull request with a description of what changed and why, a review record and a deployment run. When something goes wrong, the question "what changed?" should have a quick and complete answer. A pipeline run, tied to a reviewed commit, answers most of it. A manual step on a server answers none of it.

The final note in this series steps back from tooling to the harder question: where agents should not act alone at all, and how to design human oversight that holds up in practice.

Responsible for a business-critical system?

If it is an inventory or build-out system that has become hard to change, the Inventory Data Health Check turns it into a plan with a switch-off date.