Skip to content

Code templates library: Project team

Start from working code instead of an empty file. Each template runs inside a project of your AI Factory and uses the services that project already has.

Type in the search box, or tick a factory, an Azure service or a tag. Ticks in one row widen the choice, and rows narrow each other: Agent Factory with Fabric shows the agent templates that use Fabric. A blue number means the template has a place on the architecture images.

34 of 34 templates
Factory
Azure service
Tag

1ESAF agent with a private standalone web chat, or via Teams chat, or via Teams meeting as live voice participant

A Foundry prompt agent grounded in Azure AI Search, with a private web chat. Publish it to Teams (chat or live meeting voice) and Microsoft 365 Copilot with enableBotService and botFoundryAgentName.

Agent FactoryMicrosoft FoundryAzure AI SearchContainer AppsBot ServiceStorageragprompt-agentweb-appteamsvoiceevaluation

usecase_code/40-agent-factory/40-aifactory-agent

2Live voice for the ESAF agent

A pipeline step that deploys the private chat app with Azure Voice Live, so that people talk to the agent and hear it answer.

Agent FactoryVoice LiveMicrosoft FoundryAzure AI SearchContainer Appsvoiceweb-apppipeline-steprag

usecase_code/40-agent-factory/47-aifactory-agent-live-voice

3Voice sales assistant on Fabric data

A sales assistant in the browser: a Foundry prompt agent answers from a Fabric data agent over MCP, with optional live voice.

Agent FactoryFabricMicrosoft FoundryVoice Livefabricprompt-agentmcpvoiceweb-appnotebook

usecase_code/40-agent-factory/40-foundry-voice-sales--from-fabric

4Retail agents on Foundry IQ and Fabric IQ

A supervisor routes retail questions to three prompt agents, grounded in a Foundry IQ knowledge base and a Fabric data agent.

Agent FactoryMicrosoft FoundryAzure AI SearchFabricmulti-agentprompt-agentragfoundry-iqfabricmcp

usecase_code/40-agent-factory/42-multi-agent-fabric-iq

Agent data sources: SharePoint, Foundry IQ, Fabric IQ and uploads

A settings-driven prompt agent with one tool per enabled source: SharePoint, Foundry IQ, Fabric IQ and a separate knowledge base for documents uploaded to project storage.

Agent FactoryMicrosoft FoundryAzure AI SearchFabricSharePointStorageprompt-agentragfoundry-iqfabricsharepointdata-preparationmcp

usecase_code/40-agent-factory/43-data-fabric-sharepoint

5RAG that keeps each reader's permissions

RAG over several indexes that trims answers with the ADLS Gen2 access control lists, with an optional SharePoint sync and exact totals from a calculator tool.

Agent FactoryStorageAzure AI SearchMicrosoft FoundrySharePointragaccess-controlsharepointprompt-agentfoundry-iqmcpevaluation

usecase_code/40-agent-factory/48-rag-with-splitted-tables-acl-adlsgen2

6Private Azure MCP server for your agents

A private, read-only Azure MCP server on Container Apps, so that Foundry agents can list the real resources of the project.

Agent FactoryMicrosoft FoundryContainer Appsmcppipeline-step

usecase_code/40-agent-factory/44-azure-mcp

7Factory MCP server on the AI gateway

A pipeline step that hosts the read-only Factory MCP server on Container Apps and registers it on the AI gateway in API Management.

Agent FactoryAPI ManagementContainer AppsMicrosoft Foundrymcpai-gatewaypipeline-step

usecase_code/40-agent-factory/45-aifactory-mcp-gateway

8Agent that trains and scores ML models

A Foundry agent that creates, trains, retrains and batch-scores Azure Machine Learning models for churn prediction.

Agent FactoryMicrosoft FoundryAzure Machine Learningml-trainingbatchprompt-agenthosted-agentoffline-first

usecase_code/40-agent-factory/49-agent-training-ml-churn-prediction

9Single agent: prompt agent or hosted agent

A helpdesk agent that answers from Foundry IQ. Choose a prompt agent, or a hosted agent in one of six frameworks.

Agent FactoryMicrosoft FoundryAzure AI Searchragprompt-agenthosted-agentfoundry-iq

usecase_code/40-agent-factory/41-single-agent

10Multi-agent helpdesk: retrieve, review, answer

