How to Build an AI Code Review Agent - Daksh Gupta, Greptile
Daksh Gupta explains how to build a review agent with incident-based evaluations, explicit bug targets, cross-model review, codebase and product context, sandbox testing, and task-specific model routing. Greptile's catch-rate and cost claims are vendor-reported; the talk does not establish that automated review can prove code safe.
Daksh Gupta, co-founder of Greptile, describes how to build an internal agent that reviews and tests pull requests. Connecting a coding agent to pull requests is the starting point. The harder work is measuring missed bugs, supplying the context needed to judge a change, testing the running application, and lowering model costs without missing more bugs.
This summary is based on the English auto-generated captions. Greptile's performance figures and product comparisons are Gupta's reports, not independently validated results.
Key points
- Start with a basic pull-request reviewer. Run a coding agent in a sandbox. When a pull request opens, a GitHub or GitLab webhook sends its contents to the agent; the integration then posts its findings as review comments. Gupta recommends an agent harness that supports different model providers, so later stages can choose models independently. This setup can still miss bugs, misunderstand the codebase, cost too much, and raise new findings each time it reviews the same change. 02:36–06:15(opens in a new tab)
- Target recurring bugs and define which comments to omit. Use past incidents to identify bug types, then explicitly ask the reviewer to look for them. Define unwanted nitpicks too. Minor style complaints and requests for unnecessary defensive checks make important findings harder to spot. A coding agent that implements every comment can also make the code unnecessarily defensive. 04:21–07:06(opens in a new tab)
- Test reviewer changes against past incidents. Collect pull requests that caused known incidents. Run each version of the reviewer against them and measure how often it identifies the bugs responsible. Use this check when tuning prompts: fewer comments do not necessarily mean a better review. Update the dataset as new failure patterns emerge. A quiet review does not prove the code is bug-free, and a small internal dataset may not cover rare or new kinds of bugs. 06:15–09:02(opens in a new tab)
- Try a different model family for review. Gupta calls this "model inversion": review Claude-generated code with a GPT model, or vice versa. His rationale is that a model can overlook the same kinds of bugs when reviewing code that it makes when writing code. He reports a 10% higher catch rate, but provides too little evaluation detail to generalize that figure. Branch names and co-author markers can help identify the generating agent, but manually named branches and mixed workflows make that inference unreliable. 09:02–11:47(opens in a new tab)
- Explain how the application works. Gupta argues that repeated text searches and file reads can use many tokens without establishing how components fit together. Greptile's knowledge base catalogs components, their flows, and the files involved. For example, deciding whether a change allows an authentication bypass requires knowing whether that execution path already requires authentication, not just reading the changed lines. 10:43–12:36(opens in a new tab)
- Explain what the change should accomplish. Code can work as written yet fail to meet the intended requirement. A brief instruction may omit information a developer would know from tickets or documentation. Gupta recommends providing those sources alongside codebase context. Greptile combines them with logs and production telemetry in a living wiki that supplies context and helps select relevant files. Gupta claims this avoids unnecessary file reads, but the talk does not demonstrate that claim. 12:36–14:26(opens in a new tab)
- Run the application to catch failures source review misses. A UI change can look correct in code yet leave a button hidden on a phone. Gupta describes running the pull-request branch in a virtual machine with the dependencies needed to start the application, then using vision-based agents to test documented user flows. This requires a reliable way to start the stack and a map of the flows to test. He identifies environment setup as a difficult part of the work; his claim that end-to-end QA is nearly solved is an opinion. 14:26–16:14(opens in a new tab)
- Use cheaper models for simpler tasks, then check for missed bugs. Gupta describes using smaller models to select relevant context and explore files, while reserving more capable models for bug analysis and review. Greptile divides the work into roughly 20 subtasks with different model choices. Evaluate detection when changing models: lower costs can hide worse results, and a missed bug may expose the regression only when it causes an incident. 16:14–17:58(opens in a new tab)
Full video: https://www.youtube.com/watch?v=4UtrRVtUN_g(opens in a new tab)