Daksh Gupta on Building a Better AI Code Review Agent

Greptile co-founder Daksh Gupta explains why a webhook plus a coding agent is not enough for reliable pull-request review—and how targeted prompts, incident data, model inversion, codebase context, browser testing, and task-specific model routing can help.

DGDaksh GuptaSpeaker · Greptile
Channel
AI Engineer
Published
Oct 26, 2026
Video
18:27
Read
9 min
Slides
8
Original
English
Open on YouTube
Scroll to read and the video shrinks to the bottom-right corner. Captions follow your reading language.
Reading languageAvailable in 2 languages
You're reading the original English.
SUMMARY

In 30 seconds

Daksh Gupta, co-founder of Greptile, describes what the company recommends when a team has unusually specialized needs and wants to build its own AI code-review agent. A simple sandbox, coding agent, and pull-request webhook can return comments within minutes, but it can miss bugs and context, cost several dollars per review, and overwhelm developers with nitpicks. Gupta’s improvements are to target known bug classes in the prompt, evaluate against historical incident pull requests, use a different model to review AI-written code, build precise codebase context, give agents access to product docs and tickets, test changes in a running application, and route subtasks to smaller models. He argues that a useful system needs ongoing data and validation, because bugs and the models that introduce them keep changing.

  1. 1Start with the needs a general review product cannot handleGupta says Greptile helps companies with unusually specialized code-review needs build internal tools. His advice draws on the product’s experience with codebase context, running code in sandboxes, and assigning inference to the right model for each step.
  2. 2A sandbox and webhook are only a first draftA basic system sends each new pull request to an agent in a sandbox, then posts the agent’s comments through GitHub’s review API. It is easy to assemble, but misses bugs and context, can cost $3–$25 per pull request, and often produces too many low-value comments.
  3. 3Tune prompts around real bugs and suppress nitpicksAsk the agent to look for bug classes that have caused incidents in the company, and define which comments count as nitpicks. This focuses the reviewer on the risks that matter instead of broad, hard-to-calibrate feedback.
  4. 4Measure reviews against historical incident pull requestsCollect past pull requests that caused outages or incidents and run each new reviewer against them. This provides evidence for prompt changes, though the test set must keep growing as code agents introduce unfamiliar mistakes.
  5. 5Review generated code with a different model familyGupta says Claude and GPT models tend to produce different kinds of bugs, so a reviewer from another family may catch problems the author model shares. Greptile observed a 10% higher catch rate when flipping models, according to his talk.
  6. 6Build precise context from the codebase and product knowledgeA knowledge base can map components, authentication flows, and the files involved, making it easier to detect issues such as an authorization bypass. Gupta also recommends bringing in docs and tickets, or maintaining a living wiki that combines code, telemetry, logs, and roadmap context.
  7. 7Test the running product and route each task to a suitable modelA dependency-rich sandbox, a runnable build, and documented user flows let an agent test a pull request in a browser and catch visual failures such as a hidden mobile button. Small models can gather context or test flows, while frontier models handle higher-stakes bug analysis and review decisions.

Takeaways

  1. Use review prompts to search for bug classes your product has actually experienced, and explicitly filter out stylistic nitpicks.
  2. Keep a growing set of pull requests tied to incidents so new review-agent versions can be measured against known bugs.
  3. When possible, review AI-generated code with a different model family to catch failure patterns the author model may share.
  4. Give the reviewer indexed codebase knowledge, product documentation, and tickets so it can reason about intent and existing system behavior.
  5. Run changed code in a dependency-complete sandbox and use computer vision to test real user flows, including mobile layouts.
  6. Reserve stronger models for consequential decisions and use smaller, cheaper models for context gathering and simpler subtasks.
FULL TEXT

Read the edited text by chapter

Transcript only
01

What makes Greptile’s review agent useful

Daksh Gupta introduces Greptile and its work reviewing and testing pull requests across many kinds of codebases. He frames the talk as practical advice for teams deciding whether to build their own review agent or evaluate one.

I’m Daksh Gupta, co-founder of Greptile. We build agents that review and test pull requests with the full context of a codebase, looking for bugs, logic errors, and code-quality issues—especially in AI-generated code. Thousands of companies use Greptile, and Gupta says roughly 1% of GitHub pull requests pass through the service.

Some companies have needs so specialized that building an internal reviewer makes more sense. Greptile helps those teams because it has learned how to review codebases, run applications in sandboxes, and allocate inference efficiently. Gupta will explain that approach for teams that want to build a reviewer or understand what makes one good.

02

The three ingredients of a strong review agent

Gupta highlights codebase context, running the application in a sandbox, and allocating inference to the right model for each task. These capabilities underpin both bug finding and end-to-end testing.

Gupta groups the product’s strengths into three areas. First is codebase context: Greptile began by teaching early language models to understand large repositories and built strong indexing capabilities. Second, it starts a customer’s stack in a dependency-rich sandbox and uses computer interaction to exercise the application and API endpoints.

The third ingredient is allocating inference carefully: choosing the model and inference budget that fit each review and validation task. Gupta says that combination can deliver more performance per dollar than an internal tool or competing product.

A team may want to build its own reviewer, or it may be choosing a review or testing product and trying to distinguish an adequate one from a great one. Gupta turns to the simplest possible design to show where it falls short.

Imagine you are on a platform team—or the person most eager to bring AI into the engineering workflow—and code is arriving faster than people can validate it. Engineers and even marketing teams are vibe-coding, creating a review bottleneck. The first step is to get a sandbox, either from a provider or from a tool such as Firecracker.

03

The simple webhook-and-agent setup

A team can put an agent in a sandbox, send it pull-request contents through a webhook, and post its feedback with GitHub’s review API. This basic loop is quick to build, but leaves major quality problems unsolved.

Put an agent in that sandbox, connect GitHub or GitLab, and use a pull-request webhook to send it each new change. Give the agent a simple instruction to review the pull request, then return its comments through GitHub’s review API. In principle, that is enough to produce feedback about five minutes after a pull request opens.

The trouble starts when teams rely on that bare-bones loop. First, it will miss bugs. Bugs can arise in many interacting ways, and a reviewer must at least catch the ones that could lead to serious outages or incidents.

04

What goes wrong with a naive reviewer

A basic agent misses bugs and codebase context, can cost $3–$25 per pull request, and tends to leave technically correct but distracting nitpicks. Repeated runs may find new issues each time, while coding agents can blindly apply every comment.

Second, the agent may not understand how the codebase fits together, what direction the team is taking, or how a particular library works. In a company with thousands of repositories, a reviewer may need context from many of them to assess a change correctly.

Third, the cost can surprise teams: Gupta says companies have reported spending between $3 and $25 per pull request on coding-agent review. Token use accumulates quickly, and the expense can grow quietly.

Fourth, the agent may leave nitpicky comments: technically correct observations that are overly pedantic. Developers then have to sift through a flood of minor style complaints to find the serious issues. Worse, coding agents may obediently address every comment, turning a codebase into defensive, awkward code.

Repeatedly running the reviewer on the same pull request may surface a fresh set of bugs each time. That makes it difficult to tell when the review is complete and reinforces the need to focus the system on useful findings.

05

Fix 1: Focus the prompt

The prompt should target bug types that have caused incidents in the company and explicitly exclude nitpicks. Small prompt changes can shift the number of findings substantially, so prompt tuning needs evidence.

The easiest improvement is to make the prompt more specific. Instead of asking only for a review in GitHub’s comment format, direct the agent toward bug classes that matter to the company and tell it to skip nitpicks. Teams can study previous outages and incidents to identify the mistakes their codebase is most likely to produce.

The prompt should define nitpicks explicitly, such as demands for extra layers of defense without a concrete risk or complaints about a slightly imperfect error-handling style. Even a small prompt change can greatly alter the number of comments, which makes it hard to know whether the agent has actually improved.

A reviewer can show that it found a bug, but it cannot prove that no bugs remain. This is especially difficult when serious failures are rare: Gupta estimates that only about one in a thousand pull requests—or, he rephrases, perhaps one in a thousand lines of code—contains a catastrophic bug. An agent may miss one and appear successful for a long time.

06

Fix 2: Build a historical PR evaluation set

