Back to Blog
June 2, 2026

Unlocking the Future of AI Agents with Foundry Hosted Agents at Microsoft Build 2026

Share

Unlocking the Future of AI Agents with Foundry Hosted Agents at Microsoft Build 2026

Date: 2026-06-02

Discover how Microsoft Foundry’s hosted agents simplify deployment, enable real-time voice integration, embed safety guardrails, and automate continuous improvement—all without container hassles.

Tags: ["Microsoft Foundry", "AI Agents", "Azure", "Agent Optimization", "Cloud Development"]

The journey from building AI agents in the lab to running them reliably in production environments is littered with obstacles. Developers often spend more time managing containers, securing identities, and scaling infrastructure than refining the agent’s intelligence itself. Microsoft Foundry’s latest updates to their Hosted Agent Service, unveiled at Microsoft Build 2026, directly tackle these challenges by abstracting away operational overhead and empowering developers to iterate faster, safely, and at scale.

Hosted agents now support direct deployment from source code—no container builds required—significantly lowering the barrier for teams to ship intelligent agents. They also introduce built-in content safety guardrails, robust voice live integration across WebSocket and WebRTC, and a groundbreaking Agent Optimizer that automates agent improvement through a closed-loop evaluation pipeline. By capitalizing on these innovations, organizations can accelerate their AI agent projects and run them confidently in enterprise scenarios.

In this post, we’ll dive into what these new capabilities entail, how the agent system is architected for production readiness, and concrete ways to leverage the platform’s tooling for rapid development, operational insights, and continuous optimization.

Architecture Overview

┌─────────────────────────────────────────────┐
│           Enterprise Data & Applications    │
├─────────────────────────────────────────────┤
│  • Source Code & AI Models                   │
│  • External Tools & APIs                      │
│  • Speech & Text User Interfaces              │
└─────────────────────────────────────────────┘
                ↓
┌─────────────────────────────────────────────┐
│           Foundry Agent Service Platform     │
├─────────────────────────────────────────────┤
│  • Hosted Agent Runtime                       │
│  • Identity & Security (Microsoft Entra ID) │
│  • Persistent File Systems                    │
│  • OpenTelemetry Tracing & Observability     │
│  • Content Safety Guardrails                  │
│  • Agent Optimizer (Closed-Loop Evaluation)  │
└─────────────────────────────────────────────┘
                ↓
┌─────────────────────────────────────────────┐
│               Developer Tooling              │
├─────────────────────────────────────────────┤
│  • Azure Developer CLI (azd)                  │
│  • Foundry Toolkit for VS Code                 │
│  • CI/CD Integration                          │
│  • Real-Time Voice Protocols (WebSocket)      │
└─────────────────────────────────────────────┘

This architecture decouples the underlying operational complexity from developers, enabling seamless workflows from code to deployment and monitoring. The platform’s sandboxed hypervisor-based isolation gives each hosted agent its own secure environment, persistent context, and traceability, facilitating scalable multi-modal agent applications.

Hosted Agents Guardrails
Figure: Overview graphic of Foundry hosted agents capabilities, courtesy Microsoft Foundry Blog

Key Technical Observations

  • Direct Source Code Deployment eliminates the traditional containerization step, allowing developers to package Python or .NET agents as zip archives. This approach drastically reduces iteration time, particularly in early development, without sacrificing the option to fall back to full container builds for advanced scenarios.

  • Built-In Content Safety Guardrails integrate content filtering natively within the hosted agent runtime. This design offloads the need for teams to build middleware for filtering harmful inputs and outputs, providing real-time policy enforcement powered by the Foundry Control Plane’s Content Safety service.

  • Multi-Protocol Support Including WebSocket for Voice enables real-time voice-first AI agents with bidirectional streaming. This is a breakthrough for telephony and accessibility applications, exposing a persistent WebSocket endpoint that handles audio input and output streams efficiently without repeated HTTP session overhead.

  • Agent Optimizer as a Closed-Loop Improvement Engine automates agent tuning with evaluation-driven prompt rewriting and configuration generation. It scales troubleshooting and enhancements across multiple agents and domains without requiring retraining or manual coding, accelerating production readiness.

  • Idempotent Infrastructure with Automated Identity Management via Microsoft Entra ID and sandboxed persistent file systems reduces security risks and operational complexity when scaling and running concurrent agent sessions.

  • Comprehensive Observability and Tracing baked into the runtime via OpenTelemetry allows developers to diagnose failures, monitor resource usage, and audit agent interactions with ease.

How It Works: From Code to Optimized Production Agent

Simplified Deployment Without Containers

Previously, deploying an AI agent to Foundry required building a Docker container, pushing to Azure Container Registry, and configuring the agent to run that image. This gave full control over runtime dependencies but introduced friction during development.

The new direct code deployment removes container overhead:

  • Developers zip their Python or .NET source projects.
  • On upload, the platform installs dependencies remotely (remote_build) or uses pre-bundled binaries (bundled mode).
  • The Azure Developer CLI (azd) or Foundry VS Code Toolkit automates packaging, uploading, status polling, and RBAC configuration.

Typical workflow with azd:

