← all posts
// devops · devops

AI in CI/CD and DevOps: agents in the pipeline, without the 3am page

AI has moved from the editor into the pipeline. It reviews PRs, writes CI configs and Terraform, triages failures, even proposes remediations. Some of that is a genuine force multiplier. Some of it is a fast path to an outage. The line between them comes down to one question: what is the AI allowed to act on?

Where it genuinely helps

  • Boilerplate config. CI YAML, Dockerfiles, Terraform scaffolding, Helm charts: tedious, pattern-heavy, and low-stakes to draft. A strong first pass you still review.
  • Failing-build triage. Read the build log, identify the cause, propose the fix, then use a background agent to open a PR. This is high-value toil removal.
  • Incident assist. Summarize logs and alerts, correlate signals into a hypothesis. Note the word: assist. (Pairs with observability.)
  • Infra-as-code review. Flag misconfigurations and security smells in Terraform and k8s before they ship. It's AI code review pointed at infra, with the security lens turned on.

Where it's dangerous

Anything that acts on production. Auto-remediation that restarts services, applies infra changes, or deploys puts your whole system in the blast radius, and an agent acting on a bad sample or an injected log line acts with your infrastructure's privileges.

AI in the pipeline is a force multiplier for the toil and a liability for the irreversible. Put it on config, triage, and review; keep a human on the apply.

The guardrails that matter

  • Read and suggest in prod, never auto-apply. AI proposes; a human or a tested pipeline approves. The approval-gate-on-irreversible rule, applied to infrastructure.
  • Route everything through the normal pipeline. AI-generated changes go through the same review, plan, test, and approval as human ones: a PR, not a direct apply. Your existing pipeline is the guardrail. Don't let the agent bypass it.
  • terraform plan / dry-run is the oracle. Verify the change before applying it. It's the tests-as-ground-truth idea, applied to infrastructure. An agent that can see the plan can check its own work.
  • Least privilege, always. The agent's credentials should be scoped to exactly its task. An agent with prod-admin is an incident waiting for a bad input; an agent that can only open PRs can only ever cost you a review.

The autonomy spectrum

Think of it as a dial, and know where the value and the danger each live:

  • Assist (summarize, suggest, draft, review): safe, high-value, where most of the win is. Start and stay here for anything touching prod.
  • Act (auto-remediate, auto-deploy) needs heavy guardrails, a real oracle, and trust earned slowly on low-stakes paths first. The demos love this. Production should go slow.

The honest version: keep AI on the toil (the config, the triage, the review, the first-draft IaC) and keep humans on the apply. Run everything through the pipeline you already trust, scope the agent's blast radius before you scope its capabilities, and let it earn autonomy on the reversible stuff long before you let it near apply. Done that way, it's the most welcome teammate in your pipeline. Done the demo way, it's the post-mortem.

#devops#ci-cd#agents