Skip to main content

Environment Promotion Model

Code moves through environments. Agents move through stages. This guide defines how the 7-stage agent pipeline maps to environment promotion — ensuring that the right agents perform the right validations in the right environment.

Environment Architecture

┌────────────────────────────────────────────────────────────────────────────┐
│ ENVIRONMENT PROMOTION FLOW │
│ │
│ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ │
│ │ DEVELOPMENT │────>│ STAGING │────>│ PRODUCTION │ │
│ │ │ │ │ │ │ │
│ │ Stages 1-3 │ │ Stages 4-5 │ │ Stages 6-7 │ │
│ │ │ │ │ │ │ │
│ │ product-agent│ │ qa-agent │ │platform-agent│ │
│ │ scrum-agent │ │ security- │ │ ops-agent │ │
│ │ architect- │ │ agent │ │ executive- │ │
│ │ agent │ │ compliance- │ │ agent │ │
│ │ developer- │ │ agent │ │ │ │
│ │ agent │ │ devmgr-agent │ │ │ │
│ └──────┬───────┘ └──────┬───────┘ └──────────────┘ │
│ │ │ ▲ │
│ Gate 3 Gate 5 Gate 6 │
│ (Code Ready) (Release Ready) (Deploy Approved) │
│ │
│ ◄──────── ROLLBACK PATH (any environment can trigger) ────────────► │
└────────────────────────────────────────────────────────────────────────────┘

Environment Definitions

Development Environment

Purpose: Where ideas become code. Agents explore, implement, and produce initial artifacts.

AspectDetails
Active agentsproduct-agent, scrum-agent, architect-agent, developer-agent
Active stagesStage 1 (Requirements), Stage 2 (Design), Stage 3 (Implementation)
Data allowedSynthetic data only. No production data, no PII, no Confidential/Restricted data
Branch strategyFeature branches only. No direct commits to main/develop
CI checksLint, unit tests, basic SAST, AI metadata validation
Exit gateGate 3 — code compiles, tests pass, AI attribution present

Agent-specific rules in Development:

AgentAllowedNot Allowed
product-agentDraft stories, refine acceptance criteriaAccess staging/production data
scrum-agentEstimate, assess capacityOverride developer estimates
architect-agentValidate design, check constraintsMake implementation decisions
developer-agentWrite code, write tests, create PRsMerge to protected branches, access production

Staging Environment

Purpose: Where code proves it works. Agents validate quality, security, and compliance before production.

AspectDetails
Active agentsqa-agent, security-agent, compliance-agent, devmgr-agent
Active stagesStage 4 (Testing), Stage 5 (Security & Compliance)
Data allowedAnonymized production-like data. No real PII without data masking
Branch strategyRelease branches or main branch (post-merge)
CI checksFull test suite, integration tests, E2E tests, SAST, DAST, SCA, license scan
Exit gateGate 5 — all tests pass, security cleared, compliance evidence complete

Agent-specific rules in Staging:

AgentAllowedNot Allowed
qa-agentRun tests, generate test matrices, classify defectsModify source code, approve its own changes
security-agentRun scans, classify findings, produce remediation guidanceWaive critical findings, access production secrets
compliance-agentVerify evidence, check licenses, validate audit trailGrant waivers without human approval
devmgr-agentAssess metrics, validate evidence completenessOverride security or compliance decisions

Production Environment

Purpose: Where code serves users. Agents deploy, monitor, and report.

AspectDetails
Active agentsplatform-agent, ops-agent, executive-agent
Active stagesStage 6 (Deployment), Stage 7 (Operations)
DataReal production data. All data handling per classification policy
Branch strategyOnly release-tagged commits from staging
DeploymentCanary → progressive rollout → full deployment
Exit gateGate 7 — health checks pass, no critical incidents, feedback captured

Agent-specific rules in Production:

AgentAllowedNot Allowed
platform-agentExecute deployment plan, configure monitoring, manage feature flagsDeploy without human approval, modify code
ops-agentMonitor metrics, detect anomalies, generate alerts, propose rollbackExecute rollback without human approval, modify code
executive-agentAggregate metrics, generate reports, calculate ROIMake operational decisions, modify infrastructure

Promotion Gates

Gate 3: Development → Staging

Who decides: Automated CI pipeline + Developer review

CheckAutomated?Blocking?
Code compilesYesYes
Lint passesYesYes
Unit tests passYesYes
AI metadata present (AI-Usage, Agent-IDs, AI-Prompt-Ref)YesYes
Basic SAST scan (critical only)YesYes
Developer code reviewHumanYes
PR approved by qualified reviewerHumanYes

