Hosted agent
Concept
An agent type in Foundry Agent Service where you bring your own code and framework and Foundry runs it in an isolated session, scaling it and giving it its own identity.
Description
A Hosted agent is an agent type in Foundry Agent Service in which the developer supplies the code and the framework, and the platform runs it. Microsoft Learn describes hosted agents as containerized agentic AI applications that run on Foundry Agent Service. In contrast to prompt-based agents, which are defined only through prompts and tool settings in the portal, the code of a Hosted agent is itself a container image. The developer chooses the framework and controls runtime behavior, while models come from the Foundry model catalog and the custom code handles orchestration.
The main reason to choose a Hosted agent is control over how the agent works. Supported options named in the documentation include Microsoft Agent Framework, LangChain and LangGraph, or custom code written in Python and C#. The platform takes over cross-cutting work that would otherwise fall to the team: containerization, web server setup, security, memory persistence, scaling, instrumentation and version rollbacks. This split lets developers concentrate on agent logic rather than hosting infrastructure.
In operation, each Hosted agent gets its own Microsoft Entra identity and a dedicated endpoint. Every session runs in a VM-isolated sandbox with a persistent file system, and the service supports scale-to-zero. Versions are immutable, and an endpoint serves one version at a time without traffic splitting. To deploy one, a container image in Azure Container Registry and a Foundry project are required. Billing follows CPU and memory use during active sessions. On secrets, the documentation advises against placing them in images or environment variables and recommends managed identities and Key Vault instead.
Typical decisions around Hosted agents involve choosing between a prompt agent and a hosted one. A prompt agent suits cases where prompts and tool settings configured in the portal are enough. A Hosted agent fits cases where custom orchestration, a specific framework or full control of the runtime is needed. Because versions are immutable and an endpoint points to one version at a time, rollouts and rollbacks are handled by switching versions rather than splitting traffic.
The M365.FM episode "Enterprise AI Agent Fabric: Architecture Beyond Chatbots" places Hosted agents within the wider Foundry workflow. According to the episode, Foundry connects models, knowledge and tools into a single runtime and supports a build-test-deploy-monitor workflow for agent development. In its overview of that workflow, creating an agent can mean defining a prompt agent in the portal or with the SDK, or writing a Hosted agent that calls the Responses API. The episode then lists testing in the agents playground or locally, tracing every model call, tool invocation and decision, running evaluations to catch regressions, and optimizing a hosted agent's instructions with the agent optimizer.
In short, a Hosted agent combines developer-owned code with a managed runtime: the container and framework are the team's choice, while isolation, identity, scaling and versioning are provided by Foundry Agent Service.
Overview compiled with AI from M365.FM episodes and the facts on this page. You can improve it with the edit button below.
| Type | Concept |
|---|
Community wiki
Short info above, community knowledge below: add practical tips, examples or corrections. New contributions are reviewed first; trusted members publish directly.
Experts and companies for this topic
Nobody has listed this topic yet. Add it to your profile.
Maintained by Mirko Peters (Microsoft MVP) · Last updated: