|
| 1 | +--- |
| 2 | +title: DevOps Agent |
| 3 | +description: DevOps Agent protocol schemas |
| 4 | +--- |
| 5 | + |
| 6 | +# DevOps Agent |
| 7 | + |
| 8 | +<Callout type="info"> |
| 9 | +**Source:** `packages/spec/src/ai/devops-agent.zod.ts` |
| 10 | +</Callout> |
| 11 | + |
| 12 | +## Overview |
| 13 | + |
| 14 | +The DevOps Agent Protocol defines autonomous DevOps agents that can self-iterate on enterprise management software development using the ObjectStack specification. These agents integrate with GitHub for version control and Vercel for deployment, enabling fully automated development, testing, and release cycles. |
| 15 | + |
| 16 | +## TypeScript Usage |
| 17 | + |
| 18 | +```typescript |
| 19 | +import { |
| 20 | + DevOpsAgentSchema, |
| 21 | + CodeGenerationConfigSchema, |
| 22 | + CICDPipelineConfigSchema, |
| 23 | + DeploymentStrategySchema, |
| 24 | + MonitoringConfigSchema |
| 25 | +} from '@objectstack/spec/ai'; |
| 26 | + |
| 27 | +import type { |
| 28 | + DevOpsAgent, |
| 29 | + CodeGenerationConfig, |
| 30 | + CICDPipelineConfig, |
| 31 | + DeploymentStrategy, |
| 32 | + MonitoringConfig |
| 33 | +} from '@objectstack/spec/ai'; |
| 34 | + |
| 35 | +// Define a DevOps agent |
| 36 | +const devOpsAgent: DevOpsAgent = { |
| 37 | + name: 'devops_automation_agent', |
| 38 | + label: 'DevOps Automation Agent', |
| 39 | + role: 'Senior Full-Stack DevOps Engineer', |
| 40 | + instructions: '...', |
| 41 | + model: { |
| 42 | + provider: 'openai', |
| 43 | + model: 'gpt-4-turbo-preview', |
| 44 | + temperature: 0.3 |
| 45 | + }, |
| 46 | + developmentConfig: { |
| 47 | + specificationSource: 'packages/spec', |
| 48 | + codeGeneration: { |
| 49 | + enabled: true, |
| 50 | + targets: ['frontend', 'backend', 'api'] |
| 51 | + } |
| 52 | + }, |
| 53 | + integrations: { |
| 54 | + github: { |
| 55 | + connector: 'github_production', |
| 56 | + repository: { |
| 57 | + owner: 'objectstack-ai', |
| 58 | + name: 'app' |
| 59 | + } |
| 60 | + }, |
| 61 | + vercel: { |
| 62 | + connector: 'vercel_production', |
| 63 | + project: 'objectstack-app' |
| 64 | + } |
| 65 | + } |
| 66 | +}; |
| 67 | + |
| 68 | +// Validate |
| 69 | +const validatedAgent = DevOpsAgentSchema.parse(devOpsAgent); |
| 70 | +``` |
| 71 | + |
| 72 | +--- |
| 73 | + |
| 74 | +## Key Components |
| 75 | + |
| 76 | +### DevOpsAgent |
| 77 | + |
| 78 | +Extends the base `AgentSchema` with DevOps-specific configurations: |
| 79 | + |
| 80 | +**Additional Properties:** |
| 81 | +- `developmentConfig` (DevelopmentConfig) - Development configuration |
| 82 | +- `pipelines` (CICDPipelineConfig[], optional) - CI/CD pipelines |
| 83 | +- `versionManagement` (VersionManagement, optional) - Version management |
| 84 | +- `deploymentStrategy` (DeploymentStrategy, optional) - Deployment strategy |
| 85 | +- `monitoring` (MonitoringConfig, optional) - Monitoring configuration |
| 86 | +- `integrations` (IntegrationConfig) - GitHub and Vercel integrations |
| 87 | +- `selfIteration` (object, optional) - Self-iteration configuration |
| 88 | + |
| 89 | +--- |
| 90 | + |
| 91 | +### CodeGenerationConfig |
| 92 | + |
| 93 | +Configuration for automated code generation. |
| 94 | + |
| 95 | +**Properties:** |
| 96 | +- `enabled` (boolean) - Enable code generation (default: true) |
| 97 | +- `targets` (CodeGenerationTarget[]) - Generation targets |
| 98 | +- `templateRepo` (string, optional) - Template repository |
| 99 | +- `styleGuide` (string, optional) - Code style guide |
| 100 | +- `includeTests` (boolean) - Generate tests (default: true) |
| 101 | +- `includeDocumentation` (boolean) - Generate docs (default: true) |
| 102 | +- `validationMode` ('strict' | 'moderate' | 'permissive') - Validation strictness |
| 103 | + |
| 104 | +**Code Generation Targets:** |
| 105 | +- `frontend` - Frontend UI components |
| 106 | +- `backend` - Backend services |
| 107 | +- `api` - API endpoints |
| 108 | +- `database` - Database schemas |
| 109 | +- `tests` - Test suites |
| 110 | +- `documentation` - Documentation |
| 111 | +- `infrastructure` - Infrastructure as code |
| 112 | + |
| 113 | +--- |
| 114 | + |
| 115 | +### CICDPipelineConfig |
| 116 | + |
| 117 | +CI/CD pipeline configuration. |
| 118 | + |
| 119 | +**Properties:** |
| 120 | +- `name` (string) - Pipeline name |
| 121 | +- `trigger` ('push' | 'pull_request' | 'release' | 'schedule' | 'manual') - Trigger type |
| 122 | +- `branches` (string[], optional) - Branch filters |
| 123 | +- `stages` (PipelineStage[]) - Pipeline stages |
| 124 | +- `notifications` (object, optional) - Notification settings |
| 125 | + |
| 126 | +**Pipeline Stage Types:** |
| 127 | +- `build` - Build stage |
| 128 | +- `test` - Test execution |
| 129 | +- `lint` - Code linting |
| 130 | +- `security_scan` - Security scanning |
| 131 | +- `deploy` - Deployment |
| 132 | +- `smoke_test` - Post-deployment tests |
| 133 | +- `rollback` - Rollback to previous version |
| 134 | + |
| 135 | +--- |
| 136 | + |
| 137 | +### DeploymentStrategy |
| 138 | + |
| 139 | +Deployment strategy configuration. |
| 140 | + |
| 141 | +**Properties:** |
| 142 | +- `type` ('rolling' | 'blue_green' | 'canary' | 'recreate') - Strategy type |
| 143 | +- `canaryPercentage` (number) - Canary percentage (default: 10) |
| 144 | +- `healthCheckUrl` (string, optional) - Health check endpoint |
| 145 | +- `healthCheckTimeout` (number) - Timeout in seconds (default: 60) |
| 146 | +- `autoRollback` (boolean) - Auto-rollback on failure (default: true) |
| 147 | +- `smokeTests` (string[], optional) - Smoke test commands |
| 148 | + |
| 149 | +--- |
| 150 | + |
| 151 | +### GitHubIntegration |
| 152 | + |
| 153 | +GitHub integration configuration. |
| 154 | + |
| 155 | +**Properties:** |
| 156 | +- `connector` (string) - GitHub connector name |
| 157 | +- `repository` (object) - Repository config (owner, name) |
| 158 | +- `featureBranch` (string) - Default feature branch (default: 'develop') |
| 159 | +- `pullRequest` (object, optional) - PR settings |
| 160 | + - `autoCreate` (boolean) - Auto-create PRs (default: true) |
| 161 | + - `autoMerge` (boolean) - Auto-merge when checks pass (default: false) |
| 162 | + - `requireReviews` (boolean) - Require reviews (default: true) |
| 163 | + - `deleteBranchOnMerge` (boolean) - Delete after merge (default: true) |
| 164 | + |
| 165 | +--- |
| 166 | + |
| 167 | +### VercelIntegration |
| 168 | + |
| 169 | +Vercel deployment integration configuration. |
| 170 | + |
| 171 | +**Properties:** |
| 172 | +- `connector` (string) - Vercel connector name |
| 173 | +- `project` (string) - Vercel project name |
| 174 | +- `environments` (object, optional) - Environment mapping |
| 175 | + - `production` (string) - Production branch (default: 'main') |
| 176 | + - `preview` (string[]) - Preview branches |
| 177 | +- `deployment` (object, optional) - Deployment settings |
| 178 | + - `autoDeployProduction` (boolean) - Auto-deploy prod (default: false) |
| 179 | + - `autoDeployPreview` (boolean) - Auto-deploy preview (default: true) |
| 180 | + - `requireApproval` (boolean) - Require approval (default: true) |
| 181 | + |
| 182 | +--- |
| 183 | + |
| 184 | +## Use Cases |
| 185 | + |
| 186 | +### 1. Automated Feature Development |
| 187 | + |
| 188 | +```typescript |
| 189 | +const featureDevAgent: DevOpsAgent = { |
| 190 | + name: 'feature_dev_agent', |
| 191 | + label: 'Feature Development Agent', |
| 192 | + role: 'Full-Stack Developer', |
| 193 | + instructions: 'Generate features from specifications', |
| 194 | + model: { provider: 'openai', model: 'gpt-4-turbo' }, |
| 195 | + developmentConfig: { |
| 196 | + specificationSource: 'packages/spec', |
| 197 | + codeGeneration: { |
| 198 | + enabled: true, |
| 199 | + targets: ['frontend', 'backend', 'api', 'tests'], |
| 200 | + validationMode: 'strict', |
| 201 | + includeTests: true |
| 202 | + } |
| 203 | + }, |
| 204 | + integrations: { |
| 205 | + github: { |
| 206 | + connector: 'github_main', |
| 207 | + repository: { owner: 'myorg', name: 'app' }, |
| 208 | + pullRequest: { |
| 209 | + autoCreate: true, |
| 210 | + requireReviews: true |
| 211 | + } |
| 212 | + }, |
| 213 | + vercel: { |
| 214 | + connector: 'vercel_main', |
| 215 | + project: 'myapp', |
| 216 | + deployment: { |
| 217 | + autoDeployPreview: true, |
| 218 | + autoDeployProduction: false |
| 219 | + } |
| 220 | + } |
| 221 | + } |
| 222 | +}; |
| 223 | +``` |
| 224 | + |
| 225 | +### 2. Continuous Integration Pipeline |
| 226 | + |
| 227 | +```typescript |
| 228 | +const ciPipeline: CICDPipelineConfig = { |
| 229 | + name: 'CI Pipeline', |
| 230 | + trigger: 'pull_request', |
| 231 | + branches: ['main', 'develop'], |
| 232 | + stages: [ |
| 233 | + { |
| 234 | + name: 'Lint', |
| 235 | + type: 'lint', |
| 236 | + order: 1, |
| 237 | + parallel: false, |
| 238 | + commands: ['pnpm run lint'], |
| 239 | + timeout: 180, |
| 240 | + retryOnFailure: false, |
| 241 | + maxRetries: 0 |
| 242 | + }, |
| 243 | + { |
| 244 | + name: 'Test', |
| 245 | + type: 'test', |
| 246 | + order: 2, |
| 247 | + parallel: false, |
| 248 | + commands: ['pnpm run test:ci'], |
| 249 | + timeout: 600, |
| 250 | + retryOnFailure: false, |
| 251 | + maxRetries: 0 |
| 252 | + } |
| 253 | + ] |
| 254 | +}; |
| 255 | +``` |
| 256 | + |
| 257 | +### 3. Canary Deployment |
| 258 | + |
| 259 | +```typescript |
| 260 | +const canaryDeployment: DeploymentStrategy = { |
| 261 | + type: 'canary', |
| 262 | + canaryPercentage: 10, |
| 263 | + healthCheckUrl: '/api/health', |
| 264 | + healthCheckTimeout: 60, |
| 265 | + autoRollback: true, |
| 266 | + smokeTests: ['pnpm run test:smoke'] |
| 267 | +}; |
| 268 | +``` |
| 269 | + |
| 270 | +--- |
| 271 | + |
| 272 | +## Architecture |
| 273 | + |
| 274 | +The DevOps Agent follows these principles: |
| 275 | + |
| 276 | +1. **Self-Iterating Development**: Continuously improves based on feedback |
| 277 | +2. **Automated Code Generation**: Follows ObjectStack specifications |
| 278 | +3. **Continuous Integration**: Automated testing and validation |
| 279 | +4. **Version Management**: Semantic versioning with changelogs |
| 280 | +5. **Monitoring and Rollback**: Automated health checks and rollbacks |
| 281 | + |
| 282 | +--- |
| 283 | + |
| 284 | +## Best Practices |
| 285 | + |
| 286 | +1. **Start with strict validation**: Use `validationMode: 'strict'` for production |
| 287 | +2. **Enable testing**: Always set `includeTests: true` |
| 288 | +3. **Require reviews**: Set `requireReviews: true` for production deployments |
| 289 | +4. **Auto-rollback**: Enable `autoRollback: true` for safety |
| 290 | +5. **Monitor deployments**: Configure comprehensive monitoring alerts |
| 291 | +6. **Use feature branches**: Follow Git flow with feature branches |
| 292 | +7. **Semantic versioning**: Use `scheme: 'semver'` for version management |
| 293 | +8. **Gradual rollouts**: Use canary deployments for critical changes |
0 commit comments