Let’s discuss the Azure Functions serverless agents runtime. Most conversations about agent runtimes on Azure land on Azure AI Foundry Agent Service. That is the right starting point for teams that want a fully managed, enterprise-grade agent host. But it is not the only option, and for event-driven scenarios, it is often not the best one.
The Azure Functions serverless agents runtime is a programming model that lets you define agents as function apps. Events, schedules, messages, or HTTP requests trigger agents. They run on Flex Consumption with scale-to-zero, managed identity, and Application Insights. And they are deployed with azd like any other function app.
This post explains what the runtime actually is, how its three configuration files work together, and where it fits relative to Foundry Agent Service and Durable Functions. If you are new to Azure Functions as an AI platform, start with Azure Functions AI Integration: The Quiet Powerhouse, which maps all four AI-enabled patterns. If you are looking specifically at MCP server hosting, Hosting MCP Servers on Azure Functions covers the three hosting options in detail.
How the Azure Functions serverless agents runtime works
The runtime is a programming model built on top of Azure Functions. When an event fires a timer, an HTTP request, or a queue message, the runtime starts the agent, runs it through Microsoft Agent Framework, and handles the trigger registration and endpoint wiring automatically.
You do not write trigger code or implement an agent loop. You define three files, deploy a function app, and the runtime does the rest.
Those three files are:
.agent.mdโ defines the agent: its instructions, its trigger, and the tools it can useagents.config.yamlโ app-wide runtime defaults, including the model deployment and any shared infrastructure (such as an Azure Container Apps dynamic session pool for sandboxed code execution)mcp.jsonโ lists the remote MCP servers available to the agents in the app
The runtime discovers these files at startup, registers the required triggers and endpoints, and wires the agent to Microsoft Agent Framework. You can have multiple agents in a single function app, each defined in its own .agent.md file, all sharing the app-wide configuration.
What the Azure Functions serverless agents runtime deploys
The Microsoft Learn quickstart deploys two agents from a single function app:
Chat agent (main.agent.md) โ an HTTP-triggered agent that exposes a debug chat UI in the browser. It can execute sandboxed Python code via an Azure Container Apps dynamic session pool and browse the web. No email tooling.
Blog summary agent (daily_microsoft_blog_summary.agent.md) โ a timer-triggered agent. The YAML front matter in the file declares the schedule; the markdown body contains the agent instructions. On each timer fire, the agent gathers recent Microsoft blog posts, summarises them, and emails the digest via a managed MCP server connected to Microsoft 365 Outlook.
What gets provisioned by azd up for this template:
| Resource | Purpose |
|---|---|
| Flex Consumption function app | Hosts the agents |
| Azure AI Foundry project + model deployment | LLM for agent reasoning |
| Azure Container Apps dynamic session pool | Sandboxed Python code execution |
| Storage account | Function app state |
| Application Insights | Monitoring |
| Connector Namespace + M365 Outlook connection | Email delivery (optional) |
| Managed MCP server | Exposes the Outlook connector to agents |
The provisioning is handled entirely by Bicep via azd โ you do not configure any of this manually.
How the agent definition files work
.agent.md is a markdown file with YAML front matter. The front matter declares the trigger and any agent-level configuration. The markdown body is the system prompt โ the instructions the agent follows when it runs.
The timer-triggered blog summary agent front matter looks roughly like:
trigger: type: timer schedule: "0 0 8 * * *"tools: - mcp_server: outlook
The markdown body below contains the agent’s instruction set; it tells the agent what to gather, how to summarise it, and how to format the email. You write it in plain English.
agents.config.yaml sets defaults that apply across all agents in the app. The model deployment lives here, so every agent uses the same Azure AI Foundry model unless you override it. This setting also defines the session pool endpoint for sandboxed code execution.
mcp.json lists the remote MCP servers the agents can call. The quickstart template includes a managed MCP server for the Microsoft 365 Outlook connector when you enable email delivery. The runtime reads this file at startup and makes those servers available to all agents in the app.
How Azure Functions Serverless Agents Runtime differs from Foundry Agent Service
The distinction matters for architecture decisions.
Foundry Agent Service is a fully managed service. Microsoft operates the agent host. You configure agents through the Foundry portal or SDK, connect tools, and the service handles orchestration, state, and scaling. It has enterprise SLAs, built-in tooling, and a managed lifecycle.
The serverless agents runtime is a programming model you deploy yourself. You own the function app. You manage the deployment, the model connection, and the infrastructure. In return, you get the full Azure Functions hosting model: event-driven triggers, Flex Consumption billing, VNet integration, managed identity, and azd-based deployment pipelines.
The decision table:
| Situation | Use |
|---|---|
| Need a fully managed agent host with enterprise SLAs | Foundry Agent Service |
| Agents triggered by events, schedules, or queue messages | Serverless agents runtime |
| Need VNet integration or custom deployment pipelines | Serverless agents runtime |
| Want scale-to-zero billing for bursty agent workloads | Serverless agents runtime |
| Need agents embedded in an existing function app | Serverless agents runtime |
| Prefer not to manage the agent host infrastructure | Foundry Agent Service |
These are not mutually exclusive. The serverless agents runtime can call tools hosted in Foundry via MCP servers, and Foundry agents can call tools hosted in Azure Functions. The two runtimes can coexist in the same architecture.
How Azure Functions Serverless Agents Runtime differs from Durable Functions
Post 4 in this series covers Durable Functions for directed agentic workflows in detail, but the short version is:
Durable Functions is for directed, deterministic workflows: you define the steps, the model executes them in order, and Durable Functions handles state, retry, and fault tolerance. The workflow is predictable.
The serverless agents runtime is for autonomous agents. You give the agent instructions and tools, and Microsoft Agent Framework determines how to use them to accomplish the goal. The execution path is not predetermined.
If your AI-driven process has fixed, ordered steps and you need auditability, use Durable Functions. If you want the agent to figure out the steps, use the serverless agents runtime.
What to know before you build
It is preview. The programming model, file format, and configuration details are subject to change. Do not build production-critical workloads on this today without a plan for the preview-to-GA migration.
It requires a Foundry project and model deployment. The azd template provisions both automatically, but you need an Azure subscription with permissions to create Foundry resources and model deployments. Some organizations have restrictions on which model deployments are permitted.
The azd template provisions real Azure resources with real costs. The Flex Consumption plan keeps costs very low for low-traffic agents, but the Foundry model deployment, Container Apps session pool, and Connector Namespace resources still incur costs. Review the Bicep templates in infra/ before running azd up in a production subscription.
Custom Python tools are how you add app-specific logic. The runtime provides the agent loop and the MCP connections. For anything that requires your own code โ calling internal APIs, reading proprietary data sources, applying business rules โ you write Python tool functions and register them in the agent definition.
Getting started
The quickstart template is the right starting point:
azd init --template Azure-Samples/functions-quickstart-serverless-agents-azd -e serverless-agentsazd env set TO_EMAIL <your-email>azd up
Review the three configuration files in src/ before deploying. They are short and readable, and understanding them before the first deployment saves debugging time later.
The email delivery step (setting TO_EMAIL and authorizing the Microsoft 365 Outlook connection) is optional. If you skip it, the timer agent still runs and returns its digest in the final response, which you can verify in Application Insights logs.
Try it with a weather sample.
If you want to see the runtime in action with a minimal, self-contained example before committing to the full quickstart, I built a companion sample: a weather chat agent that fetches live conditions and 3-day forecasts for any location using Open-Meteo, no API key, no M365 connector, no email setup required.
The agent is defined in a single main.agent.md file. It uses Python code execution via the Container Apps session pool to call the Open-Meteo API and returns structured weather data in the chat UI. Deploy it in three commands:
git clone https://github.com/steefjan1/weather-agentscd weather-agentsazd up
Select Central US when prompted for location โ the runtime is in preview and region availability is limited. The chat UI is at https://<function-app-name>.azurewebsites.net/api/agents/main/ once deployment completes.

The weather agent runs on the Azure Functions serverless agents runtime, pulling live conditions and a 3-day forecast for Amsterdam from Open-Meteo via sandboxed Python code execution in an Azure Container Apps dynamic session. The agent is defined in a single main.agent.md file.The README documents two known issues you will hit if you try to build from scratch rather than the official quickstart: a broken transitive dependency in azurefunctions-agents-runtime that pins a yanked version of github-copilot-sdk, and the region constraint. Both are worth knowing before you invest time in a custom deployment.
Up next: Durable Functions as the Orchestration Layer for Directed Agentic Workflows






