A hosted coordinator asks a knowledge agent for evidence, passes it to a reviewer agent and writes one reviewed answer.

Agent FactoryMicrosoft FoundryAzure AI Searchmulti-agenthosted-agentragfoundry-iq

usecase_code/40-agent-factory/42-multi-agent

11RAG from the shared data lake or project storage

Text RAG over a pinned corpus in the common data lake or in project storage, with one agent, index and knowledge base for each source.

Agent FactoryAzure AI SearchMicrosoft FoundryData FactoryStorageragprompt-agentfoundry-iqdata-preparation

usecase_code/40-agent-factory/45-rag-agent

12Prepare a helpdesk corpus for RAG

Prepares a public helpdesk dataset for private Foundry IQ retrieval, and keeps the evaluation answers apart from the searchable knowledge.

Agent FactoryData FactoryStorageAzure AI SearchMicrosoft Foundrydata-preparationragfoundry-iqevaluation

usecase_code/40-agent-factory/43-data

13ESAF Agent Chat: the agent behind it

The pipeline step that creates or updates the Agent Chat prompt agent in the project when enableFactoryChatAgent is true.

Agent FactoryMicrosoft Foundryprompt-agentpipeline-step

usecase_code/40-agent-factory/46-factory-chat-agent

14ML Model Factory

Machine-learning examples for batch, online and streaming inference with Azure Machine Learning, AutoML and Databricks, driven by one scenario file.

Model FactoryAzure Machine LearningDatabricksEvent Hubsml-trainingbatchonlinestreamingnotebookoffline-first

usecase_code/50-ml-model-factory

15Factory lifecycle as an Azure Function

An Azure Function that runs the six ESAF scenarios, from creating a Factory to deleting it, so that a portal or a ticket system can order projects.

Azure FunctionsAzure FunctionsStorageKey Vaulthttp-apifactory-lifecycleoffline-first

usecase_code/10-azure-function/12_func_aifactory_lifecycle

16Azure Function that reads from storage

An HTTP-triggered Azure Function that lists and reads blobs with its managed identity, with a health endpoint.

Azure FunctionsAzure FunctionsStoragehttp-apistarter

usecase_code/10-azure-function/11_func_read_from_storage

17Starter: prompt agent with RAG in one file

One script that indexes a sample document in Azure AI Search and answers questions with a Foundry prompt agent on the Responses API.

Foundry startersMicrosoft FoundryAzure AI Searchragprompt-agentstarter

usecase_code/20-agent-foundry/agent_04_prompt_rag_responses_api.py

18Starter: prompt agent with a Fabric data agent

One script in which a Foundry prompt agent answers questions through a Microsoft Fabric data agent tool.

Foundry startersMicrosoft FoundryFabricfabricprompt-agentstarter

usecase_code/20-agent-foundry/agent_05_fabric_data_agent.py

Foundry prompt agents

Declarative prompt agents for knowledge, review and documentation. They need no application server.

Agent FactoryMicrosoft FoundryAzure AI Searchragprompt-agentfoundry-iqmcp

usecase_code/40-agent-factory/41-single-agent/prompt-agent

Hosted agent: Microsoft Agent Framework

A Foundry-hosted Python agent built with Microsoft Agent Framework that answers from the evidence of the knowledge agent.

Agent FactoryMicrosoft FoundryAzure AI Searchhosted-agentragfoundry-iq

usecase_code/40-agent-factory/41-single-agent/hosted-agent/agent-framework

Hosted agent: LangGraph

A Foundry-hosted agent that runs a small LangGraph graph and answers from the evidence of the knowledge agent.

Agent FactoryMicrosoft FoundryAzure AI Searchhosted-agentragfoundry-iq

usecase_code/40-agent-factory/41-single-agent/hosted-agent/langgraph

Hosted agent: OpenAI Agents SDK

A Foundry-hosted agent on the OpenAI Agents SDK, with the model on your Foundry endpoint and evidence from the knowledge agent.

Agent FactoryMicrosoft FoundryAzure AI Searchhosted-agentragfoundry-iq

usecase_code/40-agent-factory/41-single-agent/hosted-agent/openai-agent-sdk

Hosted agent: GitHub Copilot SDK

A Foundry-hosted agent that uses the GitHub Copilot SDK as its runtime, with a model from Microsoft Foundry.

