<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/jaliya-s-blog-microsoft-agent-framework-hosted-agents-in-microsoft-foundry-with-net-dqon0i46y" -->

---
title: Jaliya's Blog: Microsoft Agent Framework: Hosted Agents...
description: A hands-on walkthrough demonstrates hosting an AI agent built with Microsoft Agent Framework as a Foundry hosted agent in .NET, contrasting it with...
canonical: https://daily.dev/posts/jaliya-s-blog-microsoft-agent-framework-hosted-agents-in-microsoft-foundry-with-net-dqon0i46y
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Jaliya's Blog: Microsoft Agent Framework: Hosted Agents in Microsoft Foundry with .NET | daily.dev
og:description: A hands-on walkthrough demonstrates hosting an AI agent built with Microsoft Agent Framework as a Foundry hosted agent in .NET, contrasting it with...
og:url: https://daily.dev/posts/jaliya-s-blog-microsoft-agent-framework-hosted-agents-in-microsoft-foundry-with-net-dqon0i46y
og:image: https://api.daily.dev/og/posts/DQOn0i46Y.png
og:image:alt: Jaliya's Blog: Microsoft Agent Framework: Hosted Agents in Microsoft Foundry with .NET
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Jaliya's Blog: Microsoft Agent Framework: Hosted Agents in Microsoft Foundry with .NET

