An AI-powered DevOps agent that automates the mobile release pipeline using ReAct architecture.
Status: π§ Under Development
CICD-Agent is an intelligent release automation tool built with LangGraph and Python. It mimics the cognitive workflow of a Senior Release Manager, orchestrating real-world DevOps tools to ensure a high-quality mobile app release.
The agent handles the end-to-end decision-making process:
- Real Build Execution: (Upgraded!) Triggers real Gradle tasks (
assembleDebug/Release). Supports both Standard Android and Kotlin Multiplatform (KMP) project structures. Automatically locates and renames APK artifacts based on branches. - Pre-flight Checks (Mock): Verifies if fatal crashes are resolved via Bugly/Sentry simulation.
- Static Security Analysis: Uses Androguard to parse the binary APK, verifying package integrity, SDK versions, Debug signatures, and detecting high-risk permissions.
- Real Device Performance: Uses ADB to install the APK (with auto-grant permissions), performs a Cold Start (Force Stop -> Launch), and analyzes Memory Usage (PSS) in real-time.
The project implements the ReAct (Reasoning + Acting) pattern. The Agent serves as a central "Brain" that dynamically selects tools from a toolkit based on the current state and observation results.
graph LR
subgraph AgentSystem ["π€ The Agent System"]
direction TB
Memory[("π§ Memory/Context")]
Reasoning["β‘ Reasoning Engine (Brain)"]
Memory <--> Reasoning
end
subgraph ToolKit ["π οΈ Tool Kit"]
direction TB
T_Build["1. π¨ Real Gradle Builder"]
T_Crash["2. π Crashlytics (Mock)"]
T_Audit["3. π‘οΈ Static Analysis (Androguard)"]
T_Perf["4. π± Real Device Test (ADB)"]
end
User("π€ User Input") ==> Reasoning
Reasoning -- "Action" --> ToolKit
ToolKit -- "Observation" --> Reasoning
Reasoning ==> FinalResult["π Final Report"]
- Core: Python 3.10+
- Package Manager:
uv(Ultra-fast Python package installer) - Orchestration: LangGraph (Stateful, multi-actor applications)
- LLM Integration: LangChain + Ollama (Llama3 / Qwen)
- Build System: Gradle (Android / KMP)
- Static Analysis: Androguard (APK Reverse Engineering)
- Mobile Bridge: Android Debug Bridge (ADB)
This project uses Ollama for local inference and uv for dependency management.
-
Install uv (Package Manager):
# macOS / Linux (via Homebrew) brew install uv # Or via Curl (Universal) # curl -LsSf https://astral.sh/uv/install.sh | sh
-
Environment Setup (Crucial for Real Builds):
- Java JDK: Version 11 or 17 installed (
JAVA_HOMEset). - Android SDK: Installed (
ANDROID_HOMEset). - ADB Tools: Ensure
adbis in your PATH and an Android device/emulator is connected.
- Java JDK: Version 11 or 17 installed (
-
LLM Setup:
- Download Ollama.
- Start server:
ollama serve - Pull model:
ollama pull qwen3:8b(Matchllm_configs.py)
-
Clone the Repository:
git clone https://github.com/ethanzhongch/CICD-Agent.git cd CICD-Agent -
Install Dependencies:
uv sync
-
Configure Target Project βοΈ: You do not need to provide an APK manually anymore. Point the agent to your Android source code instead.
Edit
src/cicd_assistant/main.py:# 1. Path to your Android/KMP Project Root (folder containing gradlew) android_project_root = "/path/to/your/project" # 2. App Details (Must match your AndroidManifest.xml and ADB output) # Tip: Run `adb shell dumpsys window | grep mCurrentFocus` to find these. target_package = "com.example.app" target_activity = ".MainActivity" # 3. Build Variant ("debug" is recommended for unsigned CI testing) target_variant = "debug"
-
Connect Device: Ensure your device/emulator is connected and authorized:
adb devices
-
Run the Agent:
uv run src/cicd_assistant/main.py
The agent will perform the following steps automatically:
- Build the project from source and save the APK to
src/fixtures/. - Audit the generated APK.
- Install & Launch the APK on your real device (Cold Start).
- Generate Report at
outputs/release_report.md.
- ADB Error: Device not found: Ensure your device is visible in
adb devices. - Error type 3: Activity class does not exist: Double-check
target_packageandtarget_activityinmain.py. The package name must match exactly what is installed on the phone. - Install Failed (No Certificates): Ensure
target_variantis set to"debug". Release builds require signing configuration inbuild.gradle.
MIT