dotnet
41 TopicsFrom Demo to Production: Building Microsoft Foundry Hosted Agents with .NET
The Gap Between a Demo and a Production Agent Let's be honest. Getting an AI agent to work in a demo takes an afternoon. Getting it to work reliably in production, tested, containerised, deployed, observable, and maintainable by a team. is a different problem entirely. Most tutorials stop at the point where the agent prints a response in a terminal. They don't show you how to structure your code, cover your tools with tests, wire up CI, or deploy to a managed runtime with a proper lifecycle. That gap between prototype and production is where developer teams lose weeks. Microsoft Foundry Hosted Agents close that gap with a managed container runtime for your own custom agent code. And the Hosted Agents Workshop for .NET gives you a complete, copy-paste-friendly path through the entire journey. from local run to deployed agent to chat UI, in six structured labs using .NET 10. This post walks you through what the workshop delivers, what you will build, and why the patterns it teaches matter far beyond the workshop itself. What Is a Microsoft Foundry Hosted Agent? Microsoft Foundry supports two distinct agent types, and understanding the difference is the first decision you will make as an agent developer. Prompt agents are lightweight agents backed by a model deployment and a system prompt. No custom code required. Ideal for simple Q&A, summarisation, or chat scenarios where the model's built-in reasoning is sufficient. Hosted agents are container-based agents that run your own code .NET, Python, or any framework you choose inside Foundry's managed runtime. You control the logic, the tools, the data access, and the orchestration. When your scenario requires custom tool integrations, deterministic business logic, multi-step workflow orchestration, or private API access, a hosted agent is the right choice. The Foundry runtime handles the managed infrastructure; you own the code. For the official deployment reference, see Deploy a hosted agent to Foundry Agent Service on Microsoft Learn. What the Workshop Delivers The Hosted Agents Workshop for .NET is a beginner-friendly, hands-on workshop that takes you through the full development and deployment path for a real hosted agent. It is structured around a concrete scenario: a Hosted Agent Readiness Coach that helps delivery teams answer questions like: Should this use case start as a prompt agent or a hosted agent? What should a pilot launch checklist include? How should a team troubleshoot common early setup problems? The scenario is purposefully practical. It is not a toy chatbot. It is the kind of tool a real team would build and hand to other engineers, which means it needs to be testable, deployable, and extensible. The workshop covers: Local development and validation with .NET 10 Copilot-assisted coding with repo-specific instructions Deterministic tool implementation with xUnit test coverage CI pipeline validation with GitHub Actions Secure deployment to Azure Container Registry and Microsoft Foundry Chat UI integration using Blazor What You Will Build By the end of the workshop, you will have a code-based hosted agent that exposes an OpenAI Responses-compatible /responses endpoint on port 8088 . The agent is backed by three deterministic local tools, implemented in WorkshopLab.Core : RecommendImplementationShape — analyses a scenario and recommends hosted or prompt agent based on its requirements BuildLaunchChecklist — generates a pilot launch checklist for a given use case TroubleshootHostedAgent — returns structured troubleshooting guidance for common setup problems These tools are deterministic by design, no LLM call required to return a result. That choice makes them fast, predictable, and fully testable, which is the right architecture for business logic in a production agent. The end-to-end architecture looks like this: The Hands-On Journey: Lab by Lab The workshop follows a deliberate build → validate → ship progression. Each lab has a clear outcome. You do not move forward until the previous checkpoint passes. Lab 0 — Setup and Local Run Open the repo in VS Code or a GitHub Codespace, configure your Microsoft Foundry project endpoint and model deployment name, then run the agent locally. By the end of Lab 0, your agent is listening on http://localhost:8088/responses and responding to test requests. dotnet restore dotnet build dotnet run --project src/WorkshopLab.AgentHost Test it with a single PowerShell call: Invoke-RestMethod -Method Post ` -Uri "http://localhost:8088/responses" ` -ContentType "application/json" ` -Body '{"input":"Should we start with a hosted agent or a prompt agent?"}' Lab 0 instructions → Lab 1 — Copilot Customisation Configure repo-specific GitHub Copilot instructions so that Copilot understands the hosted-agent patterns used in this project. You will also add a Copilot review skill tailored to hosted agent code reviews. This step means every code suggestion you receive from Copilot is contextualised to the workshop scenario rather than giving generic .NET advice. Lab 1 instructions → Lab 2 — Tool Implementation Extend one of the deterministic tools in WorkshopLab.Core with a real feature change. The suggested change adds a stronger recommendation path to RecommendImplementationShape for scenarios that require all three hosted-agent strengths simultaneously. // In RecommendImplementationShape — add before the final return: if (requiresCode && requiresTools && requiresWorkflow) { return string.Join(Environment.NewLine, [ $"Recommended implementation: Hosted agent (full-stack)", $"Scenario goal: {goal}", "Why: the scenario requires custom code, external tool access, and " + "multi-step orchestration — all three hosted-agent strengths.", "Suggested next step: start with a code-based hosted agent, register " + "local tools for each integration, and add a workflow layer." ]); } You then write an xUnit test to cover it, run dotnet test , and validate the change against a live /responses call. This is the workshop's most important teaching moment: every tool change is covered by a test before it ships. Lab 2 instructions → Lab 3 — CI Validation Wire up a GitHub Actions workflow that builds the solution, runs the test suite, and validates that the agent container builds cleanly. No manual steps — if a change breaks the build or a test, CI catches it before any deployment happens. Lab 3 instructions → Lab 4 — Deployment to Microsoft Foundry Use the Azure Developer CLI ( azd ) to provision an Azure Container Registry, publish the agent image, and deploy the hosted agent to Microsoft Foundry. The workshop separates provisioning from deployment deliberately: azd owns the Azure resources; the Foundry control plane deployment is an explicit, intentional final step that depends on your real project endpoint and agent.yaml manifest values. Lab 4 instructions → Lab 5 — Chat UI Integration Connect a Blazor chat UI to the deployed hosted agent and validate end-to-end responses. By the end of Lab 5, you have a fully functioning agent accessible through a real UI, calling your deterministic tools via the Foundry control plane. Lab 5 instructions → Key Concepts to Take Away The workshop teaches concrete patterns that apply well beyond this specific scenario. Code-first agent design Prompt-only agents are fast to build but hard to test and reason about at scale. A hosted agent with code-backed tools gives you something you can unit test, refactor, and version-control like any other software. Deterministic tools and testability The workshop explicitly avoids LLM calls inside tool implementations. Deterministic tools return predictable outputs for a given input, which means you can write fast, reliable unit tests for them. This is the right pattern for business logic. Reserve LLM calls for the reasoning layer, not the execution layer. CI/CD for agent systems AI agents are software. They deserve the same build-test-deploy discipline as any other service. Lab 3 makes this concrete: you cannot ship without passing CI, and CI validates the container as well as the unit tests. Deployment separation The workshop's split between azd provisioning and Foundry control-plane deployment is not arbitrary. It reflects the real operational boundary: your Azure resources are long-lived infrastructure; your agent deployment is a lifecycle event tied to your project's specific endpoint and manifest. Keeping them separate reduces accidents and makes rollbacks easier. Observability and the validation mindset Every lab ends with an explicit checkpoint. The culture the workshop builds is: prove it works before moving on. That mindset is more valuable than any specific tool or command in the labs. Why Hosted Agents Are Worth the Investment The managed runtime in Microsoft Foundry removes the infrastructure overhead that makes custom agent deployment painful. You do not manage Kubernetes clusters, configure ingress rules, or handle TLS termination. Foundry handles the hosting; you handle the code. This matters most for teams making the transition from demo to production. A prompt agent is an afternoon's work. A hosted agent with proper CI, tested tools, and a deployment pipeline is a week's work done properly once, instead of several weeks of firefighting done poorly repeatedly. The Foundry agent lifecycle —> create, update, version, deploy —>also gives you the controls you need to manage agents in a real environment: staged rollouts, rollback capability, and clear separation between agent versions. For the full deployment guide, see Deploy a hosted agent to Foundry Agent Service. From Workshop to Real Project This workshop is not just a learning exercise. The repository structure, the tooling choices, and the CI/CD patterns are a reference implementation. The patterns you can lift directly into a production project include: The WorkshopLab.Core / WorkshopLab.AgentHost separation between business logic and agent hosting The agent.yaml manifest pattern for declarative Foundry deployment The GitHub Actions workflow structure for build, test, and container validation The azd + ACR pattern for image publishing without requiring Docker Desktop locally The Blazor chat UI as a starting point for internal tooling or developer-facing applications The scenario, a readiness coach for hosted agents. This is also something teams evaluating Microsoft Foundry will find genuinely useful. It answers exactly the questions that come up when onboarding a new team to the platform. Common Mistakes When Building Hosted Agents Having run workshops and spoken with developer teams building on Foundry, a few patterns come up repeatedly: Skipping local validation before containerising. Always validate the /responses endpoint locally first. Debugging inside a container is slower and harder than debugging locally. Putting business logic inside the LLM call. If the answer to a user query can be determined by code, use code. Reserve the model for reasoning, synthesis, and natural language output. Treating CI as optional. Agent code changes break things just like any other code change. If you do not have CI catching regressions, you will ship them. Conflating provisioning and deployment. Recreating Azure resources on every deploy is slow and error-prone. Provision once with azd ; deploy agent versions as needed through the Foundry control plane. Not having a rollback plan. The Foundry agent lifecycle supports versioning. Use it. Know how to roll back to a previous version before you deploy to production. Get Started The workshop is open source, beginner-friendly, and designed to be completed in a single day. You need a .NET 10 SDK, an Azure subscription, access to a Microsoft Foundry project, and a GitHub account. Clone the repository, follow the labs in order, and by the end you will have a production-ready reference implementation that your team can extend and adapt for real scenarios. Clone the workshop repository → Here is the quick start to prove the solution works locally before you begin the full lab sequence: git clone https://github.com/microsoft/Hosted_Agents_Workshop_dotNET.git cd Hosted_Agents_Workshop_dotNET # Set your Foundry project endpoint and model deployment $env:AZURE_AI_PROJECT_ENDPOINT = "https://<resource>.services.ai.azure.com/api/projects/<project>" $env:MODEL_DEPLOYMENT_NAME = "gpt-4.1-mini" # Build and run dotnet restore dotnet build dotnet run --project src/WorkshopLab.AgentHost Then send your first request: Invoke-RestMethod -Method Post ` -Uri "http://localhost:8088/responses" ` -ContentType "application/json" ` -Body '{"input":"Should we start with a hosted agent or a prompt agent?"}' When the agent answers as a Hosted Agent Readiness Coach, you are ready to begin the labs. Key Takeaways Hosted agents in Microsoft Foundry let you run custom .NET code in a managed container runtime — you own the logic, Foundry owns the infrastructure. Deterministic tools are the right pattern for business logic in production agents: fast, testable, and predictable. CI/CD is not optional for agent systems. Build it in from the start, not as an afterthought. Separate your provisioning ( azd ) from your deployment (Foundry control plane) — it reduces accidents and simplifies rollbacks. The workshop is a reference implementation, not just a tutorial. The patterns are production-grade and ready to adapt. References Hosted Agents Workshop for .NET — GitHub Repository Workshop Lab Guide Deploy a Hosted Agent to Foundry Agent Service — Microsoft Learn Microsoft Foundry Portal Azure Developer CLI (azd) — Microsoft Learn .NET 10 SDK Download434Views0likes0CommentsCreate a Tic Tac Toe Game & Learn About Event Sourcing
🎮 Create a Tic Tac Toe Game & Learn About Event Sourcing – Build Smarter Systems Through Simple Play 🧠⚡ What if building a simple game could teach you a powerful backend pattern? In this hands-on session, we’ll use a classic Tic Tac Toe game to introduce Event Sourcing — an architectural approach where every state change is captured as an event. You'll build the game step-by-step, then explore how to store and replay every move using event streams. This session is perfect for developers curious about Domain-Driven Design, CQRS, and event-driven systems, all while having some fun! 🎓 What You’ll Learn 🎯 What is Event Sourcing? – Understand the core principles and when to use it 🎮 Modeling Game State with Events – Each move becomes part of the system's history 📦 Storing & Replaying Events – Learn how to rebuild game state from an event log 🛠️ CQRS in Action – Separate commands and queries for better design ⚙️ Event Versioning – What happens when your events evolve over time 🔍 Debug with Confidence – Use event history for tracing and analytics 🌩️ Scaling the Pattern – How this idea applies beyond games (finance, IoT, SaaS) 🧰 Tech Stack: .NET / C# | EventStore / SQL / Custom In-Memory Store 🗓️ Date: 8 August 2025 ⏰ Time: 18:00 CEST 🎙️ Speaker: Shahab Ganji 📌 Topic: Create a Tic Tac Toe Game & Learn About Event Sourcing138Views0likes0CommentsAugust Calendar is here!
🌟 Community Spirit? CHECKED! 🌍 Amazing Members & Audiences? DOUBLE CHECK! 🎤 Phenomenal Speakers Locked In? CHECKED! 🚀 Global Live Sessions? YOU BET! The stage is set. The excitement is real. It’s that time again, time to ignite the community with another monthly calendar! 🔥✨ We’ve lined up a powerhouse of sessions packed with world-class content, covering the best of Microsoft, from Coding, Cloud, Migration, Data, Security, AI, and so much more! 💻☁️🔐🤖 But wait, that’s not all! For the first time ever, we’ve smashed through time zones! No matter where you are in the world, you can tune in LIVE and learn from extraordinary speakers sharing their insights, experiences, and passion. 🌏⏰ What do you need to do? It’s easy: 👉 Register for the sessions 👉 Mark your calendar 👉 Grab your coffee, tea, or ice-cold soda 👉 Join us and soak up the knowledge! We believe in what makes this community truly special, and that’s YOU. Let’s set August on fire together! 🔥 Are you ready to be inspired, to grow, and to connect with Microsoft Learn family? Don’t miss out, August is YOUR month! 💥🙌 📢 Shehan Perera 📖 https://streamyard.com/watch/dh62MQJHEv9B?wt.mc_id=MVP_350258 📅 5 Aug 2025 (19:00 AEST) (11:00 CEST) 📢Shahab Ganji 📖 https://streamyard.com/watch/qCXk9kkb34W8?wt.mc_id=MVP_350258 📅 8 Aug 2025 18:00 CEST 📢 Ronak Vachhani 📖https://streamyard.com/watch/hNjJAZeUcxTF?wt.mc_id=MVP_350258 📅16 Aug 2025 (16:00 AEST) (08:00 CEST) 📢Laïla Bougriâ 📖https://streamyard.com/watch/KWwF7Wd5mYAG?wt.mc_id=MVP_350258 📅22 Aug 2025 18:00 CEST 📢AJ Bajada 📖https://streamyard.com/watch/vaNSN3hVuXbr?wt.mc_id=MVP_350258 📅28 Aug 2025 (19:30 AEST) (11:30 CEST) 📢James Eastham 📖https://streamyard.com/watch/FNGJZNbAKjFi?wt.mc_id=MVP_350258 📅29 Aug 2025 17:00 CEST255Views1like0CommentsTaming Mutable State: Applying Functional Programming in an Object-Oriented Language
🔥 .NET July at Microsoft Hero is on fire! 🚀 The last two sessions have blown us away with incredible speakers and fresh content, but the party isn’t even close to over. July is bursting with .NET energy, and next up, Rodney will join us to take us down a path less traveled with a topic that promises to shake up the way you think about C#. 🧠✨ What’s coming up? Imagine blending the strengths of object-oriented C# with some of the most intriguing secrets from the world of functional programming. This session teases the mysterious forces behind writing more resilient, maintainable apps, without giving it all away. Expect big “aha!” moments and insights you won’t see coming. 🕵️♂️💡 Curious? You should be! Make sure you’re registered, mark your calendar, and get ready to join us live for another game-changing session. Let’s unlock new perspectives together, the Microsoft Learn way! 🌟🤝 📅 July 19, 2025 06:00 PM CEST 🔗 https://streamyard.com/watch/CDGBWtmDTtjQ?wt.mc_id=MVP_350258163Views3likes0CommentsStefan Pölz - Null & Void, everything about nothing in .NET
After an electrifying kickoff to .NET July, it’s time to keep the momentum rolling! 🔥 🎇 .NET July isn’t just a month for developers, it’s a celebration for everyone passionate about tech, the cloud, and leveling up their skills. Whether you’re aiming to supercharge your knowledge or make a bold move in your career, this is the community to join. 🫶 Our next session features the incredible https://www.linkedin.com/in/ACoAAC9Q2ZAB2u-_JbumHA-DJvD2qxaBcTfzuTo, ready to share his hard-earned wisdom and hands-on experience on one of the hottest topics in .NET today. This is your chance to gain insights that could change the way you build and think about software. Want to understand the "billion-dollar mistake" and why it's also a powerful tool? Curious how modern .NET helps you avoid runtime nightmares, before they even start? Register now, save your VIP spot, and become part of another unforgettable session with the https://www.linkedin.com/company/microsofthero/! Let’s grow and learn together with https://www.linkedin.com/company/microsoftlearn/. 🚀 📺 Subscribe us on YouTube and watch live --> https://lnkd.in/dQSgYXgi 📑 Register for the session: https://lnkd.in/dywm3CCd https://www.linkedin.com/in/ACoAAC9Q2ZAB2u-_JbumHA-DJvD2qxaBcTfzuTo Null & Void - Everything about Nothing in .NET July 12, 2025 06:00 PM CET #MVPBUZZ #MicrosoftHero #MicrosoftZeroToHero #DOTNET #MicrosoftLearn #MicrosoftDeveloper #Developer #Microsoft193Views0likes0CommentsNavigating the New AI Landscape: A Developer’s Journey Through the Noise
In this article, I share a developer’s perspective on navigating the ever-expanding landscape of AI tools. Grounded in the familiarity of .NET, we explore how Microsoft’s ecosystem—from Semantic Kernel and GitHub Copilot to MCP Server, Fabric, and low-code platforms—offers not chaos, but clarity. With the right mindset and the right tools, the AI frontier becomes not overwhelming, but empowering.422Views0likes0CommentsBuilding Real-Time Web Apps with SignalR, WebAssembly, and ASP.NET Core API
In this blog, we’ll explore how to build a real-time web application using three cutting-edge technologies: SignalR, WebAssembly, and ASP.NET Core API. SignalR simplifies the process of adding real-time web functionality, WebAssembly brings near-native performance to web apps, and ASP.NET Core API provides a robust and scalable backend. By combining these technologies, you can create web applications that are both highly responsive and performant.2.4KViews1like0CommentsTransforme o Desenvolvimento com .NET Aspire: Integração com JavaScript e Node.js
Desenvolver aplicações modernas e distribuídas nunca foi tão fácil! Com o .NET Aspire, você pode orquestrar diversos componentes, integrar tecnologias como JavaScript e Node.js, e garantir que tudo funcione perfeitamente na nuvem. Neste artigo, exploramos como essa poderosa ferramenta pode transformar seu fluxo de trabalho, simplificando a configuração e execução de aplicações complexas. E mais: confira exemplos práticos e uma demonstração do Chris Noring no último .NET Aspire Developers Day. Prepare-se para levar suas habilidades de desenvolvimento para o próximo nível!1.8KViews1like0Comments