crilio
The CI/CD quality gate for AI — pytest for prompts.
If Crilio helps you, please ⭐ star this repo — it helps other devs find it and motivates me to keep building.
☁️ Join the Crilio Cloud Waitlist (Get 40% off team dashboards & analytics when we launch)
---
**Crilio stops prompt regressions from reaching production.** Version your prompts + natural-language rules in `crilio.yaml` — Crilio calls your model, judges every response with an LLM, and reports `PASS / FAIL` per rule.
---
### ✨ Features
- **LLM-as-a-Judge** — Strict Pydantic-verified verdicts (`rule_passed: bool`), temp 0. No flaky free-text parsing.
- **BYOK** — Your keys, your bill. OpenAI + Anthropic. Typically < $0.01 / test on `gpt-4o-mini`.
- **CI/CD Native** — `exit 1` blocks PRs in GitHub Actions. Locally it warns but never blocks.
- **PR Comments** — Auto-posts formatted failure details to the PR when running in Actions (`GITHUB_TOKEN`, silent fail, never blocks gate).
- **Leak Guard** — Rejects `crilio.yaml` containing `sk-...`/`api_key` — keys must be in `.env`/Secrets, never committed.
- **Local Bots** — `target: {command: "python bot.py '{{prompt}}'"}` runs any local model (Ollama/vLLM) via stdout → Judge, `$0` target.
- **Skip & List** — `skip: true` per-test to pause, `crilio ls [--tag] [--json]` to preview tests without running.
- **Diff** — `crilio diff --base main` shows prompt/rule changes between git refs (`+`/`-` per rule, not whole list).
- **Budget Guard** — `max_monthly_budget_usd` halts the run when cost exceeds cap. Delete the line or leave it blank for unlimited.
- **Rich Terminal UI** — `crilio` (no args) shows a `STATUS` / `EXAMPLES` / `COMMANDS` homepage; `crilio run` prints a `Test / Prompt / Output / Verdict` result table and a `Gate PASS` / `Gate FAIL` summary footer.
- **Fail-fast** — `crilio run --fail-fast` stops after the first failure.
---
### 🚀 Quick Start
```bash
pip install crilio
export OPENAI_API_KEY="sk-proj-..." # or ANTHROPIC_API_KEY — .env also works
crilio init # creates crilio.yaml
crilio run --dry-run # validate without API calls
crilio run # Target → Judge → gate
```
> `crilio` with no args shows status, config, and next steps.
---
### ⚙️ Usage
| Command | Description |
|---|---|
| `crilio init [--force] [--yes]` | Create `crilio.yaml` + optional GitHub Actions workflow |
| `crilio ls [-c FILE] [--tag TAG] [--json]` | List tests — preview without running |
| `crilio diff [--base REF] [-c FILE] [--json] [--fail-on-change]` | Show prompt/rule diff between git refs |
| `crilio run [-c FILE] [-m MODEL] [--judge-model MODEL] [--verbose] [--json] [--dry-run] [--tag TAG] [--fail-fast]` | Run gate — `0` pass, `1` fail (only in CI) · `--tag` filters to `tags: [TAG]` tests |
| `crilio validate [-c FILE] [--json]` | Validate config without API calls — `0` valid, `2` invalid |
| `crilio --version` / `crilio --docs` | Version / full interactive guide |
| Variable | Description |
|---|---|
| `OPENAI_API_KEY` | OpenAI — default target `gpt-4o-mini`, judge `gpt-4o-mini` |
| `ANTHROPIC_API_KEY` | Anthropic — default target `claude-3-5-sonnet-latest`, judge `claude-3-5-haiku-latest` |
Provider is inferred from env if not set in `crilio.yaml`. Keys are **never** flags — env only.