---
title: 'This C# Agent Reviews My PRs While I Sleep (Microsoft Foundry)'
source: 'https://youtube.com/watch?v=-9SzGRbaS_E'
video_id: '-9SzGRbaS_E'
date: 2026-08-08
duration_sec: 179
---

# This C# Agent Reviews My PRs While I Sleep (Microsoft Foundry)

> Source: [This C# Agent Reviews My PRs While I Sleep (Microsoft Foundry)](https://youtube.com/watch?v=-9SzGRbaS_E)

## Summary

This video demonstrates how to build a pull request review agent using C# and Microsoft Foundry, an agentic platform as a service. The agent uses a GPT-5.4 mini model and the GitHub MCP (Model Context Protocol) to read and write reviews on pull requests directly from VS Code.

### Key Points

- **What is Microsoft Foundry?** [00:43] — Microsoft Foundry is an agentic platform as a service that simplifies integrating AI agents into C# applications.
- **Foundry Toolkit for VS Code** [00:30] — The Foundry Toolkit for VS Code extension allows building AI agents directly from VS Code, providing access to projects and model deployment.
- **Model Access** [00:16] — Foundry gives access to over 11,000 models, including frontier models like GPT-5.4 mini.
- **GitHub MCP Integration** [01:12] — The agent is given access to the GitHub MCP server, enabling it to read pull requests and write reviews.
- **Agent Loop and Production Considerations** [01:37] — The agent loop runs in the user's own code, meaning observability, governance, and compliance are the user's responsibility. For production, Foundry agent service provides a managed path.
- **Model Router for Cost Savings** [02:36] — The model router in Foundry can automatically route requests to the best-suited model, potentially saving up to 50% in costs.

## Transcript

probably been experimenting with integrating AI into your applications. And in today's video, I want to show you a practical example of how you can build a pull request review agent with some simple C# code and Microsoft Foundry.
Foundry gives you access to more than 11,000 models, and for starters, I'm going to use GPT-5.4 mini. Now, we need to get access to this model somehow, and we can do this without even leaving VS Code. We're going to see the Foundry
Toolkit for VS Code extension, which allows you to build with AI agents in Microsoft Foundry directly from your VS Code instance. Now, if you're not familiar, Microsoft Foundry is an agentic platform as a service that
solves many of the pain points of integrating agents into your C# applications. If I open the Foundry Toolkit, I can get access to my projects and even create new projects directly in Foundry. And I've got a PR Reviewer
project here. If I want to add more models, I can just deploy a new one. We have access to all of the latest frontier models. So, going back to our model that we want to use, which is going to give us an endpoint where we
can connect to our AI agent. And then the next step is what makes this example really powerful. I'm going to give it access to the GitHub MCP. This will allow my agent to use some of the available tools. And in this case, I'm
allowing it to read my pull requests and also write a pull request review. And finally, we can construct our request, and I'm telling it to review a specific pull request inside of one of my repositories. One important detail is
that here the agent loop runs in our own code. We're using Foundry models, but not Foundry agent service. So, observability, governance, and compliance are on us. For production, agent service gives you the managed path
to deploy, scale, monitor, and govern agents in Azure. And to actually run this, you can just use dotnet run. I send the environment variables and if I execute this, our agent connects to Foundry and then it's going to use the
GitHub MCP server to fetch the pull request info, look at the changed files, it's going to post it on my behalf inside of my actual repo. So, you can request and here's the review generated by our AI agent. And what makes all of
this so powerful, if I want to change a model, all I have to do is swap out the model that I'm using here, for example, GPT-5.4, and you can even leverage the model router that exists inside of Foundry, which is going to automatically
route the incoming request to the model that it thinks is best suited to satisfy the given request. This could give you cost savings upwards of 50% and this is important. So, if you want to get started, go ahead and install the
Microsoft Foundry toolkit in VS Code, create your first Foundry project, and deploy an AI model that you can use from your C# applications.