Use pull requests linked to previous incidents as a regression set for the reviewer. Because catastrophic bugs are rare and new coding-agent failure modes emerge, the dataset needs to be refreshed over time.

The second improvement is a dataset of historical pull requests. If the company records outages and incidents, collect the pull requests that caused them and run each new version of the reviewer against those examples. That gives the team a clearer basis for tuning prompts and measuring whether the agent catches known failures.

The dataset needs regular updates because the patterns and kinds of bugs change. Many bugs repeat earlier mistakes, but increasingly capable coding agents also make novel errors. Without millions of pull requests, a company may struggle to cover every bug type; Greptile’s broader cross-company corpus gives it a larger evaluation set, while internal teams can still make useful progress with their own data.

07

Fix 3: Invert the author and reviewer models

Different model families can have different error patterns, so using one model to review another model’s code may catch additional bugs. Gupta describes ways to infer which coding model authored a pull request and reports a 10% higher catch rate when models are flipped.

The third improvement is model inversion: use a different model family to review the code than the one that wrote it. Gupta’s research suggests Claude models are more prone to one-off errors, while GPT models are more likely to introduce authorization bypasses. These differences can reflect how each family was post-trained.

If the same model writes and reviews a change, it may repeat the same blind spots. So, if Claude Code authored the code, try a GPT model for review, and vice versa. Identifying the author model is straightforward much of the time: Codex may leave a codex/ branch name, while Claude may appear in co-author metadata or the pull-request description.

The remaining cases are harder to classify, so teams may need heuristics, an internal record of which coding agents engineers use, or telemetry from developer machines. Gupta says Greptile observed a 10% higher bug-catch rate when models were flipped. He argues that even a seemingly small increase matters when the failures in question can cause incidents or outages.

08

Fix 4: Give the agent codebase context

Broad grep-based exploration can be imprecise and expensive. An indexed knowledge base that describes components, flows, and relevant files can supply more focused context, including for difficult authorization checks.

The fourth improvement is better codebase context, an area Gupta says Greptile worked on before code validation. He argues that plain grep is both imprecise and costly: coding agents can spend a large share of their tokens searching files, reading them, and caching their contents, even when much of that information is irrelevant.

A more targeted method is to build an internal knowledge base that catalogs the system and indexes its components. For authentication, for example, it can explain how the flows work, diagram them, and list the files involved. That context matters when judging an authorization bypass, because the reviewer must know whether the code is already running inside an authenticated boundary.

09

Bring in tickets, docs, and a living wiki

Correct code can still miss the author’s intent when the request is ambiguous. Tickets, documentation, production telemetry, and logs can be combined into a living wiki that helps an agent understand how the product works and search the code more precisely.

Code can also be poor even when it has no obvious bug: it may fail to meet what the author intended. Gupta jokes that people increasingly use Slack as an IDE, but a short message asking an agent to fix something often leaves substantial ambiguity. The code can pass a narrow correctness check and still solve the wrong problem.

Give the agent more context to close that gap. Gupta highlights product documentation and tickets alongside the indexed codebase. Access to Jira or Linear, plus Confluence, Notion, or another documentation store, can supply the tribal knowledge that engineers use without realizing how much it shapes their decisions.

Greptile combines these sources into a living wiki—a changing model of how a company works. It can bring together codebase knowledge, application behavior from production telemetry and logs, and roadmap information from documentation and Linear tickets. The reviewer can use this context while also searching the code more precisely.

10

Fix 5: Test changes in a running application

For reliable end-to-end testing, the agent needs a dependency-rich sandbox, a build process that can start the application, and a map of important user flows. Vision models can then inspect the rendered interface and catch problems a code-only review misses.

The fifth improvement is autonomous testing. A reviewer may inspect React changes and see no obvious issue, yet the rendered interface could hide a button on an iPhone. Greptile addresses this with configurable virtual machines that contain the application’s dependencies and can run a customer’s stack.

The agent then uses computer vision to test the application from end to end. Gupta says newer GPT and Opus models have made vision much stronger, bringing end-to-end quality assurance closer to practical use. Teams still need to document the important flows and make the build process simple enough for an agent to start the stack.

