Shipping Agent Definitions Through a CI/CD Pipeline Without Treating Them as a Special Case
Agent definitions fit standard pull request review and CI gates.

Agents-as-code means defining AI agents as YAML configuration files in Git and shipping changes through pull requests, validation, and deployment gates. The checks must account for agent behavior, but the engineering process does not need to be reinvented.
Why agent definitions are already the kind of artifact CI/CD was built for
An agent definition says how the agent should behave outside the runtime. Whether expressed as YAML, a Markdown prompt document, or a scoped credential binding, it is human-readable text that can be versioned and compared. The separation is the same one infrastructure-as-code establishes. A Terraform configuration describes what the cloud should look like without implementing the provisioning binary, while an agent definition describes what the agent should do without implementing the underlying model. Both give reviewers a stable artifact to inspect before execution.
Files such as CLAUDE.md and AGENTS.md already externalize agent behavior into text, making version control a natural home for instructions that might otherwise remain informal. Ghaleb's MSR '26 study examined thousands of agentic pull requests across GitHub repositories and found statistically comparable build success rates for CI/CD-changing and non-CI/CD-changing agentic PRs. That finding is limited to CI/CD configuration changes and their build success rates. It nevertheless weakens the case for placing YAML changes outside normal engineering controls. If the artifact is configuration, the delivery discipline already exists.
How do AI agent definitions live as YAML config files in Git?
The repository becomes the source of truth when the deployed agent follows the definition on the default branch. Under a merge-as-deploy contract, a new file registers an agent, an edit updates it, a deletion removes it, and a rename preserves history and schedules. These are explicit deployment semantics. The pipeline reconciles the running system to the repository, following the same contract GitOps applies to Kubernetes manifests and Terraform configurations. Review therefore covers the artifact that will control production, with no need for someone to turn a separate document into dashboard settings later.
A conceptual YAML definition can make max_tokens, allowed_tools, and credential_scope peer fields in one file. The first expresses a token limit, the second names permitted tools, and the third describes credential scope. These are illustrative field names. Their placement makes the point concrete because behavior, resource limits, and access permissions change together. At runtime, a declarative construction path reads the YAML into a mapping, resolves the agent class, validates the mapping against that class's configuration model, and constructs the object.
Microsoft Agent Framework supports this declarative approach through YAML or JSON agent configurations. Microsoft Foundry's azure.yaml reference describes that file as the source of truth for agent configuration and deployment configuration. For repository-based delivery, however, file support is only part of the contract. The defining criteria are whether the versioned definition is authoritative and whether changes pass through review and validation before deployment.
Why PR review is the right gate for agent behavior changes, not a separate approval process
Changing a versioned definition produces a diff, which is precisely the artifact pull request review is designed to evaluate. A reviewer can inspect behavioral instructions, permitted tools, budget limits, and credential access together instead of reconstructing them across separate systems. A prompt change can be considered in the context of the tools available to execute it. A request for broader access can be considered against the instructions that will use that access.
The minimum workflow preserves a deliberate human decision. An agent or engineer opens the PR, CI validates the proposed definition, a human approves the merge, and deployment follows automatically. Automation supplies evidence before the approval decision and removes manual translation after it. There is no structural benefit in duplicating that decision in a ticketing system or vendor dashboard.
The Ghaleb study found that agentic PRs changing CI/CD configuration merge slightly less often than other agentic PRs despite comparable build success rates. Greater reviewer scrutiny is a plausible explanation. That scrutiny is appropriate for changes affecting execution controls. Agent behavior can be harder to reason about than an infrastructure diff, but moving approval outside Git does not make it clearer. A more explicit definition addresses this difficulty.
What CI gates for agent definitions should validate, since "does it compile" is not enough
For a prompt-based agent definition, CI focuses on schema validation and behavioral testing, with no need for image building. The definition can skip the Docker build step entirely. Structural validation catches malformed YAML, missing required fields, unrecognized tool scopes, and invalid values such as a budget cap set to zero. These checks serve the same pre-deployment purpose as configuration validation elsewhere. They establish that the runtime can interpret the definition, but they cannot establish that its instructions produce acceptable behavior.
Behavioral tests supply that missing evidence. A small golden dataset pairs inputs that reflect real use with expected output shapes or decision boundaries, so CI has a baseline to check for regressions. The analogy is closer to UI snapshot testing than compilation. The test asks whether a change preserves an expected result. Expected shapes and boundaries also make the acceptance criteria inspectable during review, instead of leaving “works correctly” as an undefined judgment.
The five-gate model combines schema validation, security scope checks, behavioral test coverage, performance regression checks for token budgets, and human approval. Baqar et al.'s AI-augmented CI/CD study proposes staged autonomy within policy-as-code guardrails, including OPA and Cedar. Applied here, those guardrails reject definitions that exceed permitted tool scopes or credential classes before deployment. When a configuration fails, the last good version stays in place. The validation error is recorded on the agent, and the introducing PR receives a comment identifying the failure. The stages are the same as in other pipelines, even though the behavioral test suite is built for agents.
How deployment volume changes when agents start generating their own definition changes
Once agents can propose changes to their own definitions, configuration delivery inherits the volume pressures of agentic development. A prompt update, a tool-scope extension, or a higher budget cap can all arrive as agent-authored PRs. Authorship changes how much work the same review contract must process. Pipelines built around one or two deployments per engineer per day were not designed for the cadence agentic workflows can produce.
Qovery's 2026 analysis describes a shift in the bottleneck from development to delivery as AI coding tools accelerate code production while CI/CD and environment provisioning retain the old cadence. The same mismatch applies when configuration becomes an agent-generated artifact. The Ghaleb study found that agents rarely change CI/CD configuration in the PRs it examined. That finding describes current activity in the study, rather than a measured rate of future agents-as-code adoption. More deliberate use of agents to maintain their definitions would extend the volume pressure to configuration changes.
The operational response is to increase pipeline capacity without creating a separate approval lane for agents. Parallelized CI jobs and ephemeral sandbox environments allow validation runs to proceed without treating each proposed definition as a special deployment project. Queue management should also avoid serializing agent-generated PRs behind human-generated ones merely because of authorship. Human approval at merge remains the gate established for every behavior change.
Why cost and credential scope belong in the definition file, not in separate infrastructure
A budget cap in a dashboard and an agent definition in Git create two sources of truth that can drift apart. Putting the cap beside tool permissions makes both part of one reviewable change. A reviewer can then assess whether a proposed behavior justifies the resources it may consume. The boundary becomes visible before execution begins. CI can also reject a proposed increase that exceeds organizational policy, rather than relying on someone to notice a separate dashboard edit.
Token budget strategies fit naturally into configuration fields, including per-session limits, per-key monthly caps, model-tier routing rules, and circuit breaker thresholds. Task budgets express a related but distinct control. They give the agent an advisory budget for its full loop so that it can regulate usage across turns and tool calls. An advisory budget should not be confused with an enforced cap. Both belong in the definition because each shapes how the agent is expected or permitted to operate.
Credential bindings also belong in the definition, while secret values stay out of review. The definition specifies which secrets the agent may access, with access scoped to the session and revoked on completion. Reviewers check the authorization boundary before the agent runs. A PR adding a credential scope is therefore an explicit request for broader access. Policy-as-code can validate that request against permitted credential classes while the human reviewer considers its purpose.
What observability and audit trails look like when the agent definition is the unit of deployment
A versioned definition provides the identifier needed to connect runtime activity to an approved configuration. The Git SHA at deployment links a session's tool calls, diffs, and token usage to the definition that authorized them. Attribution becomes more precise than a user name alone. Agent audit logging needs to distinguish the user, the agent version, and the specific tool identity. The deployed definition anchors that relationship, while the runtime log records what happened under it.
Session isolation makes the authorization boundary operational. Each agent session runs in an isolated sandbox with credentials minted for that session and revoked when it ends. The definition specifies permitted behavior, the sandbox enforces the runtime boundary, and the audit log records tool calls against the relevant version. An MCP Gateway can complement this arrangement by intercepting requests between agents and tools for centralized authentication, logging, and governance. Its role is runtime enforcement alongside review of the definition.
The Baqar study identifies auditability as a requirement for trust in autonomous pipeline decisions and proposes blockchain-ledger audit trails for irreversibility. Git history serves a narrower, simpler purpose in the versioned-definition approach. It records configuration changes, while session logs linked to the deployed version record what ran. Neither record has to stand alone. Together, they connect what was approved with what ran, making pre-deployment review and post-deployment accountability products of the same delivery discipline.
Applying the discipline without boiling the ocean — a practical starting sequence
One agent definition that already exists informally provides a practical starting point. A prompt in a Notion document, a shell script wrapping a model call, or a CLAUDE.md known to one engineer can become a YAML definition with a budget field and credential scope. The first step is structural and deliberately small. Put the file in the repository, add schema validation to CI, and establish merge-as-deploy. Every later behavior change then has a reviewable diff and a defined route to production.
The second step adds evidence about behavior. A small golden-dataset test runs the definition against inputs that reflect real use and checks the expected output shape, giving it a baseline before the test suite grows. The third step adds organizational policy enforcement. Policy-as-code gates check maximum budgets, permitted tool scopes, and required credential classes so that violations fail CI before human review.
The longer-term target allows experimentation and production discipline to coexist. Prompt-to-deploy supports experimentation, while git-push-to-deploy governs production, with both paths on the same platform and using the same audit log. The Qovery analysis frames that coexistence as a requirement for teams seeking both iteration speed and production safety. Experimentation can move quickly without turning an unreviewed prompt edit into a production configuration change.


