GitLab platform plugin for cicaddy AI agent
Project description
cicaddy-gitlab
GitLab platform plugin for the cicaddy AI agent framework.
Features
- Merge Request Code Review - AI-powered code review on GitLab merge requests with inline comments
- Sub-Agent Delegation - AI-powered multi-agent review with specialized sub-agents running in parallel
- Branch Review - Compare branch changes against main for deployment readiness analysis
- Scheduled Analysis - Cron-based AI analysis jobs with MCP tool integration
- Multi-Provider AI - Support for Gemini, OpenAI, Claude, Gemini via Vertex AI, Anthropic via Vertex AI
- DSPy Task Files - Declarative YAML prompt definitions for structured analysis
- GitLab CI Templates - Ready-to-use CI/CD templates for merge request and scheduled jobs
Installation
pip install cicaddy-gitlab
This automatically installs cicaddy core as a dependency and registers the GitLab plugin via entry points.
Prerequisites
Set up your AI provider API key as a GitLab CI/CD variable before adding the templates.
Using Gemini as an example:
- Go to Settings > CI/CD > Variables in your GitLab project
- Click Add variable
- Set Key to
GEMINI_API_KEY, paste your API key as Value - Check Mask variable, then click Add variable
See docs/getting-started.md for other providers (OpenAI, Claude, Gemini Vertex AI, Anthropic Vertex AI) and full security best practices.
Quick Start
Merge Request Code Review
Add to your .gitlab-ci.yml:
include:
- remote: 'https://raw.githubusercontent.com/redhat-community-ai-tools/cicaddy-gitlab/main/gitlab/ai_agent_template.yml'
ai_code_review:
extends: .ai_agent_template
variables:
AI_PROVIDER: "gemini"
GEMINI_API_KEY: $GEMINI_API_KEY
DELEGATION_MODE: "auto"
SLACK_WEBHOOK_URL: $SLACK_WEBHOOK_URL
The CI template sets DELEGATION_MODE: "auto", which triages the diff and spawns specialist sub-agents (security, performance, etc.) in parallel. Set DELEGATION_MODE: "none" for single-agent review. You can add custom sub-agents to the pool alongside the defaults — see docs/delegation.md for details.
Custom Sub-Agents
Add your own specialist reviewers by placing YAML files in .agents/delegation/review/:
# .agents/delegation/review/compliance-reviewer.yaml
name: compliance-reviewer
agent_type: review
persona: compliance engineer specializing in regulatory requirements
description: Reviews changes for regulatory and compliance impact
categories: [security, configuration]
constraints:
- Focus on regulatory compliance (SOC2, GDPR, HIPAA)
- Flag any PII handling changes
output_sections:
- Compliance Impact
- Regulatory Risks
priority: 15
Or define agents inline via the DELEGATION_AGENTS CI/CD variable:
ai_code_review:
extends: .ai_agent_template
variables:
AI_PROVIDER: "gemini"
GEMINI_API_KEY: $GEMINI_API_KEY
DELEGATION_MODE: "auto"
DELEGATION_AGENTS: >-
[{"name": "compliance-reviewer", "agent_type": "review",
"persona": "compliance engineer",
"description": "Reviews regulatory and compliance impact",
"categories": ["security", "configuration"]}]
Custom agents with the same name as a built-in replace it. See docs/delegation.md for the full YAML format, merge precedence, and tool filtering.
Scheduled Analysis with MCP Tools
include:
- remote: 'https://raw.githubusercontent.com/redhat-community-ai-tools/cicaddy-gitlab/main/gitlab/ai_cron_template.yml'
daily_analysis:
extends: .ai_cron_template
variables:
AI_PROVIDER: "gemini"
GEMINI_API_KEY: $GEMINI_API_KEY
MCP_SERVERS_CONFIG: >-
[{"name": "my-server", "protocol": "http",
"endpoint": "https://my-mcp-server.example.com/mcp",
"timeout": 300, "idle_timeout": 60}]
AI_TASK_PROMPT: |
Use MCP tools to analyze data and generate a comprehensive report.
SLACK_WEBHOOK_URL: $SLACK_WEBHOOK_URL
rules:
- if: $CI_PIPELINE_SOURCE == "schedule"
Using DSPy Task Files
Create structured task definitions in YAML:
# .gitlab/prompts/my_analysis.yml
name: custom_analysis
description: Custom analysis task
type: analysis
version: "1.0"
inputs:
- name: data_source
description: Data source to analyze
required: true
outputs:
- name: summary
description: Analysis summary
required: true
format: paragraph
constraints:
- Focus on actionable insights
- Prioritize by business impact
reasoning: chain_of_thought
output_format: markdown
Reference it in your CI job:
custom_analysis:
extends: .ai_cron_template
variables:
AI_TASK_FILE: "../.gitlab/prompts/my_analysis.yml"
CI Template Variables
Common Variables
| Variable | Default | Description |
|---|---|---|
AI_PROVIDER |
gemini |
AI provider (gemini, openai, claude, gemini-vertex, anthropic-vertex) |
AI_MODEL |
gemini-3-flash-preview |
Model to use |
MCP_SERVERS_CONFIG |
[] |
JSON array of MCP server configs |
AI_TASK_FILE |
(empty) | Path to DSPy task YAML file |
AI_TASK_PROMPT |
(built-in) | Inline task prompt |
SLACK_WEBHOOK_URL |
(empty) | Slack webhook for notifications |
MAX_INFER_ITERS |
15 |
Max AI inference iterations (agent: 15, cron: 30) |
LOG_LEVEL |
INFO |
Logging verbosity |
Agent Template Variables
| Variable | Default | Description |
|---|---|---|
AGENT_TASKS |
code_review |
Comma-separated task list |
DELEGATION_MODE |
none |
none (single-agent) or auto (multi-agent delegation). CI template sets auto. |
MAX_SUB_AGENTS |
3 |
Max concurrent sub-agents (1-10) |
SUB_AGENT_MAX_ITERS |
10 |
Max iterations per sub-agent (1-15) |
DELEGATION_AGENTS |
(empty) | JSON config for custom sub-agent definitions |
DELEGATION_AGENTS_DIR |
.agents/delegation |
Directory for user-defined sub-agent YAML files |
TRIAGE_PROMPT |
(empty) | Custom instructions for the triage AI |
GIT_DIFF_CONTEXT_LINES |
10 |
Context lines in diff |
GIT_WORKING_DIRECTORY |
. |
Git repo directory |
Cron Template Variables
| Variable | Default | Description |
|---|---|---|
TASK_TYPE |
custom |
Prompt template: custom (uses AI_TASK_PROMPT/AI_TASK_FILE), security_audit, quality_report, dependency_check; other values use general analysis |
TASK_SCOPE |
external_tools |
Analysis scope |
MAX_EXECUTION_TIME |
600 |
Max execution time (seconds) |
CONTEXT_SAFETY_FACTOR |
0.75 |
Token budget safety factor |
Architecture
cicaddy (core) - AI agent framework with MCP support
+-- cicaddy-gitlab - GitLab platform plugin (this package)
The plugin registers with cicaddy via Python entry points:
cicaddy.agents- MergeRequestAgent, BranchReviewAgentcicaddy.settings_loader- GitLab-specific settingscicaddy.cli_args- GitLab CLI argumentscicaddy.validators- GitLab configuration validationcicaddy.delegation_blocked_tools- Side-effect tools blocked for sub-agents
Running Locally
You can run the agent outside of GitLab CI for development and testing using .env files.
# Install from source
git clone https://github.com/redhat-community-ai-tools/cicaddy-gitlab.git
cd cicaddy-gitlab
uv pip install -e .
# Prepare environment file
cp .env.example .env.local
# Edit .env.local with your API key and settings
# Validate configuration
uv run cicaddy config show --env-file .env.local
# Run the agent
uv run cicaddy run --env-file .env.local
# Override settings via CLI
uv run cicaddy run --env-file .env.local --ai-provider openai --verbose
For MR review, use .env.mr.example as a starting point — it includes GitLab API variables (GITLAB_TOKEN, CI_MERGE_REQUEST_IID, etc.).
See docs/running-locally.md for detailed examples including MCP server configuration, DSPy task files, and troubleshooting.
Development
# Install with dev dependencies
uv pip install -e ".[dev]"
# Run tests
uv run pytest
# Lint and format
ruff check --fix src/ tests/
ruff format src/ tests/
License
Apache License 2.0
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cicaddy_gitlab-0.7.0.tar.gz.
File metadata
- Download URL: cicaddy_gitlab-0.7.0.tar.gz
- Upload date:
- Size: 33.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a661518905ef2c782c3fe9785455ec9f4637edac8677481bfd931a15822cd2c4
|
|
| MD5 |
f9a65e9b9a0156463a50e2da32a071ce
|
|
| BLAKE2b-256 |
330c3068f50b42640eb756220a41d2c2cd6c014078a9610d6e95b8897c838f4a
|
Provenance
The following attestation bundles were made for cicaddy_gitlab-0.7.0.tar.gz:
Publisher:
python-publish.yml on redhat-community-ai-tools/cicaddy-gitlab
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cicaddy_gitlab-0.7.0.tar.gz -
Subject digest:
a661518905ef2c782c3fe9785455ec9f4637edac8677481bfd931a15822cd2c4 - Sigstore transparency entry: 1390724758
- Sigstore integration time:
-
Permalink:
redhat-community-ai-tools/cicaddy-gitlab@4bc0e1c6f0010a1fbd0d172b5ad77df92bd3d1a7 -
Branch / Tag:
refs/tags/v0.7.0 - Owner: https://github.com/redhat-community-ai-tools
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@4bc0e1c6f0010a1fbd0d172b5ad77df92bd3d1a7 -
Trigger Event:
release
-
Statement type:
File details
Details for the file cicaddy_gitlab-0.7.0-py3-none-any.whl.
File metadata
- Download URL: cicaddy_gitlab-0.7.0-py3-none-any.whl
- Upload date:
- Size: 34.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b670258909000a94927a9e03fc63898f8aa070a58ad324fd4b335b466a807117
|
|
| MD5 |
02d78ff05598f8c63dd31c2d8e3b9309
|
|
| BLAKE2b-256 |
61dcbd002dd53a32a83f142306697a4c66a7b86754963aa14d1341ebc82bbb18
|
Provenance
The following attestation bundles were made for cicaddy_gitlab-0.7.0-py3-none-any.whl:
Publisher:
python-publish.yml on redhat-community-ai-tools/cicaddy-gitlab
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cicaddy_gitlab-0.7.0-py3-none-any.whl -
Subject digest:
b670258909000a94927a9e03fc63898f8aa070a58ad324fd4b335b466a807117 - Sigstore transparency entry: 1390724813
- Sigstore integration time:
-
Permalink:
redhat-community-ai-tools/cicaddy-gitlab@4bc0e1c6f0010a1fbd0d172b5ad77df92bd3d1a7 -
Branch / Tag:
refs/tags/v0.7.0 - Owner: https://github.com/redhat-community-ai-tools
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@4bc0e1c6f0010a1fbd0d172b5ad77df92bd3d1a7 -
Trigger Event:
release
-
Statement type: