The DevOps AI Agent is a tool designed to assist with log analysis using advanced language models. It integrates with GitHub to fetch workflow logs, analyze them, and provide concise summaries or error information. The project leverages the LlamaIndex library for embedding and querying log data.
In modern software development, continuous integration and continuous deployment (CI/CD) pipelines are essential for ensuring code quality and rapid delivery. However, managing and analyzing the logs generated by these pipelines can be a daunting task. Logs often contain a vast amount of information, making it challenging to quickly identify issues, understand their root causes, and take corrective actions.
- Log Overload: CI/CD pipelines generate extensive logs that can be overwhelming to sift through manually.
- Error Identification: Identifying errors and their root causes in logs can be time-consuming and error-prone.
- Contextual Analysis: Understanding the context of errors within the logs requires significant effort and expertise.
- Integration with GitHub: Seamlessly integrating log analysis with GitHub workflows to provide real-time feedback on pull requests and deployments.
The DevOps AI Agent addresses these challenges by:
- Automated Log Analysis: Using advanced language models to automatically analyze logs and extract meaningful insights.
- Error Detection: Quickly identifying errors and their root causes, providing concise summaries and actionable information.
- Contextual Understanding: Leveraging the LlamaIndex library to embed and query log data, enabling contextual analysis.
- GitHub Integration: Integrating with GitHub to fetch workflow logs, analyze them, and provide feedback directly on pull requests and deployments.
Follow these steps to set up the build environment for the DevOps AI Agent project.
- Python 3.8 or higher
- pip (Python package installer)
- Git
- Node.js and npm (for smee-client)
First, clone the repository to your local machine:
git clone https://github.com/yourusername/devops_ai_agent.git
cd devops_ai_agent
We recommend using virtualenv
to create an isolated Python environment for development. Install virtualenv
if you haven't already:
pip install virtualenv
Create a virtual environment and activate it:
virtualenv venv
source venv/bin/activate # On Windows use `venv\Scripts\activate`
Install the required Python packages using pip:
pip install -r requirements.txt
Install smee via npm:
npm install --global smee-client
Create a .env
file in the root directory of the project and add your environment variables. For example:
ENDPOINT=https://api.siliconflow.cn/v1
API_KEY=your_api_key
LLM_MODEL=deepseek-ai/DeepSeek-R1-Distill-Llama-8B
EMBEDDING_MODEL=Pro/BAAI/bge-m3
WEBHOOK_BASE_URL=https://smee.io/<channel ID>
APP_ID=your_app_id
PRIVATE_KEY_PATH=/path/to/your/private-key.pem
WEBHOOK_SECRET=your_webhook_secret
This project includes a GitHub Actions workflow. The workflow file is located at .github/workflows/validation_and_build.yml
.
The .gitignore
file includes the following entries to ensure sensitive and unnecessary files are not committed to the repository:
local.properties
data/
.env
env/
To run the project, execute the following command:
python src/agent.py <path_to_log_file>
This will start the DevOps AI Agent using the specified configurations.
To set up a webhook for local development, use smee
:
npm install --global smee-client
smee -u https://smee.io/<Your Channel ID> --port 8000
To run the project locally with fastapi
, use the following command:
uvicorn src.main:app --reload --log-config=log_conf.yaml
This will start the FastAPI server with live reload enabled.