Agentic CI/CD
CI/CD pipeline design when an autonomous agent is the developer — not just a tool in the pipeline, but the actor writing code, running tests, and triggering deploys. The key difference from standard CI/CD: CI is the external watchdog, not a convenience. The agent must pass CI before it can proceed; CI provides the enforcement the absent human would otherwise provide.Key Difference from Standard CI/CD
The agent must not be able to override CI. If the agent can skip or modify the CI pipeline, the external watchdog is compromised.
Gate Sequence
Each gate must pass before the next step. The agent cannot advance by claiming success — the gate output is machine-verified by the harness.Staging-First, Always
The autonomous agent never deploys directly to production. The flow is:Network Isolation: Builder vs Deployer
Two separate network contexts prevent cross-contamination: Builder network (during code generation and test runs):- Outbound: npm/pip/cargo registries, git remotes
- No access to: staging/prod databases, cloud provider APIs, deployment endpoints
- Outbound: container registry, staging host, health check endpoints
- No access to: npm registries, arbitrary internet (prevents supply chain injection during deploy)
Agentic-Specific Guardrails
Standard CI/CD guardrails assume a human developer who self-limits. With an autonomous agent, these become hard enforcements: Diff size cap CI rejects any commit wheregit diff --stat HEAD | total lines changed > N. Forces the agent to patch incrementally. Without this, a confused agent rewrites entire files to fix a one-line bug.
No destructive migration auto-run
CI detects migration files containing DROP TABLE, DROP COLUMN, TRUNCATE, or ALTER TABLE ... DROP. Flags and halts — does not run. The agent can propose the migration; a human (or separate approval gate) must authorize it.
Flaky test quarantine
Any test that fails intermittently across N clean runs is quarantined (skipped in CI, logged for repair). Flaky tests in the agent’s feedback loop corrupt self-healing: the agent believes it broke something, enters a repair cycle, and may actually introduce new bugs.
Failure signature tracking
CI stores the hash of each failing test + error message across retry runs. If the same signature appears after a patch, the agent does not get credit for “fixing” it — the gate stays red.
Completion Conditions
The agent must have explicit completion criteria, or the loop never exits cleanly:- All CI gates green on a fresh clone
- Staging synthetic E2E passing
- Monitor window (N minutes of healthy health checks) complete
- No open failure signatures in
loop-state.json - Incident log empty (no unresolved rollbacks)
Rollback Integration
CI/CD owns rollback triggering, not the agent:- Health check fails post-deploy → deployer automatically redeploys last green image
- Agent’s self-healing cycle exhausts retry budget → harness triggers rollback + writes incident note + sets
ESCALATE=1env flag - CI pipeline itself fails N times with same signature → pipeline marks job as “blocked, escalation required” and halts
Observability
Minimum required for the harness to operate autonomously:Minimum Stack for First Experiment
Based on the household expense tracker reference project:Related Pages
- Self-Healing Loop — what happens when CI gates fail; retry/rollback/escalation
- CI/CD Testing — test types, pyramid, shift-left; the test layer that feeds CI gates
- Verification Pipeline — UI/visual verification layer (Playwright, screenshots)
- Agentic Sandbox Controls — isolation and credential model for the agent
- Worktree Isolation — per-task filesystem isolation that feeds the CI pipeline
- Ralph Loop — outer loop driver; agentic CI/CD is the quality gate per iteration
- Lean Agentic Coding Workflow — the workflow this CI/CD pattern fits inside
- LLM Eval Pipeline — eval pipeline that feeds CI gates: golden dataset, code assertions, LLM-judge, production monitoring