Back to agents
Agent #10

šŸš€ Build & Deployment Automation Agent

This agent generates CI/CD pipeline configurations, deployment scripts, and automation workflows. It supports multiple platforms (GitHub Actions, GitLab CI, Jenkins) and deployment targets. python 10_ci_cd_automation.py "GitHub Actions workflow for Node.js app" python 10_ci_cd_automation.py "Deploy to Kubernetes with canary rollout"

Key Features

  • āœ“Build pipeline generation
  • āœ“Deployment automation
  • āœ“Canary rollout strategy
  • āœ“Rollback procedures
  • āœ“Security scanning integration

Implementation

Download .py
10_ci_cd_automation.py
#!/usr/bin/env python3
"""
Build & Deployment Automation Agent

This agent generates CI/CD pipeline configurations, deployment scripts,
and automation workflows. It supports multiple platforms (GitHub Actions,
GitLab CI, Jenkins) and deployment targets.

Usage:
    python 10_ci_cd_automation.py "GitHub Actions workflow for Node.js app"
    python 10_ci_cd_automation.py "Deploy to Kubernetes with canary rollout"
"""

import sys
from anthropic import Anthropic

def main():
    if len(sys.argv) < 2:
        print("Usage: python 10_ci_cd_automation.py <pipeline_requirement>")
        sys.exit(1)

    target = " ".join(sys.argv[1:])

    client = Anthropic()

    system_prompt = """You are a DevOps and CI/CD expert. Your job is to:
1. Design efficient build pipelines
2. Create deployment workflows
3. Implement security scanning
4. Set up monitoring and alerting
5. Handle rollback procedures
6. Optimize build times
7. Manage infrastructure as code

Provide production-ready configurations with best practices."""

    task = f"""Generate a complete CI/CD pipeline for:

{target}

Create:
1. Pipeline configuration file (YAML) with:
   - Build stage
   - Test stage (unit, integration, security)
   - Deploy stage
   - Post-deployment checks
2. Build pipeline including:
   - Dependency installation
   - Compilation/transpilation
   - Artifact creation
   - Docker image building
3. Test stage with:
   - Unit tests
   - Integration tests
   - Code coverage
   - Security scanning
   - Linting
4. Deployment strategy:
   - Blue-green deployment or canary rollout
   - Health checks
   - Smoke tests
   - Rollback procedure
5. Environment configuration:
   - Development
   - Staging
   - Production
6. Security measures:
   - Secret management
   - Dependency scanning
   - SAST scanning
7. Monitoring setup:
   - Log aggregation
   - Performance monitoring
   - Alert rules
8. Documentation:
   - Pipeline explanation
   - Troubleshooting guide
   - Manual intervention procedures

Include comments explaining each step."""

    print("šŸš€ Starting CI/CD Automation Agent...\n")
    print("=" * 60)

    try:
        with client.messages.stream(
            model="claude-opus-4-7",
            max_tokens=3500,
            system=system_prompt,
            messages=[{"role": "user", "content": task}],
        ) as stream:
            for text in stream.text_stream:
                print(text, end="", flush=True)

        print("\n" + "=" * 60)
        print("\nāœ… CI/CD pipeline generation complete!")

    except Exception as e:
        print(f"\nāŒ Error: {e}")
        sys.exit(1)


if __name__ == "__main__":
    main()

How to Use

This agent is designed to be run from the command line:

python 10_ci_cd_automation.py <input>

The agent will stream its response to the console as it works through the task. Use Ctrl+C to interrupt at any time.

File
10_ci_cd_automation.py
Language
Python 3.8+
Dependencies
anthropic

Setup

  1. 1. Install: pip install anthropic
  2. 2. Download the .py file
  3. 3. Set ANTHROPIC_API_KEY
  4. 4. Run: python 10_ci_cd_automation.py
Previous
Log Analysis & Debugging Agent
šŸŽ‰ All agents viewed!