Agent FactoryMicrosoft FoundryAzure AI Searchhosted-agentragfoundry-iq

usecase_code/40-agent-factory/41-single-agent/hosted-agent/github-copilot-sdk

Hosted agent: Claude on Foundry

A Foundry-hosted agent that answers grounded questions with a Claude model deployed in Foundry, through the Anthropic Messages SDK.

Agent FactoryMicrosoft FoundryAzure AI Searchhosted-agentragfoundry-iq

usecase_code/40-agent-factory/41-single-agent/hosted-agent/anthropic-agents

Hosted agent: your own code on the Responses API

A minimal Foundry-hosted Python agent that calls the Responses API itself after the knowledge agent returns the evidence.

Agent FactoryMicrosoft FoundryAzure AI Searchhosted-agentragfoundry-iq

usecase_code/40-agent-factory/41-single-agent/hosted-agent/custom

Batch classification with an Azure ML pipeline

Trains a classification model and scores a dataset in batch with an Azure Machine Learning pipeline. Tested in Azure.

Model FactoryAzure Machine Learningml-trainingbatch

usecase_code/50-ml-model-factory/usecase-type/batch/classification/azureml-pipeline

Batch regression with an Azure ML pipeline

Trains a regression model and scores a dataset in batch with an Azure Machine Learning pipeline. Tested in Azure.

Model FactoryAzure Machine Learningml-trainingbatch

usecase_code/50-ml-model-factory/usecase-type/batch/regression/azureml-pipeline

Batch forecasting with an Azure ML pipeline

Trains a time-series forecasting model and scores in batch with an Azure Machine Learning pipeline. Tested in Azure.

Model FactoryAzure Machine Learningml-trainingbatchforecasting

usecase_code/50-ml-model-factory/usecase-type/batch/timeseries-forecasting/azureml-pipeline

Batch forecasting in a notebook

Trains a time-series forecasting model and scores in batch from a notebook. Tested in Azure.

Model FactoryAzure Machine Learningml-trainingbatchforecastingnotebook

usecase_code/50-ml-model-factory/usecase-type/batch/timeseries-forecasting/notebook

Batch multi-label image classification with an Azure ML pipeline

Trains a multi-label image classification model and scores images in batch with an Azure Machine Learning pipeline. Tested in Azure.

Model FactoryAzure Machine Learningml-trainingbatchcomputer-vision

usecase_code/50-ml-model-factory/usecase-type/batch/computer-vision/multi-label/azureml-pipeline

Batch multi-label image classification in a notebook

Trains a multi-label image classification model and scores images in batch from a notebook. Tested in Azure.

Model FactoryAzure Machine Learningml-trainingbatchcomputer-visionnotebook

usecase_code/50-ml-model-factory/usecase-type/batch/computer-vision/multi-label/notebook

Batch object detection with an Azure ML pipeline

Trains an object detection model and scores images in batch with an Azure Machine Learning pipeline. Tested in Azure.

Model FactoryAzure Machine Learningml-trainingbatchcomputer-vision

usecase_code/50-ml-model-factory/usecase-type/batch/computer-vision/object-detection/azureml-pipeline

Batch object detection in a notebook

Trains an object detection model and scores images in batch from a notebook. Tested in Azure.

Model FactoryAzure Machine Learningml-trainingbatchcomputer-visionnotebook

usecase_code/50-ml-model-factory/usecase-type/batch/computer-vision/object-detection/notebook

Before you run a template

  1. Ask your platform team for a project: see Usage docs and the prerequisites.
  2. Check that the project has the services on the card. The Azure resource library names the setting that switches each one on.
  3. Open the template and follow its guide. New to the Agent Factory or the Model Factory? Start with Run your first agent or Train your first model.

Where the templates live

Folder in usecase_code What it holds
40-agent-factory The Agent Factory: prompt agents, hosted agents, RAG, voice, MCP and the agents that work with Fabric and Azure Machine Learning.
50-ml-model-factory The Model Factory: batch, online and streaming examples for each task and technology. The library lists the examples that are tested in Azure. The use-case tree has all of them.
10-azure-function Azure Functions, including the one that runs the six ESAF scenarios.
20-agent-foundry Two starter scripts for Foundry agents, each in one file.