Serverless agents runtime in Azure Functions

pjmlp1 pts1 comments

Serverless agents runtime in Azure Functions | Microsoft Learn

Table of contents

Exit editor mode

Ask Learn

Ask Learn

Reading mode

Table of contents

Read in English

Add

Add to Plans

Edit

Copy Markdown

Print

Note

Access to this page requires authorization. You can try signing in or changing directories.

Access to this page requires authorization. You can try changing directories.

Serverless agents runtime in Azure Functions

Feedback

Summarize this article for me

The Azure Functions serverless agents runtime is a programming model for building event-driven AI agents as Azure Functions apps. Agents can start from HTTP requests, timers, queues, blobs, database changes, or Connector events. You define agents in .agent.md files, configure tools and runtime defaults alongside your project, and deploy the app like any other function app. The runtime handles trigger registration, model calls, tool assembly, session history, and observability on serverless infrastructure.

Important

The serverless agents runtime is currently in preview. Features, configuration names, and supported connectors can change before general availability.

When to use the serverless agents runtime

Use the serverless agents runtime when your agent is event-driven, tool-rich, or operationally close to Azure Functions workloads. Scenarios for the serverless agent runtime include:

Scheduled background agents that summarize, monitor, reconcile, or report.

Event-driven assistants that react to messages, emails, alerts, queue messages, or data changes.

Cross-system agents that use connectors to coordinate work across SaaS and enterprise applications.

Conversational front ends that expose the same agent through HTTP, chat UI, or MCP.

Agents that should scale to zero and use managed identity, monitoring, deployment slots, and other Azure hosting capabilities.

In the following scenarios, the serverless agent runtime might not be the best option:

Scenario<br>Better option

Expose deterministic functions as tools for another AI client<br>Azure Functions MCP extension

Long-running, multi-step orchestration with human-in-the-loop approvals<br>Durable Functions

No-code agent builder<br>Copilot Studio or Foundry prompt agents

For a detailed comparison with other Microsoft agent options, see Compare the serverless agents runtime with other Microsoft agent options.

Tip

To try the serverless agents runtime, see Build serverless agents using Azure Functions. By using an azd template, you can have a working app deployed to Azure in minutes.

Why build agents on Azure Functions?

Production agents need more than a prompt and a model. They need reliable ways to start work, call external systems, persist conversation history, run untrusted code safely, authenticate without secrets, emit telemetry, and scale on demand.

Functions provides an event-driven compute model for these operational concerns. The serverless agents runtime simply applies that same model to your agent code. Here are some benefits of using the serverless agents runtime to build and run your agent code:

Agents are the unit of work. Each agent is defined in a separate markdown file.

Events start agents. Functions triggers start agents from schedules, HTTP requests, queue messages, blob changes, Event Grid events, Service Bus messages, and other supported events.

Capabilities are configured first, with code when you need it. You can configure agents to use remote MCP servers, MCP servers hosted in connector namespaces, skills, and sandboxed code executions. Write your own Python-based tools for app-specific logic.

Serverless hosting is available. The serverless agents runtime supports both Flex Consumption and Dedicated (App Service) plans. The Flex Consumption plan provides scale-to-zero, per-second billing, and automatic scaling. Both plans support managed identity, virtual network integration, and Application Insights integration.

Operational plumbing is built in. The runtime handles agent discovery, trigger registration, tool assembly, session history, and optional built-in endpoints.

Project definition

A serverless agents app is a standard Python v2 function app project deployed along with agent-specific files. The following project files are always required for Python function apps:

File<br>Purpose

function_app.py<br>Imports create_function_app() and returns the configured Azure Functions app.

host.json<br>Configures the Azure Functions host.

requirements.txt<br>Includes the serverless agents runtime package and any app-specific Python dependencies.

For more information, see the Azure Functions developer reference guide for Python apps.

Agent runtime files

The runtime discovers these agent-specific files and folders, which deploy with the app project:

File or folder<br>Purpose

*.agent.md<br>Defines agents. YAML front matter configures the agent, and the markdown body becomes the instructions. Your project must have at least one agent definition...

agents runtime serverless agent functions azure

Related Articles