This directory contains example scripts that demonstrate how to use the Agentic DevOps framework. These examples range from simple CLI usage to complex multi-step agent workflows.
These scripts demonstrate how to use the command-line interface:
run_cli.py- Main CLI runner scriptrun_cli_help.py- Shows main help informationrun_cli_ec2_help.py- Shows EC2 commands helprun_cli_ec2_list_help.py- Shows EC2 list-instances helprun_cli_github_help.py- Shows GitHub commands helprun_cli_deploy_help.py- Shows deployment commands help
# Show main help
python run_cli.py --help
# Show EC2 commands
python run_cli.py ec2 --help
# List EC2 instances
python run_cli.py ec2 list-instances --output table
# Get GitHub repository details
python run_cli.py github get-repo owner/repo-name
# Deploy from GitHub to EC2
python run_cli.py deploy github-to-ec2 --repo owner/repo-name --instance-id i-1234567890abcdef0These examples demonstrate how to use the OpenAI Agents SDK integration:
Before running the agent examples, you need to:
-
Install the OpenAI Agents SDK:
pip install openai-agents
-
Set your OpenAI API key as an environment variable:
export OPENAI_API_KEY=your_api_key_here
hello_world.py- Simple example showing basic agent usageopenai_agents_example.py- Basic example of using agents for DevOps tasksopenai_agents_ec2_example.py- Example focused on EC2 operationsopenai_agents_github_example.py- Example focused on GitHub operationsopenai_agents_deployment_example.py- Example focused on deployment operationsgithub_to_ec2_deployment.py- Example of deploying from GitHub to EC2
ci_cd_pipeline_agent.py- Complex CI/CD pipeline management with multiple specialized agentsdisaster_recovery_agent.py- Disaster recovery operations with backup and recovery agentssecurity_compliance_agent.py- Security compliance operations with scanning, remediation, and reporting agents
After installing the prerequisites, you can run any of the examples:
# Run the hello world example
python hello_world.py
# Run the basic DevOps agent example
python openai_agents_example.py
# Run the CI/CD pipeline agent example
python ci_cd_pipeline_agent.py
# Run the disaster recovery agent example
python disaster_recovery_agent.py
# Run the security compliance agent example
python security_compliance_agent.pyIf you encounter an error about missing modules, make sure you've installed all the required dependencies:
pip install -r agentic_devops/requirements.txtThis example demonstrates a complex multi-step workflow for managing CI/CD pipelines using specialized agents:
- Infrastructure Agent: Manages EC2 instances and other AWS resources
- Code Agent: Handles GitHub repositories, pull requests, and code quality
- Deployment Agent: Executes deployments to different environments
Features:
- Custom models for deployment environments and plans
- Custom tools for validating and executing deployments
- Guardrails for deployment safety
- Multi-step workflow with dependencies between environments
- Error handling and prerequisite checking
This example demonstrates a complex multi-step workflow for disaster recovery operations using specialized agents:
- Backup Agent: Manages backup information and selection
- Infrastructure Agent: Manages EC2 instances and other AWS resources
- Recovery Agent: Executes recovery operations
Features:
- Custom models for backups, recovery targets, and plans
- Custom tools for listing backups, validating and executing recovery plans
- Guardrails for recovery safety
- Prioritization of critical resources and dependency management
- Error handling and prerequisite checking
This example demonstrates a complex multi-step workflow for security compliance operations using specialized agents:
- Security Scanner Agent: Identifies security issues in infrastructure
- Compliance Agent: Checks infrastructure against security frameworks
- Remediation Agent: Creates and executes remediation plans
- Security Reporting Agent: Generates comprehensive security reports
Features:
- Custom models for security findings, compliance checks, and remediation actions
- Custom tools for scanning, compliance checking, remediation, and reporting
- Guardrails for security operations
- Risk-based prioritization and comprehensive reporting
- Error handling and prerequisite checking
- Python 3.8+
- OpenAI API key (for agent examples)
- AWS credentials (for AWS operations)
- GitHub token (for GitHub operations)
The examples use the configuration and credential management from the Agentic DevOps framework. See the main documentation for details on setting up credentials and configuration.
If you encounter issues running the examples:
-
Make sure you have installed all required dependencies:
pip install -r agentic_devops/requirements.txt
-
Ensure your OpenAI API key is set correctly:
export OPENAI_API_KEY=your_api_key_here -
Check that you're running the examples from the root directory of the repository.
-
For AWS and GitHub operations, ensure you have the appropriate credentials configured.