A simple CI/CD utility for running LLM tasks with Semantic Kernel
Project description
AI-First DevOps Toolkit: LLM-Powered CI/CD Automation
๐ The Future of DevOps is AI-First
This toolkit represents a step toward AI-First DevOps - where intelligent automation handles the entire development lifecycle. Built for teams ready to embrace the exponential productivity gains of AI-powered development. Please read the blog post for more details on the motivation.
TLDR: What This Tool Does
Purpose: Zero-friction LLM integration for CI/CD pipelines with 100% guaranteed schema compliance. This is your foundation for AI-first integration practices.
Perfect For:
- ๐ค AI-Generated Code Reviews: Automated PR analysis with structured findings
- ๐ Intelligent Documentation: Generate changelogs, release notes, and docs automatically
- ๐ Security Analysis: AI-powered vulnerability detection with structured reports
- ๐ฏ Quality Gates: Enforce standards through AI-driven validation
- ๐ Autonomous Development: Enable AI agents to make decisions in your pipelines
- ๐ฏ JIRA Ticket Updates: Update JIRA tickets based on LLM output
- ๐ Unlimited Integration Possibilities: Chain it multiple times and use as glue code in your tool stack
Simple structured output example
uv run llm_ci_runner.py --input-file examples/02-devops/pr-description/input.json --schema-file examples/02-devops/pr-description/schema.json
The AI-First Development Revolution
This toolkit embodies the principles outlined in Building AI-First DevOps:
| Traditional DevOps | AI-First DevOps (This Tool) |
|---|---|
| Manual code reviews | ๐ค AI-powered reviews with structured findings |
| Human-written documentation | ๐ AI-generated docs with guaranteed consistency |
| Reactive security scanning | ๐ Proactive AI security analysis |
| Manual quality gates | ๐ฏ AI-driven validation with schema enforcement |
| Linear productivity | ๐ Exponential gains through intelligent automation |
Features
- ๐ฏ 100% Schema Enforcement: Token-level constraint enforcement with guaranteed compliance
- ๐ Zero-Friction CLI: Single script, minimal configuration for CI/CD integration
- ๐ Enterprise Security: Azure RBAC via DefaultAzureCredential
- ๐ Dynamic Schema Support: Runtime conversion of JSON schemas to Pydantic models
- ๐จ Beautiful Logging: Rich console output with timestamps and colors
- ๐ File-based I/O: CI/CD friendly with JSON input/output
- ๐ง Simple & Extensible: Easy to understand and modify for your specific needs
Quick Start
1. Install Dependencies with UV
# Install UV if you haven't already
curl -LsSf https://astral.sh/uv/install.sh | sh
# install python (optional)
uv python install 3.12
# Install dependencies (will use pre-installed Python)
uv sync --frozen
2. Set Environment Variables
export AZURE_OPENAI_ENDPOINT="https://your-resource.openai.azure.com/"
export AZURE_OPENAI_MODEL="gpt-4.1-mini" # or any other GPT
export AZURE_OPENAI_API_VERSION="2024-12-01-preview" # Optional
If you don't specify an API key, it will run DefaultAzureCredential to use RBAC (Role Based Access Control) for authentication (best practice). See Microsoft Docs for more details.
Otherwise, you can specify the API key in the environment variable AZURE_OPENAI_API_KEY.
3. Basic Usage
# Run directly with UV (recommended for CI/CD)
uv run --frozen llm_ci_runner.py \
--input-file examples/01-basic/simple-chat/input.json
# Or install and use as a package
pip install llm-ci-runner
llm-ci-runner --input-file examples/01-basic/simple-chat/input.json
Real-World Examples
You can explore the examples/ directory for a complete collection of self-contained examples organized by category.
For comprehensive real-world CI/CD scenarios, see examples/uv-usage-example.md which includes:
- ๐ Automated PR Description Updates: Generate comprehensive PR descriptions from commit messages and code changes
- ๐ Security Analysis with LLM-as-Judge: Analyze code changes for vulnerabilities with guaranteed schema compliance
- ๐ Automated Changelog Generation: Create structured changelogs from commit history
- ๐ค Code Review Automation: Automated reviews with structured findings and quality gates
- ๐ Multi-Stage AI Pipelines: Chain multiple AI operations for complex workflows
Input Format
{
"messages": [
{
"role": "system",
"content": "You are a helpful assistant."
},
{
"role": "user",
"content": "Your task description here"
}
],
"context": {
"session_id": "optional-session-id",
"metadata": {
"any": "additional context"
}
}
}
Structured Outputs with 100% Schema Enforcement
When you provide a --schema-file, the runner guarantees perfect schema compliance:
uv run llm_ci_runner.py \
--input-file examples/01-basic/sentiment-analysis/input.json \
--schema-file examples/01-basic/sentiment-analysis/schema.json
Note: Output defaults to result.json. Use --output-file custom-name.json for custom output files.
Supported Schema Features:
โ
String constraints (enum, minLength, maxLength, pattern)
โ
Numeric constraints (minimum, maximum, multipleOf)
โ
Array constraints (minItems, maxItems, items type)
โ
Required fields enforced at generation time
โ
Type validation (string, number, integer, boolean, array)
CI/CD Integration
GitHub Actions Example
- name: Generate PR Review with Schema Enforcement
run: |
uv run --frozen llm_ci_runner.py \
--input-file examples/02-devops/pr-description/input.json \
--schema-file examples/02-devops/pr-description/schema.json \
--log-level WARNING
env:
AZURE_OPENAI_ENDPOINT: ${{ secrets.AZURE_OPENAI_ENDPOINT }}
AZURE_OPENAI_MODEL: ${{ secrets.AZURE_OPENAI_MODEL }}
# Or using the installed package
- name: Generate PR Review with Schema Enforcement
run: |
llm-ci-runner \
--input-file examples/02-devops/pr-description/input.json \
--schema-file examples/02-devops/pr-description/schema.json \
--log-level WARNING
env:
AZURE_OPENAI_ENDPOINT: ${{ secrets.AZURE_OPENAI_ENDPOINT }}
AZURE_OPENAI_MODEL: ${{ secrets.AZURE_OPENAI_MODEL }}
For complete CI/CD examples, see examples/uv-usage-example.md.
Authentication
Uses Azure's DefaultAzureCredential supporting:
- Environment variables (local development)
- Managed Identity (recommended for Azure CI/CD)
- Azure CLI (local development)
- Service Principal (non-Azure CI/CD)
Testing
We maintain comprehensive test coverage with 100% success rate:
# Install development dependencies, without frozen to be up to date
uv sync --group dev
# Run specific test categories
uv run pytest tests/unit/ -v # 69 unit tests
uv run pytest tests/integration/ -v # End-to-end examples
uv run pytest acceptance/ -v # LLM-as-judge evaluation
Releasing
Manual Release Process
-
Test locally first:
python scripts/release.py 1.0.0
-
Trigger GitHub Actions release:
- Go to Actions โ Manual Release
- Click "Run workflow"
- Enter version (e.g.,
1.0.0) - Add release notes (optional)
- Choose whether to publish to PyPI
- Click "Run workflow"
The workflow will:
- โ Run all tests
- โ
Update version in
pyproject.toml - โ Build the package
- โ Create Git tag and push
- โ Create GitHub release
- โ Publish to PyPI (if selected)
- โ Verify package installation
Package Naming Convention
- Package name:
llm-ci-runner(kebab-case for PyPI) - Module name:
llm_ci_runner.py(snake_case for Python) - CLI command:
llm-ci-runner(kebab-case for CLI)
Use Cases
Automated Code Review with Structured Output
Generate detailed code reviews with guaranteed schema compliance for CI/CD integration.
Security Analysis with Structured Results
Analyze code changes for potential security vulnerabilities with structured findings.
Documentation Updates
Generate or update documentation based on code changes.
Release Notes with Structured Metadata
Create formatted release notes with guaranteed schema compliance.
For detailed examples of each use case, see examples/.
Architecture
Built on Microsoft Semantic Kernel for:
- Enterprise-ready Azure OpenAI integration
- Future-proof model compatibility
- 100% Schema Enforcement: KernelBaseModel integration with token-level constraints
- Dynamic Model Creation: Runtime JSON schema โ Pydantic model conversion
- RBAC: Azure RBAC via DefaultAzureCredential
The AI-First Development Journey
This toolkit is your first step toward AI-First DevOps. As you integrate AI into your development workflows, you'll experience:
- ๐ Exponential Productivity: AI handles routine tasks while you focus on architecture
- ๐ฏ Guaranteed Quality: Schema enforcement eliminates validation errors
- ๐ค Autonomous Operations: AI agents make decisions in your pipelines
- ๐ Continuous Improvement: Every interaction improves your AI system
The future belongs to teams that master AI-first principles. This toolkit gives you the foundation to start that journey today.
License
MIT License - See LICENSE file for details. Copyright (c) 2025, Benjamin Linnik.
Support
For issues and questions:
- Check the examples in the
examples/directory - Review the error logs (beautiful output with Rich!)
- Validate your Azure authentication and permissions
- Ensure your input JSON follows the required format
- Open an issue on GitHub as a last resort, don't expect a response fast. But I'll try to help you out.
Ready to embrace the AI-First future? Start with this toolkit and build your path to exponential productivity. Learn more about the AI-First DevOps revolution in Building AI-First DevOps.
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 llm_ci_runner-1.0.0.tar.gz.
File metadata
- Download URL: llm_ci_runner-1.0.0.tar.gz
- Upload date:
- Size: 612.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
279edb9f6f48fe9b08db4d4418ab8eebbd04febee766c81f72bf717b1735ffbb
|
|
| MD5 |
0e0453c43d99df84028a8265d8b5db02
|
|
| BLAKE2b-256 |
58e73e2ce29a3d508e1ce34a2db6107bfc01d8b92f1f83d09eaf5bddbd1892ed
|
File details
Details for the file llm_ci_runner-1.0.0-py3-none-any.whl.
File metadata
- Download URL: llm_ci_runner-1.0.0-py3-none-any.whl
- Upload date:
- Size: 14.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c1dfc73deefa08017ecc299a86e5ad579da03d3cba7acb5277d6870aca938bd3
|
|
| MD5 |
6e96d66d9b987e4791dd75bece7e5b64
|
|
| BLAKE2b-256 |
a6d2a213e093035846e6065f897d1317549265e1c4089e116559c912f4dd89d2
|