**[We Are .NET](https://daily.dev/sources/wearedotnet)** · 5 min read · 1 upvotes · 0 comments

## Summary

A hands-on walkthrough demonstrates hosting an AI agent built with Microsoft Agent Framework as a Foundry hosted agent in .NET, contrasting it with self-hosting (Azure Functions) and prompt agents. The agent code, tools, and dependencies run entirely inside a Foundry-managed container with its own Microsoft Entra identity, endpoint, versioning, and playground. Steps cover writing the agent, running it locally on port 8088, deploying with the Azure Developer CLI and Foundry extension, invoking the deployed agent, calling it from code via ProjectResponsesClient, and cleanly deleting it via REST with force=true to cascade session cleanup. Notes a versioning mismatch gotcha between the azure.yaml manifest (2.0.0) and docs examples (1.0.0) that must align with the Microsoft.Agents.AI.Foundry.Hosting package.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://jaliyaudagedara.blogspot.com/2026/09/microsoft-agent-framework-hosted-agents.html>

## Questions this post answers

### What is the difference between a Foundry prompt agent and a Foundry hosted agent in Microsoft Agent Framework?

With prompt agents, Foundry only stores the agent definition while your own application code runs the tools. With hosted agents, Foundry runs the entire agent, code and tools included, packaging it as a container with its own managed endpoint, Microsoft Entra identity, versioning, scaling, and a working playground since the tools execute inside Foundry itself.

_daily.dev surfaces comparisons like this for developers deciding between hosting models for their AI agents._

### Why does my Foundry hosted agent deployment fail even though I'm using the latest Microsoft.Agents.AI.Foundry.Hosting package?

The azure.yaml manifest's protocols version field and the hosting package version must agree, but SDK and REST docs examples still show version 1.0.0 while newer hosting packages (like 1.22.0-preview) require version 2.0.0 under protocols. Copying the version straight from documentation examples while referencing a newer hosting package causes a mismatch and deployment failure.

_developers deploying Foundry agents can check daily.dev to avoid version mismatch pitfalls before shipping._

### How do I delete a Foundry hosted agent that still has active sessions without getting a 409 error?

Send a DELETE request to the agent's endpoint with force=true in the query string, which cascades the deletion to the agent, all its versions, and any active sessions. Without force=true, attempting to delete an agent with open sessions returns a 409 conflict response. Note that azd down is not appropriate here since it only removes azd-provisioned environments, not agents deployed into an existing project.

_engineers cleaning up cloud AI agent deployments can find practical fixes like this on daily.dev._

## Similar posts on daily.dev

- [Jaliya's Blog: Microsoft Agent Framework: Hosting a Handoff Workflow in Microsoft Foundry with .NET](https://daily.dev/posts/jaliya-s-blog-microsoft-agent-framework-hosting-a-handoff-workflow-in-microsoft-foundry-with-net-z6skzulzr) · We Are .NET · 0 upvotes · 0 comments
- [From Local to Production: Deploy Your Microsoft Agent Framework Agent with Foundry Hosted Agents](https://daily.dev/posts/from-local-to-production-deploy-your-microsoft-agent-framework-agent-with-foundry-hosted-agents-xrsxs4zxt) · DevBlogs · 1 upvotes · 0 comments
- [Building AI apps and agents with Microsoft Foundry](https://daily.dev/posts/building-ai-apps-and-agents-with-microsoft-foundry-tdq7h47dl) · InfoWorld · 0 upvotes · 0 comments
- [Build AI Agents from Prompts with Foundry Agent Service](https://daily.dev/posts/build-ai-agents-from-prompts-with-foundry-agent-service-jgcu6mxa6) · C\# Corner · 0 upvotes · 0 comments

---

Tags: [#ai-agents](https://daily.dev/tags/ai-agents), [#azure](https://daily.dev/tags/azure), [#.net](https://daily.dev/tags/.net)

[View this post on daily.dev](https://daily.dev/posts/jaliya-s-blog-microsoft-agent-framework-hosted-agents-in-microsoft-foundry-with-net-dqon0i46y)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Jaliya's Blog: Microsoft Agent Framework: Hosted Agents in Microsoft Foundry with .NET","url":"https://daily.dev/posts/jaliya-s-blog-microsoft-agent-framework-hosted-agents-in-microsoft-foundry-with-net-dqon0i46y","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/jaliya-s-blog-microsoft-agent-framework-hosted-agents-in-microsoft-foundry-with-net-dqon0i46y"},"datePublished":"2026-09-21T20:47:21.849Z","dateModified":"2026-09-21T20:49:58.659Z","description":"A hands-on walkthrough demonstrates hosting an AI agent built with Microsoft Agent Framework as a Foundry hosted agent in .NET, contrasting it with...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/862bab10e4eb2972e730c6d37379946e?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/862bab10e4eb2972e730c6d37379946e?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"We Are .NET","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"We Are .NET","logo":"https://media.daily.dev/image/upload/s--BsnVOa3i--/f_auto/v1718347410/logos/wearedotnet","url":"https://daily.dev/sources/wearedotnet"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/jaliya-s-blog-microsoft-agent-framework-hosted-agents-in-microsoft-foundry-with-net-dqon0i46y","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":1},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"ai-agents,azure,.net","timeRequired":"PT5M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"We Are .NET","item":"https://daily.dev/sources/wearedotnet"},{"@type":"ListItem","position":3,"name":"Jaliya's Blog: Microsoft Agent Framework: Hosted Agents in Microsoft Foundry with .NET"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/jaliya-s-blog-microsoft-agent-framework-hosted-agents-in-microsoft-foundry-with-net-dqon0i46y#faq","mainEntity":[{"@type":"Question","name":"What is the difference between a Foundry prompt agent and a Foundry hosted agent in Microsoft Agent Framework?","acceptedAnswer":{"@type":"Answer","text":"With prompt agents, Foundry only stores the agent definition while your own application code runs the tools. With hosted agents, Foundry runs the entire agent, code and tools included, packaging it as a container with its own managed endpoint, Microsoft Entra identity, versioning, scaling, and a working playground since the tools execute inside Foundry itself. daily.dev surfaces comparisons like this for developers deciding between hosting models for their AI agents."}},{"@type":"Question","name":"Why does my Foundry hosted agent deployment fail even though I'm using the latest Microsoft.Agents.AI.Foundry.Hosting package?","acceptedAnswer":{"@type":"Answer","text":"The azure.yaml manifest's protocols version field and the hosting package version must agree, but SDK and REST docs examples still show version 1.0.0 while newer hosting packages (like 1.22.0-preview) require version 2.0.0 under protocols. Copying the version straight from documentation examples while referencing a newer hosting package causes a mismatch and deployment failure. developers deploying Foundry agents can check daily.dev to avoid version mismatch pitfalls before shipping."}},{"@type":"Question","name":"How do I delete a Foundry hosted agent that still has active sessions without getting a 409 error?","acceptedAnswer":{"@type":"Answer","text":"Send a DELETE request to the agent's endpoint with force=true in the query string, which cascades the deletion to the agent, all its versions, and any active sessions. Without force=true, attempting to delete an agent with open sessions returns a 409 conflict response. Note that azd down is not appropriate here since it only removes azd-provisioned environments, not agents deployed into an existing project. engineers cleaning up cloud AI agent deployments can find practical fixes like this on daily.dev."}}]}
```

