Infrastructure Teams Already Know How to Manage YAML in Git Applying That Muscle to AI Agents
Defining AI agents in YAML under pull-request review extends GitOps controls.

Agents-as-code means defining each AI agent in a YAML configuration file, storing it in Git, and reviewing changes through pull requests with the approval gates used for infrastructure. The file describes the agent’s purpose, capabilities, tool permissions, and budget limits. Infrastructure teams can therefore govern AI coding agents in production by extending their existing GitOps discipline, with no need for a separate operating model.
How infrastructure teams already govern complex automation through YAML in Git
Configuration lives as text in a repository, where a diff exposes proposed changes and a commit records their history. Human approval separates a proposed configuration from an authorized one. Reverting a commit provides a rollback mechanism for configuration. The repository becomes the single source of truth for what the system is supposed to do, rather than leaving that intent scattered across scripts and individual recollections.
Infrastructure teams already apply this discipline to Kubernetes cluster state, Terraform infrastructure, CI/CD pipeline definitions, secrets rotation schedules, and access policies. The files have different formats, but teams govern them in the same way. These are high-stakes systems whose behavior must remain attributable as their configuration changes. Review is part of how teams control the automation itself.
That discipline developed because ad hoc automation at scale produces outages, drift, and changes that cannot be traced to an authorization. Versioning preserves the intended state, while review gives someone responsibility for accepting a change to it. Audit trails then make that decision inspectable. Unmanaged agent deployments expose the same classes of failure. There is no sound reason to exempt a new executor from controls established for the work it now performs.
What AI coding agents actually do in production, and why they look like automation that needs the same treatment
First-pass implementation, scaffolding, testing, documentation, CI triage, code review, and feature migrations are already delegated to AI coding agents in 2026. The agent is no longer only suggesting text to an engineer. It is executing work that can produce a change for acceptance. That places its instructions, permissions, and output within the same governance boundary as other engineering automation.
The delegation model keeps consequential decisions with people. Agents handle first-pass execution, while engineers assess correctness, risk, and alignment. Architecture and trade-offs remain human-owned. That division works only when someone reviews the work, and a pull request alone gives no assurance that they have. Who Finishes the Job? A Study of Follow-Up Fixes and Commit Authorship on AI Coding Agent Pull Requests (2026) reports that 61.4% of AI coding agent pull requests do not receive recorded human review before merging.
That finding does not establish that every unreviewed change is defective. The study examines the unresolved operational question of what remains after an agent pull request merges and who performs the follow-up fixes. For an infrastructure team, the concern resembles unreviewed Terraform drift, where accepted state and understood state can diverge. A successful merge is not, by itself, evidence that someone assessed the change’s consequences.
Persistent context makes this work governable beyond a single run. Agent context files such as CLAUDE.md and subagent files in .claude/agents/ encode constraints and expected behavior for the executor. Once an agent uses them to guide implementation, changing them becomes a change to the automation. The review boundary therefore has to include both the resulting code and the instructions that produced it.
How do teams manage YAML agent definitions through pull requests and code review?
Agent configuration files do the same job that Terraform modules do in infrastructure. They encode policy, define scope, and describe what the system is allowed to do. They can shape more than one proposed patch. A change to project constraints, coding conventions, or architectural instructions can affect the work performed under that configuration. Treating these files as static documentation understates their operational role.
The artifacts are not all the same format. CLAUDE.md and AGENTS.md provide agent-facing context, while subagent YAML definitions provide structured configuration and .claude/agents/ holds subagent files. Their shared feature is that they govern behavior. Research on these artifacts documents “configuration smells” in AGENTS.md files, giving teams a concrete counterpart to infrastructure-as-code smell detection. The quality of the instructions belongs within engineering review, just as the quality of a Terraform module does.
A concrete implementation makes the mapping literal. The CircleCI pattern defines an agent in aws-terraform-agent.yaml, describing its purpose, capabilities, and constraints, then applies it to a cluster with kubectl apply -f aws-terraform-agent.yaml. The agent definition is a deployable configuration artifact. Proposed changes to it can go through the repository’s review process before they are applied. This is GitOps applied to an agent, rather than an analogy based only on similar terminology.
Engineering Reliable Coding Agents: Evaluating and Operating the System Around the Model describes reliability as a property of the system surrounding the model, including its harness, permissions, execution state, and resource allocation. Many apparent model failures originate in those surrounding layers. Configuration review gives engineers a place to inspect those choices before execution. Without it, undocumented scope, unintended permissions, and missing authorization history reproduce familiar infrastructure failures.
Define a YAML file per agent in the repository and submit changes through pull requests. Review covers the agent’s purpose, capabilities, constraints, tool permissions, and resource limits, using the approval gates already applied to Terraform plan. Context files that shape those decisions need to go through the same review. The artifact changes, but the review obligation does not. A team that already reviews Terraform modules already has the process needed to review agent definitions.
Scoped permissions and isolated execution in AI agents mirror what container security already requires
Configuration review establishes intent, but runtime controls enforce its boundaries. Running an agent with a shared, long-lived privileged credential and no isolation repeats the error of giving a CI job unrestricted access. The risk comes from the authority available during execution. An instruction to behave cautiously does not replace a permission boundary. The runtime must limit what the agent can change, regardless of the task it is trying to complete.
The reliability monograph documents an agent wiping a Railway database in nine seconds. The relevant infrastructure concept is blast radius, familiar from misconfigured Terraform destroy operations. Declarative permission scoping addresses that exposure before execution begins. Cleanup comes too late to be the main safeguard. The monograph also treats permissions as a dependency in reliability, because weak scoping can undermine downstream conclusions about the model’s capability.
Production sandbox requirements extend that boundary to the execution environment. They include sub-second provisioning, a hardware boundary per untrusted task, programmatic validation, and rollback or blast-radius control. Validation must be available within the session. The agent triggers checks and reads their pass/fail results as it works, keeping validation within its execution loop. Isolation and validation serve different purposes, so neither substitutes for the other.
The corresponding credential model is session-bound and explicit. Credentials are minted fresh, scoped to what the session’s configuration authorizes, and revoked on completion. They are not a shared service account passed between runs. Infrastructure teams already work this way with ephemeral CI runners, short-lived tokens, and least-privilege IAM roles for each pipeline. Applying it to agents extends the existing runtime discipline to another class of executor.
Cost and token spend on AI agents need the same declarative budget controls as cloud resource quotas
Resource allocation is another runtime boundary that belongs in the reviewed definition. Multi-step agent workflows consume resources through orchestration, reasoning tokens, memory retrieval, and retries after tool failures. Their per-completion costs are meaningfully higher than those of single model calls. A dashboard can reveal that consumption after execution. A budget still needs to be set before the work begins.
The control surface is a set of layered limits expressible in YAML. These include token budgets, model-call limits, tool-call limits, retry budgets, and hard dollar caps. Each constrains a different source of consumption. Reviewing them in the same pull request as the agent definition connects the authorized work to its authorized resource use.
The configuration also defines behavior as the remaining budget falls. At one threshold, the agent downgrades to a fallback model. At a lower threshold, it applies context compression, and at a lower threshold still, it gates non-critical tool calls while preserving required reads. These are operating rules. Because they change how the agent proceeds, they require the same review as its other constraints.
Terraform cost estimation gates offer a familiar pre-execution comparison. Kubernetes resource requests and limits provide the stronger runtime frame, because the declared boundary is also enforced while work runs. Teams set limits on tokens and dollars in place of CPU and memory. The resource-quota discipline remains recognizable.
Audit trails and observability for agents require the same architectural separation as write-protected CloudTrail logs
A reviewed definition records what an agent was authorized to do, but an audit trail records what it actually did. Those are separate forms of evidence. If the agent controls the path that produces or stores its audit output, the record cannot provide independent oversight. The architectural error is the same as putting CloudTrail logs in a bucket the agent can write to. The observed system must not control the integrity of its own evidence.
LLM Agents Can Easily Tamper With Their Own Traces (2026) establishes that agents can interfere with their audit output. Audit pipelines must be separate from agent execution paths, with output preserved outside the agent’s reach. The reliability monograph similarly treats observability as a dependency in judging whether a system behaved correctly. A weak record can invalidate the assessment even when other controls appear sound.
The observability requirement is more demanding than a summary log. It includes every tool call, every diff, and every reasoning token attributable to a specific session, trigger, and person. That attribution connects execution to authorization and review. Humans are Missing from AI Coding Agent Research identifies verifiability as a core dimension of practical agent usefulness, because people must be able to assess the output. Agent patches that are longer than they need to be make that check harder, so a record of the run helps beyond what the final diff shows.
EU AI Act Article 12 requires a queryable record of AI-driven decisions for covered high-risk systems, with the Annex III rules applying from December 2, 2027. Applicability depends on the system’s classification. For systems within that scope, incidental logs cannot stand in for a dependable audit architecture. The same separation that supports engineering review also supports a trustworthy record for oversight.
What applying existing GitOps muscle to AI agents actually looks like in a team's workflow
A team applying this model starts with an agent definition in YAML inside its repository. A pull request exposes changes to purpose, capabilities, tool permissions, budget limits, and supporting context for review. Approval precedes execution in an isolated sandbox with session-scoped credentials. Runtime controls enforce the declared resource limits. Output flows to an append-only audit log outside the agent’s reach.
Developing the agent’s work and running it repeatedly are separate parts of that workflow. A Case-Bundle Operating Model for Coding Agents in OpenFOAM-Based CFD shows this distinction through its Build and Replay modes. Build keeps engineers close to agent-assisted development under review. Replay uses a case that has been reviewed and approved across variants, drawing on engineering context and evidence kept between runs. The distinction resembles developing a Terraform module and then applying it, without reopening settled decisions on every run.
The human-centered paper’s four dimensions also map directly to this operating model. Task alignment is expressed in configuration, while steerability comes through pull-request-based change. Verifiability depends on the independent audit record. Adaptability comes from versioned iteration as the team changes the definition. These connections make human oversight part of the normal workflow rather than an exception invoked when an agent behaves unexpectedly.
The transition is additive. Teams keep the same pull-request ritual, approval gate, configuration rollback by reverting a commit, and protected audit trail. What changes is the object under management. The configuration shifts from describing a deployment or infrastructure resource to describing an agent’s purpose, capabilities, permissions, and budget.
Sources
- Who Finishes the Job? A Study of Follow-Up Fixes and Commit Authorship on AI Coding Agent Pull Requests
- Engineering Reliable Coding Agents: Evaluating and Operating the System Around the Model
- A Case-Bundle Operating Model for Coding Agents in OpenFOAM-Based CFD
- Humans are Missing from AI Coding Agent Research


