123DevOps··7 min read

AI agents: what they are, how they work, and where they already help in DevOps

The difference between a chatbot and an agent, the building blocks of an agent, DevOps tasks where they already help (and where they call for caution), safe design principles, a pseudocode agent loop, and a maturity roadmap.

AI

You ask a chatbot why the pipeline failed, it asks for the log, you paste the log, it suggests a fix, you apply it, run it again, paste the new error… An AI agent does that back-and-forth on its own: it fetches the log, reads the code, tests a hypothesis, and only comes back to you with a conclusion — or with a request for approval.

That autonomy is exactly what makes agents useful in DevOps and, at the same time, what calls for caution. In this article, we’ll look at how they work, where they already deliver value today, and how to design them so they don’t become an operational risk.

Chatbot vs. agent

A chatbot answers one message at a time: text in, text out, and you are the one who acts in the world. An agent receives a goal and works in a loop until it achieves it:

  1. Goal: “find out why the integration-tests job failed on the last PR”;
  2. Plan: decide the next step (read the log? look at the diff?);
  3. Act with tools: call an API, run a command, query a data source;
  4. Observe: read the result of the action;
  5. Repeat until it has an answer, hits a limit, or needs a human.
        ┌──────────────────────────────┐
        │   Goal (set by a human       │
        │   or by an event)            │
        └──────────────┬───────────────┘
                       ▼
   ┌──────────▶  Plan (the LLM decides
   │             the next step)
   │                   │
   │                   ▼
   │             Act (call a tool) ──────▶ [human approval
   │                   │                    if there are side effects]
   │                   ▼
   └───────────  Observe (the result
                 comes back as context)
                       │
                       ▼
          Final answer / limit reached / escalate

The “brain” is an LLM (Large Language Model, such as those in the Claude, GPT, Gemini, Llama, or Mistral families). What turns a model into an agent is the loop around it and the tools it can use.

The building blocks

  • Model: interprets the goal, chooses tools, and writes the answer. Different models have different cost, latency, and quality — evaluate them on your own tasks, not on generic benchmarks.
  • Tools: functions the agent can call — internal APIs, CLIs (kubectl, gh, terraform), searches. MCP standardizes how to expose those tools to any AI application.
  • Memory and context: the history of the current task (what has already been tried) and, sometimes, persistent knowledge such as runbooks and postmortems retrieved through search.
  • Guardrails: technical limits — which tools exist, with which permissions, how many steps, how much cost, which outputs are blocked.
  • Human in the loop: points where the agent stops and asks for approval, or delivers a draft instead of executing.

Where agents already help in DevOps

The best tasks to start with involve a lot of reading, little writing, and a human reviewing the result:

Task What the agent does Risk level
Explaining failed CI jobs Reads logs and the diff, points to the likely cause, and suggests a fix Low (read-only)
Dependency update PRs Bumps versions, reads changelogs, runs tests, and opens a PR Low to medium (goes through CI and review)
Alert triage and incident summaries Groups related alerts, builds the timeline, summarizes for the channel Low (reading and text)
Runbooks and documentation Drafts runbooks from incidents and commands already used Low (a human reviews)
Questions over internal docs Searches wikis and repositories and answers with citations (RAG) Low to medium (convincing wrong answers)
Explaining cost anomalies Compares billing periods and points to the responsible resources and tags Low (read-only)
IaC review Reads the terraform plan and highlights dangerous changes Medium (it may miss something)

Many of these tasks are what SRE calls toil: manual, repetitive work with no lasting value. Agents are one more tool for toil automation — and they complement AIOps practices in detection and correlation.

Where to be careful

  • Autonomous production changes: scaling, restarting, applying manifests, or changing configuration without a human in between.
  • Deleting resources: volumes, databases, buckets, branches. A misinterpretation turns into data loss.
  • Security changes: firewall rules, IAM policies, secret rotation, disabling controls.

The reason is simple: the model can be wrong with complete confidence, and the content it reads (a log, an issue opened by an outsider) may contain malicious instructions — so-called prompt injection. The risks are covered in detail in the AI application security guide.

Design principles

  • Least privilege: each agent gets its own identity and credentials limited to what the task requires.
  • Read-only first: start with agents that observe and suggest; grant write access gradually.
  • Dry-run before apply: terraform plan, kubectl diff, --dry-run=server — the agent shows what it would do before doing it.
  • Approval for side effects: any action that changes state goes through a human (or through a pipeline with review).
  • Audit logs: record every decision, tool call, argument, and result.
  • Timeouts and budgets: limits on steps, time, and cost per run. Infinite loops get expensive.
  • Evaluations (evals): a set of real cases with expected answers, run on every prompt, model, or tool change — see LLMOps: evaluation and observability.

A pseudocode agent loop

The code below is illustrative (it’s not a real library), but it shows the essential elements: a tool registry, a step limit, approval for actions with side effects, and auditing.

# Illustrative pseudocode: these names are not from a real library
TOOLS = {
    "read_ci_log":    Tool(function=read_ci_log,    side_effect=False),
    "search_runbook": Tool(function=search_runbook, side_effect=False),
    "open_pr":        Tool(function=open_pr,        side_effect=True),
}
MAX_STEPS = 10


def run_agent(goal: str) -> str:
    history = [system_instructions(TOOLS), user_message(goal)]

    for step in range(MAX_STEPS):
        decision = model.next_step(history)  # LLM call

        if decision.type == "final_answer":
            return decision.text

        tool = TOOLS.get(decision.tool)
        if tool is None:
            history.append(observation("error: unknown tool"))
            continue

        if tool.side_effect and not request_human_approval(decision):
            history.append(observation("action rejected by the reviewer"))
            continue

        result = tool.function(**decision.arguments)
        audit.record(step, decision, result)
        history.append(observation(result))

    return "Step limit reached: escalating to a human."

Notice that it’s the code, not the model, that decides which tools exist, which ones need approval, and when to stop. Guardrails in the prompt (“don’t delete anything”) help, but they don’t replace limits enforced outside the model.

Maturity roadmap

Level 1: assistive

The agent reads, explains, and suggests. Every action is carried out by a person. Great for measuring answer quality and building trust.

Level 2: semi-autonomous with approval

The agent prepares the action (a PR, a plan, a command) and executes it after explicit approval. Most teams should spend a good while here.

Level 3: autonomous for low-risk tasks

For reversible, well-scoped tasks with consistent evaluations (such as rerunning a flaky job or labeling issues), the agent acts on its own, within limits and with auditing. Critical production stays human-in-the-loop.

Checklist

  • First task is read-heavy, write-light, and human-reviewed
  • The agent has its own identity with least-privilege credentials
  • Tools with side effects require approval or a dry-run
  • Limits on steps, time, and cost per run
  • Every decision and tool call is audited
  • An evaluation suite runs on every prompt or model change
  • Clear criteria for moving up a level of autonomy

A good AI agent isn’t the one that does everything on its own; it’s the one that knows exactly how far it can go.

Get updates on new posts and stay in the loop!