# Initialize project for code deployment
azd ai agent init \
  --src ./src/my-agent \
  --agent-name my-unique-agent \
  --deploy-mode code \
  --runtime python_3_13 \
  --entry-point main.py \
  --dep-resolution remote_build

# Deploy the packaged agent
azd deploy

# Invoke the agent with a message
azd ai agent invoke "message"

# Monitor logs for troubleshooting
azd ai agent monitor --tail 100

This approach unleashes rapid iteration cycles without container management distractions, especially helpful in early prototyping and continuous integration pipelines.

Guardrails for Responsible AI

Hosted agents automatically apply content safety policies in real time at the communication boundaries:

  • Incoming user prompts are scanned before the agent logic executes.
  • Outgoing agent responses are filtered to prevent returning unsafe content.
  • Policy configurations can be centrally managed and baked into the hosted agent definitions.

This native integration protects live deployments from malicious or harmful inputs without requiring dedicated content moderation infrastructure.

Real-Time Voice Integration and WebSocket Protocol

Hosted agents support three complementary protocols for different operational scenarios:

Protocol Use-cases Key Traits
Responses Conversational chat, Teams/M365 publishing Managed session, streaming, SDK-agnostic
Invocations (HTTP) Webhooks, structured JSON streaming Customizable schema, event streams
Invocations (WebSocket) Real-time voice, bidirectional streaming Persistent connection, low-latency audio

The new WebSocket endpoint enables fully real-time speech agents by maintaining a persistent bidirectional stream of audio input and speech synthesis output. Telephony providers leverage this to implement seamless conversational voice agents using frameworks like Pipecat and LiveKit.

wss://{account}.services.ai.azure.com/api/projects/agents/endpoint/protocols/invocations_ws?project_name={project}&agent_name={name}

Automated Agent Optimization Loop

Manually improving agents after deployment often involves tedious prompt rewrites and repeated testing. Foundry’s Agent Optimizer systematizes this process:

  1. Evaluate the agent against a custom task set with pass/fail criteria.
  2. Generate new candidate configurations by rewriting system prompts, skills, or tool descriptions based on evaluation failures.
  3. Re-evaluate candidates and score them to find the highest quality/cost trade-off.
  4. Promote winning configurations to production with a single command.

No retraining or code changes are needed; all improvements occur via configuration. The tool helps resolve common issues like forgetting escalation steps or unsafe advice automatically.

The cold-start problem is solved by generating evaluation datasets and criteria from your agent’s existing instructions via:

azd ai agent eval init

Enabling a fully integrated, closed-loop optimization and deployment pipeline:

azd ai agent init               # scaffold agent
azd deploy                      # ship to Foundry
azd ai agent eval init          # generate eval criteria
azd ai agent eval run           # score agent
azd ai agent optimize           # generate improvements
azd ai agent optimize apply --candidate <id>
azd deploy                      # deploy optimized version

Quick Tips & Tricks

  1. Use azd CLI for End-to-End Agent Management — Leverage the Azure Developer CLI to handle packaging, deploying, invocation, and monitoring, drastically simplifying agent lifecycle management.

  2. Choose Deploy Mode Based on Your Team's Phase — Use direct code deployment (--deploy-mode code) for rapid iteration and container deployment for full runtime control in production.

  3. Enable Guardrails Early — Turn on content safety policies from the start to ensure agents behave responsibly in customer-facing contexts without extra middleware.

  4. Leverage WebSocket Protocol in Real-Time Voice Scenarios — Use the Invocations (WebSocket) endpoint for high-quality, bidirectional speech agents with frameworks like Pipecat or Voice Live.

  5. Start Agent Optimization with Minimal Datasets — Use azd ai agent eval init to bootstrap evaluations automatically, avoiding manual test writing and jumpstarting the closed-loop improvement cycle.

  6. Version and Audit Changes Automatically — Each optimized agent promotion creates a versioned deployment, facilitating rollback and compliant auditing via the platform’s built-in tracing.

Conclusion

Microsoft Foundry’s continued evolution of Hosted Agent Service marks a significant step toward operationalizing AI agents at scale. By removing containerization friction, embedding responsible AI safety features, enabling seamless real-time voice integration, and automating agent improvement loops, the platform empowers developers to deliver smarter, safer, and more reliable AI-powered experiences faster than ever.

As the platform approaches general availability later this month, with ongoing enhancements like managed virtual networks and durable agents on the roadmap, Foundry is positioning itself as a cornerstone for enterprise-grade AI agent deployments. Developers interested in operational AI agents will find in Foundry a powerful ally to bridge the gap from experimental prototypes to production excellence.

References

  1. What’s New in Hosted Agents in Foundry Agent Service | Microsoft Foundry Blog — Original source detailing the latest Foundry hosted agents capabilities.
  2. Deploy a hosted agent from source code (preview) | Microsoft Learn — Official guide on direct code deployment.
  3. How to configure guardrails and controls in Microsoft Foundry | Microsoft Learn — Documentation on built-in content safety guardrails.
  4. Foundry Agent Service + Microsoft Agent Framework Explained | Microsoft Build 2026 — Video walkthrough by Jeff Hollan.
  5. Azure Developer CLI documentation — Reference for using azd to deploy and manage agents.