Skip to main content

Use case

Agent-driven code review. Clone a repo, lint it, let the agent propose fixes via the apply_patch tool, summarize findings. The review never runs on your laptop — the clone, the linter, and the diff all live in a throwaway VM.

Template

ai-agent — large template with common agent-framework deps pre-installed (langchain, crewai, autogen, plus git/python tooling). Good choice when the agent needs to run Python code with a rich set of imports without a pip install delay.

Run it

Security policy

Injection defense matters because an adversarial README.md could try to override the reviewer’s system prompt. The scanner runs on the request body before the LLM call — the agent code doesn’t have to implement any defense itself.

Env isolation in practice

The agent reads these with printenv rather than having them in the system prompt. This means:
  • No secret values in model traces or guardrails logs.
  • Rotating a value doesn’t need a prompt change.
  • Per-reviewer customization (depth, id) stays structured.

What the agent does

  1. printenv REVIEWER_ID REVIEW_DEPTH TARGET_REPO
  2. git clone --depth 1 $TARGET_REPO /workspace/repo
  3. pip install -q ruff
  4. ruff check /workspace/repo
  5. ruff check --fix /workspace/repo && git -C /workspace/repo diff
  6. Write /workspace/review.md with sections for metadata, findings, auto-fixes, and remaining action items.

Expected output

Full source

See cookbook/examples/openai-agents-code-reviewer/main.py in the repo.