Skip to content

TedaLIEz/DevopsAIAgent

Repository files navigation

DevOps AI Agent

Introduction

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.

Problem Statement

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.

Challenges Addressed

  1. Log Overload: CI/CD pipelines generate extensive logs that can be overwhelming to sift through manually.
  2. Error Identification: Identifying errors and their root causes in logs can be time-consuming and error-prone.
  3. Contextual Analysis: Understanding the context of errors within the logs requires significant effort and expertise.
  4. Integration with GitHub: Seamlessly integrating log analysis with GitHub workflows to provide real-time feedback on pull requests and deployments.

Solution

The DevOps AI Agent addresses these challenges by:

  1. Automated Log Analysis: Using advanced language models to automatically analyze logs and extract meaningful insights.
  2. Error Detection: Quickly identifying errors and their root causes, providing concise summaries and actionable information.
  3. Contextual Understanding: Leveraging the LlamaIndex library to embed and query log data, enabling contextual analysis.
  4. GitHub Integration: Integrating with GitHub to fetch workflow logs, analyze them, and provide feedback directly on pull requests and deployments.

Build Environment Setup

Follow these steps to set up the build environment for the DevOps AI Agent project.

Prerequisites

  • Python 3.8 or higher
  • pip (Python package installer)
  • Git
  • Node.js and npm (for smee-client)

Clone the Repository

First, clone the repository to your local machine:

git clone https://github.com/yourusername/devops_ai_agent.git
cd devops_ai_agent

Install Dependencies

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

Environment Variables

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

GitHub Actions

This project includes a GitHub Actions workflow. The workflow file is located at .github/workflows/validation_and_build.yml.

Ignored Files

The .gitignore file includes the following entries to ensure sensitive and unnecessary files are not committed to the repository:

local.properties
data/
.env
env/

Running the Project

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.

Setting Up Webhook

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

Running with FastAPI

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.

Releases

No releases published

Packages

No packages published