Build Your First AI Agent in .NET
Two days building an agent that reasons, uses tools and holds a conversation, in your stack.
- Format
- 2-Day Intensive
- Duration
- 2 days
- Group size
- 15 to 40
- Level
- Intermediate
Companies are shipping agents that process invoices, answer support tickets and categorise information. Your team has probably been asked when they can do the same.
Over two days they build one. Not a chat box over an API, but an agent that reasons about data, calls tools and holds a conversation that goes somewhere.
The project is a personal finance assistant. You ask it questions, it finds transactions by meaning rather than exact match, it remembers what was said three turns ago, and it takes actions for you, asking first when they have consequences. Small enough to finish, real enough to be awkward in the places production is awkward.
We use Microsoft Foundry throughout, or your own OpenAI API key if you’d rather. The project switches between the two easily, and the patterns carry over to other providers.
The part most teams miss is what comes after the demo. Most of the second day is about that. Keeping long conversations under control, tracing what the agent does, confirming before it acts, and writing evaluations so a new prompt or a new model isn’t a leap of faith. Then the team rebuilds it on Microsoft Agent Framework, and sees where a framework earns its place and where the code they already wrote is enough.
What your team leaves with.
Outcomes · 5- A working agent in C# and .NET, built by the team, not demoed at them
- An MCP server they built themselves, running in Claude Desktop, VS Code or another MCP client
- Evaluations that check the agent still behaves when a prompt, a tool or the model changes
- A feel for the pieces behind tools like Codex, Copilot and Claude
- A project the team can take home, change and use as the starting point for AI in your own applications
How the days run.
2 daysWorking with Large Language Models
Start at the metal. Talk to a model over raw HTTP, then refactor behind a clean abstraction the rest of the workshop builds on.
- How models actually respond, and what that means for your code
- How prompts and tokens work
- Raw API calls, no abstractions
- Refactoring to IChatClient, and swapping provider in one line
Tool calling
Give the agent hands. Let it read data and take actions, and find out what makes a tool a model can actually use.
- Structured outputs
- Defining tools the agent can call
- Writing tool descriptions the model understands
- Retrieving data, and handling tool failures safely
The agent loop
Close the loop. Watch it decide when to call a tool and iterate toward an answer, then let it remember what was said.
- How agents reason, plan and iterate
- Multi-step, multi-tool execution
- Iteration caps and guarding against runaway loops
- Keeping conversation history, so follow-up questions just work
Agentic RAG
Search by meaning. Let the agent find the transactions you meant, not just the ones that match the words you typed.
- Embeddings and semantic search
- Letting the agent decide when to search
- Finding transactions by meaning, not exact matches
Context management
Long conversations eventually become a problem. Decide what the model needs to see, and summarise the rest.
- Why agents forget, and why sending everything doesn't fix it
- Summarising older messages as the conversation grows
- Managing the context you send to the model
Trust, safety and production
Make it safe to ship. See what the agent is actually doing, defend against attacks, and confirm before it acts.
- Tracing what the agent does, and spotting why it fails
- Defending against prompt injection
- Confirming actions that could have consequences before they run
Evaluations
Change things without crossing your fingers. Write evaluations that tell you whether the agent still behaves the way you expect.
- Why unit tests alone don't cover an agent
- Writing evaluations for the agent's behaviour
- Changing prompts, tools or models and checking the result
MCP and frameworks
Get it out of the console. Build your own MCP server, then rebuild the agent on Microsoft Agent Framework.
- MCP fundamentals
- Building an MCP server and using it from Claude Desktop, VS Code or another client
- The same agent on Microsoft Agent Framework
- Where a framework helps, and where you may not need one
Who it's for.
Hands-on- Developers who build APIs in C# and want to move past a chat box
- Teams new to LLMs. Prompts and tokens are covered from the start
- Anyone who would rather learn by building than by watching slides
- Their usual IDE (Visual Studio 2026, if they use Visual Studio)
- .NET 10 SDK, Docker, Git and a GitHub account
- An Azure account or an OpenAI API key, with up to 5 euros of usage per person
Adapted to your team.
Before the dayWhat's above is the shape, not a script. We start with a 30-minute call about your codebase, your stack and what your team has already tried. The exercises get rebuilt around that, and anything that doesn't apply to you gets cut.
- The examples, moved into your domain
- The depth, tuned to the room
- The length, from 2 days to what your calendar allows
Questions we get.
FAQ · 6Do we need to be on Azure for this?
No. We use Microsoft Foundry on the day, and anyone who'd rather can bring their own OpenAI API key. The workshop project makes it easy to switch between the two, and the code is built on IChatClient, so it isn't tied to either. What your team leaves with is the pattern, not the vendor.
How much AI experience does the team need?
Less than you might think. It's pitched at intermediate because it assumes your developers are comfortable building APIs in C#. The AI side starts from a raw HTTP call, with prompts and tokens explained before any abstraction shows up. Nobody needs to have built an agent before. That's the point of the two days.
What does it cost to run, on top of the workshop?
Up to 5 euros of usage per person, on their own Azure account or OpenAI API key. Everything else your team most likely already has. Their usual IDE, the .NET 10 SDK, Docker, Git and a GitHub account.
We are not sure we should be building an agent at all. Is this still worth it?
Probably more worth it. The agent is built up from a single HTTP call, so your team sees every piece and what it costs before a framework hides it. Day two ends by rebuilding it on Microsoft Agent Framework, to see where a framework helps and where you may not need one. A team that leaves having decided not to build one has still got its money back.
Is 40 people too many for a hands-on workshop?
Forty is the ceiling, and it does change the day. Above about 25 the exercises run in pairs with more structure and less over-the-shoulder time. If your team is near the top of that range, say so on the call and we will talk about splitting it.
Can it be run remotely?
Yes, on site or remote. It is a build-along, so remote works as long as everyone has their environment ready before day one starts. The setup steps go out ahead of time.
Who runs it.
In the roomGui Ferreira facilitates start to finish. He's been writing software since 2006 and is a Microsoft MVP. There's no junior trainer and no handover.
guiferreira.meThe other workshops.
Catalogue · 3Claude Code: Ready to Merge
Two hands-on days, from your first prompt to a pull request your team trusts.
03Designing Tests That Survive Refactorings
Half a day on why the test suite breaks every time someone refactors, and what to do instead.
04Mastering Test-Driven Development in C#
Two hands-on days turning TDD from a thing the team has read about into a thing the team does.
Request this workshop.
10 questions, 3 optionalTell us about the team who'd be in the room. We read every one of these. If it's a good fit, we'll set up a 30-minute call and send a proposal within 48 hours of it. If it isn't, we'll say so.