CI/CD Integration
AIGuard ships starter templates for GitHub Actions and GitLab CI. When an evaluation exceeds the configured threshold, the CLI exits non-zero and the pipeline fails — your unsafe build never reaches production.
GitHub Actions
.github/workflows/aiguard.ymlyaml
name: AIGuard Safety
on: [pull_request]
jobs:
evaluate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with: { python-version: "3.11" }
- run: pip install aiguard-safety
- run: aiguard evaluate --mode quick --output report.json
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
- uses: actions/upload-artifact@v4
if: always()
with: { name: aiguard-report, path: report.json }Generate this file with: aiguard ci github > .github/workflows/aiguard.yml
GitLab CI
.gitlab-ci.ymlyaml
aiguard:
image: python:3.11
script:
- pip install aiguard-safety
- aiguard evaluate --mode quick --output report.json
artifacts:
when: always
paths: [report.json]Tuning thresholds
Start with conservative thresholds (e.g. 0.20) and tighten over time as you triage false positives in human review. Use --mode thorough on the main branch and --mode quick on PRs to keep CI fast.