---
title: "Automate Code Reviews with a Durable Eve.dev GitHub Agent"
description: "Learn how to build an autonomous AI code reviewer using Eve.dev that listens to GitHub webhooks, analyzes pull requests, and posts detailed inline comments."
image: "https://foundrysoft.co/api/og?type=article&title=Automate+Code+Reviews+with+a+Durable+Eve.dev+GitHub+Agent&cat=Tutorial+%2F%2F+CI-CD&rt=14+min+read&au=Varun+Raj+Manoharan&dt=2026-07-15"
url: "https://foundrysoft.co/blog/eve-dev-github-code-review-agent"
---

Tutorial // CI-CD 2026-07-15 14 min read

# Automate Code Reviews with a Durable Eve.dev GitHub Agent

Learn how to build an autonomous AI code reviewer using Eve.dev that listens to GitHub webhooks, analyzes pull requests, and posts detailed inline comments.

![Varun Raj Manoharan](https://foundrysoft.co/images/about/founder.webp)

Varun Raj Manoharan

Eve.dev GitHub Automated Code Review CI/CD TypeScript

## Summary

**TL;DR:** Reviewing massive Pull Requests takes hours. In this guide, we use Eve.dev to build a durable GitHub agent that clones repositories, reviews code line-by-line, and posts inline comments automatically.

AI coding assistants like GitHub Copilot are great for writing code, but what about reviewing it?

Building an automated Pull Request (PR) reviewer requires an agent that can handle long, complex tasks. A large PR might contain 50 files. Analyzing this takes time, multiple LLM tool calls, and robust error handling. If your Vercel serverless function times out after 10 seconds, your code reviewer dies halfway through.

**Eve.dev** provides the perfect infrastructure for this. Its durable execution model allows the agent to run for as long as it needs, even hours, without worrying about server timeouts or memory leaks.

### Designing the Code Review Agent

We'll structure our Eve.dev workspace specifically for GitHub operations:

TEXT

Copy

```text
/eve
  /agents
    /reviewer
      instructions.md
      /tools
        get_pr_diff.ts
        post_inline_comment.ts
```

### Step 1: The Agent Instructions

The instructions define the "personality" of our senior engineer agent. In `/eve/agents/reviewer/instructions.md`:

MARKDOWN

Copy

```markdown
# Senior Code Reviewer

You are a strict but helpful senior software engineer. Your job is to review GitHub Pull Requests.

## Review Guidelines
1. Look for security vulnerabilities, memory leaks, and performance bottlenecks.
2. Ignore formatting issues (we have Prettier for that).
3. If you find a bug, use the `post_inline_comment` tool to comment exactly on the line where the issue exists. Provide a code snippet fixing the issue.
4. Be concise. Do not nitpick.
```

### Step 2: Extracting the Diff

The agent needs a way to read the code changes. We create `/eve/agents/reviewer/tools/get_pr_diff.ts`:

TypeScript

Copy

```typescript
import { tool } from '@eve/core';
import { z } from 'zod';
import { Octokit } from 'octokit';

const octokit = new Octokit({ auth: process.env.GITHUB_TOKEN });

export default tool({
  name: 'get_pr_diff',
  description: 'Fetches the file differences for a specific Pull Request.',
  schema: z.object({
    owner: z.string(),
    repo: z.string(),
    pull_number: z.number()
  }),
  execute: async ({ owner, repo, pull_number }) => {
    const { data } = await octokit.rest.pulls.listFiles({
      owner,
      repo,
      pull_number,
    });

    // Format the diff nicely for the LLM
    const formattedDiff = data.map(file => `
File: ${file.filename}
Status: ${file.status}
Patch:
${file.patch}
    `).join('\n\n');

    return formattedDiff;
  }
});
```

### Step 3: Posting Feedback

Next, we give the agent the ability to write comments directly onto the PR. Create `/eve/agents/reviewer/tools/post_inline_comment.ts`:

TypeScript

Copy

```typescript
import { tool } from '@eve/core';
import { z } from 'zod';
import { Octokit } from 'octokit';

const octokit = new Octokit({ auth: process.env.GITHUB_TOKEN });

export default tool({
  name: 'post_inline_comment',
  description: 'Posts a comment on a specific line of code in the Pull Request.',
  schema: z.object({
    owner: z.string(),
    repo: z.string(),
    pull_number: z.number(),
    commit_id: z.string(),
    path: z.string(),
    line: z.number(),
    body: z.string()
  }),
  execute: async (params) => {
    await octokit.rest.pulls.createReviewComment({
      owner: params.owner,
      repo: params.repo,
      pull_number: params.pull_number,
      commit_id: params.commit_id,
      path: params.path,
      line: params.line,
      body: params.body
    });
    return { success: true };
  }
});
```

### Step 4: Webhook Integration

Now, how do we trigger this agent? We set up a GitHub Webhook that calls our Next.js API route whenever a PR is opened.

Because Eve.dev agents are durable, we can acknowledge the webhook immediately (preventing GitHub from timing out) while the agent does its work in the background.

TypeScript

Copy

```typescript
// app/api/webhook/github/route.ts
import { Eve } from '@eve/core';
import { NextResponse } from 'next/server';

const eve = new Eve({ workspace: './eve' });

export async function POST(req: Request) {
  const payload = await req.json();

  // Only trigger on PR opened or synchronized (updated)
  if (payload.action === 'opened' || payload.action === 'synchronize') {
    const pr = payload.pull_request;
    const repo = payload.repository;

    const agent = await eve.getAgent('reviewer');

    // We start the agent workflow asynchronously.
    // Even if this takes 10 minutes, Eve.dev manages the state securely.
    agent.run({
      id: `pr_review_${pr.id}_${pr.head.sha}`, // Unique ID for durability
      input: `Please review PR #${pr.number} in ${repo.owner.login}/${repo.name}. The latest commit is ${pr.head.sha}.`
    });
  }

  // Immediately return 200 OK to GitHub
  return NextResponse.json({ received: true });
}
```

### Conclusion

By combining GitHub webhooks with Eve.dev's durable architecture, you can build powerful CI/CD agents. The LLM can take its time analyzing complex diffs, formulating suggestions, and making multiple API calls to post comments, all without you worrying about serverless timeouts or fragile state management.

### FAQ

**Why do serverless timeouts matter for AI Code Review?** LLMs are slow. Reviewing a large PR might require reading 10 files and generating 5 different comments. This can easily take 3-5 minutes, which will crash standard Vercel or AWS Lambda functions. Eve.dev's checkpointing allows the process to run durably across multiple invocations if necessary.

**How does the agent know which line to comment on?** We feed the git `patch` (the diff) to the LLM. Modern models (like GPT-4o or Claude 3.5 Sonnet) are excellent at understanding diff syntax and can accurately identify the line numbers where vulnerabilities exist, which they then pass to the `post_inline_comment` tool.

#### Related reading

[MCP Went Stateless: Migrating Your Server to the 2026-07-28 Spec

The 2026-07-28 MCP revision removes sessions, the initialize handshake, and server-initiated requests. Here's what actually breaks in your server, the new wire format, the requestState and MRTR patterns that replace sessions, and the SDK v2 migration path.

MCP Model Context Protocol AI Agents

](https://foundrysoft.co/blog/mcp-stateless-spec-migration)[How to Use Stacked Pull Requests on GitHub

GitHub shipped native stacked pull requests into public preview on July 30, 2026. Here's how the gh stack workflow actually works, where stacking pays off, how to pick layer boundaries, and when a stack is the wrong tool.

GitHub Developer Tools Code Review

](https://foundrysoft.co/blog/stacked-pull-requests-github-guide)[We Open-Sourced an AI Agent for Coverage Citations: And Broke It Twice

agent-for-insurance is an open-source drafting aid that will not state a coverage conclusion without citing your policy's own text. Here's how it works, and the two parsing bugs that taught us why that rule has to be enforced in code, not prose.

Open Source AI Agents Insurance

](https://foundrysoft.co/blog/open-source-ai-agent-insurance-coverage-citations)

#### Next Article

[

Automating Employee Onboarding with an Eve.dev HR Agent

](https://foundrysoft.co/blog/eve-dev-hr-onboarding-agent)

Available for new projects

## Let's build something great.

Have a project in mind? We are an elite software and AI development studio ready to bring your ideas to production. Let's talk about your roadmap.

Start a Project [See our work](https://foundrysoft.co/work)

```json
{
  "@context": "https://schema.org",
  "@type": "Organization",
  "name": "FoundrySoft",
  "url": "https://foundrysoft.co",
  "logo": "https://foundrysoft.co/logo.svg",
  "description": "FoundrySoft builds production-grade software and AI systems for US companies, from an India-based team of senior engineers.",
  "sameAs": [
    "https://github.com/foundrysofthq",
    "https://www.linkedin.com/company/foundrysoft",
    "https://www.instagram.com/foundrysoft/"
  ]
}
```

```json
{
  "@context": "https://schema.org",
  "@type": "WebSite",
  "name": "FoundrySoft",
  "url": "https://foundrysoft.co"
}
```

```json
{
  "@context": "https://schema.org",
  "@type": "TechArticle",
  "headline": "Automate Code Reviews with a Durable Eve.dev GitHub Agent",
  "description": "Learn how to build an autonomous AI code reviewer using Eve.dev that listens to GitHub webhooks, analyzes pull requests, and posts detailed inline comments.",
  "url": "https://foundrysoft.co/blog/eve-dev-github-code-review-agent",
  "mainEntityOfPage": "https://foundrysoft.co/blog/eve-dev-github-code-review-agent",
  "image": [
    "https://foundrysoft.co/images/blog/multi-agent-swarm.jpg"
  ],
  "datePublished": "2026-07-15",
  "dateModified": "2026-07-15",
  "keywords": "Eve.dev, GitHub, Automated Code Review, CI/CD, TypeScript",
  "author": {
    "@type": "Person",
    "name": "Varun Raj Manoharan"
  },
  "publisher": {
    "@type": "Organization",
    "name": "FoundrySoft",
    "logo": {
      "@type": "ImageObject",
      "url": "https://foundrysoft.co/logo.svg"
    }
  }
}
```

```json
{
  "@context": "https://schema.org",
  "@type": "BreadcrumbList",
  "itemListElement": [
    {
      "@type": "ListItem",
      "position": 1,
      "name": "Home",
      "item": "https://foundrysoft.co/"
    },
    {
      "@type": "ListItem",
      "position": 2,
      "name": "Blog",
      "item": "https://foundrysoft.co/blog"
    },
    {
      "@type": "ListItem",
      "position": 3,
      "name": "Automate Code Reviews with a Durable Eve.dev GitHub Agent",
      "item": "https://foundrysoft.co/blog/eve-dev-github-code-review-agent"
    }
  ]
}
```