A useful setup needs a development box, the pull-request branch and its dependencies running in the app, plus a flow map—for example, which code handles authentication and how sign-in works. With that map, a browser agent can notice that a button technically renders but is hidden on an iPhone or falls below the initial screen.

11

Fix 6: Use cheaper models for simpler subtasks

Frontier models handle a minority of the most critical steps, while smaller models can gather context and test flows. Routing must still be measured against a large bug dataset so savings do not quietly lower the reviewer’s catch rate.

Even with all these capabilities, one review can still cost around $3 to $20. Gupta’s sixth improvement is to use cheaper models for some subtasks. He says frontier models remain stronger overall, but his team reserves them for the most critical work—about 20% of its model usage—while smaller models handle exploratory work and file reads.

For example, a small model can gather relevant context, a lightweight computer-use model can test user flows, and a frontier model can analyze bugs and make the final review decisions. Greptile uses a carefully assigned model for each of roughly 20 subtasks, with a research team continually testing which model fits each job.

Gupta estimates teams may get 70–80% of the way to a strong system by swapping simple tasks to simple models. But a large evaluation dataset remains important: without it, a cheaper subagent could quietly make the reviewer worse at finding bugs, and the team might only notice after an incident.

A cheaper model can also filter the available context and decide which pieces are worth loading, reducing wasteful file reads. In theory, a decision model or API could rank context before it enters the frontier model’s cache, which Gupta describes as one of the system’s most costly and scarce resources.

With these improvements, teams can build a capable review agent. Gupta invites listeners to contact him at daksh@prod.com if they do, or to use Greptile instead. He closes by thanking the audience.

More from this channel

7 slides19:43EN
AI Engineer· Oct 26, 2026Jack Wotherspoon on Building a Team of Managed AgentsJack Wotherspoon · Google DeepMindGoogle DeepMind’s Jack Wotherspoon introduces Gemini Managed Agents: cloud sandboxes that let teams run coding and research agents with a single API call. He explains how persistent environments, reusable skills, proxy-injected credentials, schedules, and specialized agents fit together.Agent engineeringAgent orchestrationSandboxes & isolation+2
5 slides20:55EN
AI Engineer· Oct 26, 2026Jesse Hall: Build Voice Agents for Conversations, Not LeaderboardsJesse Hall · LiveKitLiveKit’s Jesse Hall explains how to evaluate voice agents as real-time systems: understand callers, handle interruptions, keep talking while tools run, and measure the delay people actually hear.Voice AIAgent engineeringEvals+2
12 slides17:56EN
AI Engineer· Oct 25, 2026How Bridgewater Keeps Its AI Analyst Inside Permission BoundariesNikhil Benesch, Aaron Linsky · turbopufferAaron Linsky and Nikhil Benesch explain why search over an enterprise vault must honor document permissions without sacrificing recall or speed. Their solution combines vector indexing with native filtering to search hundreds of millions of vectors in roughly 120 milliseconds.Enterprise AIPrivacy & data governanceSearch & retrieval+2
7 slides35:19EN
AI Engineer· Oct 25, 2026SallyAnn DeLucia: How to Write Your First AI EvalSallyAnn DeLucia · Arize AITurn an agent’s real traces into concrete pass/fail criteria, then build an LLM judge you can test, align with people, and run in production.Evals & observabilityEvalsAgent engineering+2
9 slides20:58EN
AI Engineer· Oct 25, 2026Vinoo Ganesh on Making Financial AI Cite Every NumberVinoo Ganesh · KeplerKepler CEO Vinoo Ganesh explains why financial AI should retrieve and cite figures while deterministic software handles the math. His design makes traceability, retrieval quality, and tenant security part of the answer itself.AI in financeEnterprise AIRetrieval-augmented generation+2
10 slides18:31EN
AI Engineer· Oct 25, 2026Janie Gu and Suyeol Yun: Why Frontier Models Fail as Buy-Side AnalystsJanie Gu, Suyeol Yun · Google DeepMindJanie Gu explains why benchmark scores can mislead, while Suyeol Yun presents MandateBench, which tests whether a model can turn a fund mandate into a defensible investment memo. The two talks show why real workflows, reproducible grading, and evidence-backed reasoning matter.AI in financeBenchmarksEvals+2