GitHub Actions workflow
The workflow triggers on pull request events and runs a review script.E2B_API_KEY and the LLM API key are stored as GitHub Actions secrets, while the built-in GITHUB_TOKEN is available automatically. The permissions block grants write access so the script can post PR comments.
Review script
The workflow calls this script on every PR. It runs five steps inside an E2B sandbox, keeping all untrusted code isolated from the CI runner.- Create sandbox —
Sandbox.create()creates an isolated Linux environment for the review - Clone the PR —
sandbox.git.clone()checks out the PR branch usingx-access-token+GITHUB_TOKENfor authentication - AI review — runs
git diffinside the sandbox, sends the output to an LLM — swap the model for any provider via Connect LLMs - Run tests —
commands.run()streams output in real time and throws on failure (CommandExitError/CommandExitException) - Post results — comments the review on the PR via the GitHub REST API, then shuts down the sandbox
Related guides
Git integration
Clone repos, manage branches, and push changes from sandboxes
Connect LLMs
Integrate AI models with sandboxes using tool calling
Custom templates
Build reproducible sandbox environments for your pipelines