On failure: Code stays in Development. developer-agent receives failure details and iterates.

Gate 5: Staging → Production (Release Candidate)

Who decides: QA Lead + Security Engineer + Compliance Officer (human approvals for Tier 2+)

CheckAutomated?Blocking?
Integration tests passYesYes
E2E tests passYesYes
Test coverage meets thresholdYesYes
Full SAST scanYesYes
DAST scanYesYes
Dependency/license scanYesYes
No unresolved critical/high security findingsYesYes
Compliance evidence pack completeYesYes
QA release readiness: PASSHuman (auto at Trust Level 3)Yes
Security sign-offHuman for critical/highYes
Compliance sign-off for Tier 3+HumanYes

On failure: Code stays in Staging. Failure routes to the appropriate agent:

  • Test failure → developer-agent (fix code) or qa-agent (fix test)
  • Security finding → developer-agent (remediate) + security-agent (re-scan)
  • Compliance gap → compliance-agent (identify requirement) + relevant agent (produce evidence)

Gate 6: Staging → Production (Deployment Approval)

Who decides: Human approver (always, regardless of trust level)

CheckAutomated?Blocking?
All Gate 5 checks passedYesYes
Deployment plan reviewedHumanYes
Rollback procedure testedHumanYes
Monitoring configuredYesYes
Feature flags configuredYesYes (if applicable)
Human deployment approvalHumanAlways blocking

On failure: Deployment blocked. platform-agent receives feedback to adjust configuration.


Rollback Protocol

Rollback can be triggered from any environment. The agent responsible depends on where the issue is detected.

ISSUE DETECTED IN:

Production ──> ops-agent proposes rollback ──> Human approves ──> platform-agent executes

Incident record
created

Routes to:
- developer-agent (code fix)
- security-agent (if vuln)
- qa-agent (if test gap)

Staging ──> qa-agent or security-agent flags issue ──> Routes back to Development

developer-agent fixes
Re-enters Gate 3

Development ──> developer-agent iterates locally ──> No rollback needed

Rollback Decision Matrix

SeverityDetection PointDecision MakerMax Response TimeAction
Critical (data loss, security breach)ProductionImmediate — ops-agent auto-proposes, human approves15 minutesImmediate rollback + incident response
High (major functionality broken)Productionops-agent proposes, Platform Engineer approves1 hourRollback or hotfix decision
Medium (degraded performance)Productionops-agent flags, Platform Engineer decides4 hoursHotfix in next deployment window
Low (cosmetic, minor)Productionops-agent logs, next sprintNext sprintFix in normal flow
Any severityStagingAutomated — routes back to DevelopmentSame sprintFix and re-promote

Data Flow Between Environments

Data TypeDevelopmentStagingProduction
Source codeFeature branchesRelease branchesTagged releases
Test dataSynthetic onlyAnonymized production-likeReal production data
SecretsDev secrets vaultStaging secrets vaultProduction secrets vault
AI promptsFull prompt content loggedFull prompt content loggedPrompt references only (no content)
Agent run recordsStored locallyStored in audit systemStored in audit system
Monitoring dataBasic metricsFull metrics (simulated load)Full production metrics
warning

No data flows backward. Production data MUST NOT enter Staging or Development without anonymization. Staging data MUST NOT enter Development. Agent prompts in Production MUST NOT contain Confidential or Restricted data — use reference IDs instead.


Environment-Specific Agent Configuration

Each agent's contract is scoped to the environment it operates in. The same agent identity (developer-agent) may have different permissions in different environments.

# Example: developer-agent contract by environment
agent_id: developer-agent
contracts:
development:
allowed_inputs: [approved-story, architecture-constraints, existing-code]
allowed_outputs: [code-patch, unit-tests, implementation-notes]
forbidden_actions: [merge-main, access-staging, access-production]
data_classification_max: Internal
staging:
allowed_inputs: [test-failure-details, security-finding-details]
allowed_outputs: [code-fix-patch, remediation-notes]
forbidden_actions: [merge-main, access-production, modify-test-data]
data_classification_max: Internal
production:
allowed_inputs: [] # developer-agent does not operate in production
allowed_outputs: []
forbidden_actions: [all]
data_classification_max: none

This ensures that even if an agent's credentials are compromised, the blast radius is limited to the environment it is authorized for.