Review a pull request in CI

Run eVi headless in a pipeline and fail the build on real findings — either with the built-in reviewer or your own agent.

Uses: CLI + Python SDK · You'll need: eVi installed in the CI job and a model backend it can reach (a local server on the runner, or an OpenAI-compatible endpoint via evi backend add).

Option A — the built-in reviewer

evi review diffs your changes, has a model review them, and can turn the verdict into an exit code. That is all you need for a gate:

# Fail the job if the review verdict is FAIL. --multi runs several lenses.
evi review --multi --exit-code

Useful flags:

A drop-in GitHub Actions workflow is in examples/github/pr-review.yml.

Option B — your own agent, headless

When you want custom logic — post the summary as a PR comment, gate on a specific check — drive an agent yourself. run_headless returns a structured result and to_json serialises it; set the exit code from result.error:

from evi.sdk import build_agent, run_headless, to_json

# Scope the agent to read-only fs + code tools for an unattended run.
agent = build_agent(tool_categories=["fs", "code"])
result = run_headless(agent, "Does this diff introduce any obvious bug? Answer with findings.", max_turns=8)

print(to_json(result))          # {"text", "tools", "usage", "error"}
raise SystemExit(1 if result.error else 0)

Runnable version: examples/python/headless_ci.py

python examples/python/headless_ci.py "Does this repo have a README? Answer yes/no."

Keeping CI runs safe and cheap

Where to go next

Edit on GitHub ↗