A Runbook Is Not a Prompt: Designing Safer AI Agents for Infrastructure Operations

A Runbook Is Not a Prompt: Designing Safer AI Agents for Infrastructure Operations

At 02:14 on 27 December, an infrastructure agent detects a failed health check and recommends promoting a standby database. The primary engineer is asleep. The secondary is covering two services. The agent has read the alerts, compared recent runs, and produced a plausible diagnosis. It also has access to an infrastructure tool. What is it allowed to do next? That question is harder than whether the model can write a command. A sensible diagnosis can still produce the wrong operation, target the wrong environment, reuse an old approval, or declare success while the provider is still converging. Reduced staffing makes automation valuable. It also removes the informal checks that usually catch an ambiguous target or stale plan. The answer is not to give the agent more freedom because fewer people are awake. The answer is to make its operating boundary executable. A Runbook Is Not a Prompt An on-call runbook normally describes conditions, commands, verification, and escalation. Give the same document to a language model, and it becomes context, not enforcement. The model can interpret the runbook. It cannot be the component that decides whether its own interpretation is authorised. That distinction matters because agent risk has more than one dimension. OWASP's excessive-agency guidance separates excessive functionality, permission, and autonomy. A narrowly worded prompt does not compensate for a credential that can alter an entire account. A confirmation message does not make an arbitrary shell tool safe. The ownership split should be explicit: The agent observes, explains, and proposes. The runtime admits or rejects a named operation. The provider-facing worker executes only the admitted request. A verifier determines what happened. The runtime boundary should survive a model change, a prompt change, and a confident but wrong diagnosis. The NIST AI Risk Management Framework also calls for defined human roles and oversight in human-AI configurations. For an on-call path, that means more than placing a person somewhere in the loop. The system must say which decision belongs to that person and which component enforces it. Approval Must Name the Thing Being Approved Human approval sounds like the obvious answer. It is incomplete unless the approval is attached to an immutable description of the operation. Suppose an engineer reviews a failover request for prod-eu, but the target or execution plane changes before dispatch. The approval still exists. The approved operation does not. HackerNoon's article on loopjacking in human approval workflows describes the underlying weakness: a person can approve one represented state while the system later acts on another. In infrastructure, the remedy is to bind approval to the exact dispatch artifact rather than a friendly request name or conversation ID. A reduced request could carry this identity: { "dispatch_id": "dispatch-20261227T021400Z-failover-a19c", "action": "promote-standby", "environment": "prod-eu", "target": "postgresql-ha", "execution_plane": "shared-control", "approval_payload_version": 1, "approval_artifact_sha256": "", "requires_approval": true } The digest covers the fields that matter to the decision. Generated fields, such as the request timestamp, stay outside the canonical payload. The approval record copies the dispatch ID, payload version, and digest, then adds the approver and approval time. Immediately before promotion, the consumer recomputes the digest from the current request. A changed target, environment, action, rationale, check set, or approval posture invalidates the earlier approval. This does not prove who wrote the record, and it does not turn a trusted filesystem into a signed ledger. It solves a narrower problem: approval cannot quietly follow a request after approval-relevant content changes. Give the Agent Named Operations An unrestricted run_shell(command) tool transfers too much interpretation into the agent. A bounded interface exposes actions with known inputs and known consequences: class OnCallOperations: def inspect_service(self, service: str, environment: str): ... def propose_failover(self, service: str, environment: str): ... def preflight_failover(self, request_id: str): ... def execute_approved(self, execution_id: str): ... def verify_outcome(self, run_id: str): ... The difference is not cosmetic. A named operation can have its own schema, policy, approval rule, timeout, rate limit, and verification contract. An arbitrary command asks downstream systems to trust whatever string the model constructed. Not every action needs the same gate. Read-only inspection can run without a person waiting by a phone. Planning and dry-run validation can also be automatic when their outputs are retained. Destructive operations, data promotion, failover, and security-boundary changes deserve exact approval and fresh state checks. Action class Default treatment Observe current state Allow, record, rate limit Produce plan or diagnosis Allow, retain inputs and output Run preflight or dry run Allow, retain decision record Execute a bounded reversible change Policy-controlled approval Destroy, fail over, promote data, change access Exact human approval Act on stale or unverifiable evidence Stop and escalate The policy belongs to the runtime, not the model's system message. Figure 1. The approval-binding suite rejects changed requests, invalid identity, version mismatch, and digest tampering. Write State Before Mutation Preflight answers whether an operation is admissible before it begins. It cannot prove that the provider call will complete cleanly. Before dispatching a mutating call, the runtime should persist a non-terminal state that identifies the command and prior resource context: { "status": "running", "active_command": "apply", "module_ref": "platform/onprem/postgresql-ha", "state_instance": "primary", "started_at": "2026-12-27T02:18:11Z", "previous_status": "ok", "previous_outputs": { "resource_id": "" } } If that state cannot be written, the provider mutation should not start. A full disk or inaccessible runtime directory is not a reason to continue without a recovery record. If the process dies after the provider accepts the request, the retained running marker tells the next engineer that the world may have changed. It is more honest than leaving the previous ok state in place. Verify the World, Not the Process An exit code describes a process. On-call engineers care about resources. A provider can accept a request and continue converging. A retry can encounter an object created by the first attempt. Another controller can change the same authority while the operation is running. The command can time out after the desired resource exists. Completion therefore needs a second observation. For a governed authority, a runtime can compare what it observed before and after dispatch and return one of three states: stable: the authority remained consistent with the operation's policy; drifted: relevant authority state changed unexpectedly; or unverifiable: the provider cannot establish the required interval. The result must also say whether the completion read is fresh. A stale read is not a successful verification. If policy requires strong evidence and the provider cannot produce it, the operation stops before dispatch or remains unverified after it. Bypasses need the same discipline. Emergency operation may justify skipping a preflight gate, but the bypass should require a short, printable reason and leave a decision record before mutation. A hidden flag gives the next shift nothing to review. What the Agent Can Do at 02:14 Return to the holiday alert. The agent can collect read-only state, correlate health signals, and prepare a failover request. It can run the named preflight and show the engineer the target, checks, expected effect, and canonical digest. It can explain why the request is blocked. It cannot change the target after approval. It cannot turn an unverifiable authority into a green result. It cannot treat its own diagnosis as approval. It cannot claim that a successful command means the service recovered. HybridOps Core currently implements this boundary as a record chain. A decision becomes an approval-gated dispatch request. A matching approval can promote it to an execution record. The executor then emits a dry-run attempt, not a live workflow. That limit is deliberate: approval binding and durable handoff can be tested before a production executor is trusted. ADR-0214 records the approval-binding contract and its current limits. The implementation includes regression tests for request mutation, preflight decisions, mutation state, and authority observations. The Holiday Test A useful test for any infrastructure agent is to imagine the smallest on-call rota of the year and ask seven questions: Which exact actions can the agent request? Which identity does each request carry? What current state must preflight establish? Is approval bound to the exact payload? What is persisted before mutation begins? Which resource observation proves the outcome? What forces the agent to stop? If the answers live only in a prompt, the system has a helpful assistant but a weak operating boundary. The infrastructure agent worth putting on call is not the one trusted to do anything while the team is away. It is the one that can do a small number of named things, prove what authorised each one, and stop when the world no longer matches the request.

Original Source

Read the full article at Hackernoon →

KhanList aggregates and links to publicly available news content. We do not host full articles from third-party sources. Always verify important information with original sources.