This repository provides a complete, end-to-end example of how to design, build, and deploy a production-ready multi-agent solution on Azure, leveraging Azure AI Foundry Agent Service and connected agents.
We will recreate a ticket-triage system in which a primary agent delegates to three specialists: priority, team assignment, and effort estimation. Then, we will map it to a reference architecture and walk through deployment choices so you can ship it for real workloads.
This repository automates the scenario by provisioning Azure infrastructure with Bicep, deploying a FastAPI container to Azure Container Apps, and wiring the app to a multi-agent workflow in Azure AI Foundry.
The solution coordinates four agents:
| Agent | Role | Output |
|---|---|---|
| Priority | Classifies urgency (High / Medium / Low) | e.g., “High” |
| Team | Suggests the owning team | e.g., “Infra” |
| Effort | Estimates delivery effort with supporting rationale | e.g., “Medium – provide remediation steps” |
| Triage | Orchestrates the specialists to produce a consolidated ticket summary | e.g., “High priority • Infra • Medium effort” |
The repository adds operational conveniences that go beyond the lab handout, including automated infrastructure deployment, repeatable agent bootstrapping, rate-limit-aware verification, and a consolidated test harness.
Azure Resource Group (azd-multiagent)
├─ Azure Container Apps Environment
│ └─ Container App (FastAPI triage API)
│ ├─ Managed Identity
│ └─ Azure Container Registry image
├─ Azure Container Registry
└─ Azure AI Foundry Project
├─ GPT-4o model deployment (capacity configurable)
├─ Project connection (AAD)
└─ Multi-agent graph (Priority, Team, Effort, Triage)
Infrastructure as Code: infra/main.bicep composes individual modules for the container app (infra/modules/containerapp.bicep), Azure AI Foundry resources (infra/modules/foundry.bicep), and container registry (infra/modules/acr.bicep).
Application: src/api/app.py hosts FastAPI endpoints that expose the triage capability. Environment variables emitted by the Bicep deployment provide the AI project endpoint and agent IDs.
Automation scripts:
scripts/bootstrap_agents.py– creates or refreshes the specialist + triage agents and persists their IDs to the currentazdenvironment.scripts/verify_agent.py– verifies a single agent run with retry/backoff controls.scripts/test_all_agents.py– runs all four agents in one command; automatically loads environment values from.azure/<env>/.env.scripts/bootstrap_agents.py+scripts/test_all_agents.pysupersede the manual Cloud Shell steps from the learning path.
├─ azure.yaml # azd template metadata
├─ infra/
│ ├─ main.bicep # top-level infrastructure composition
│ └─ modules/
│ ├─ containerapp.bicep # Azure Container Apps + env vars
│ ├─ foundry.bicep # Azure AI Foundry project + GPT-4o deployment
│ └─ acr.bicep # Azure Container Registry
├─ src/
│ └─ api/
│ ├─ app.py # FastAPI app exposing triage API
│ ├─ dockerfile # Container image definition
│ └─ requirements.txt # API dependencies
└─ scripts/
├─ bootstrap_agents.py # Creates the four agents and stores IDs
├─ verify_agent.py # Checks individual agent runs with retries
└─ test_all_agents.py # Aggregated agent test harness
- Azure subscription with access to GPT-4o capacity in Azure AI Foundry.
- Azure Developer CLI (azd) v1.9+ and the Azure CLI (
az) installed locally. - Python 3.12+ with
pipavailable on your development machine. - Docker (builds the API image if you make code changes).
- Sign in with
az loginbefore running any deployment commands.
ℹ️ The lab document recommends manually creating the project and agents. This repository automates those steps; no Cloud Shell edits are necessary.
From the repository root:
azd upThis command:
- Creates the Azure resource group and supporting resources.
- Deploys the FastAPI container image to Azure Container Apps.
- Provisions an Azure AI Foundry project, connection, and GPT-4o deployment (default capacity = 2, adjustable via
modelSkuCapacity).
At the end of the run, azd populates .azure/<env>/.env with output values including:
AIFOUNDRY_PROJECT_ENDPOINTprojectEndpoint(camelCase alias)AZURE_CONTAINER_REGISTRY_ENDPOINT- Container app URL (
apiUrl)
python scripts/bootstrap_agents.pyThis script waits for DNS propagation, creates the priority, team, effort, and triage agents, and saves their IDs to the current azd environment:
PRIORITY_AGENT_IDTEAM_AGENT_IDEFFORT_AGENT_IDTRIAGE_AGENT_ID
python scripts/test_all_agents.py --ticket "VPN outage affecting finance team"test_all_agents.py automatically loads .azure/<env>/.env, maps the projectEndpoint alias if necessary, and prints the response from each agent. Pass --env-file to point at a different environment snapshot.
Example output:
[PRIORITY]
[MessageRole.AGENT] High
[TEAM]
[MessageRole.AGENT] Infra ...
[EFFORT]
[MessageRole.AGENT] VPN outage remediation steps ...
[TRIAGE]
[MessageRole.AGENT] High priority • Infra • Moderate effort ...
To test a single agent with granular retry controls:
python scripts/verify_agent.py `
--agent-id $Env:TRIAGE_AGENT_ID `
--ticket "VPN outage affecting finance team" `
--max-attempts 12 `
--initial-backoff 12 `
--max-backoff 60 `
--show-transcriptUse this command when debugging rate-limit behaviour or inspecting transcripts in detail.
The official instructions walk through four phases, each of which maps to automation in this repo:
| Lab Section | Manual Step | Repository Equivalent |
|---|---|---|
| Create an Azure AI Foundry project | Portal-based project creation, GPT-4o deployment | infra/modules/foundry.bicep (deployed by azd up) |
| Create an AI Agent client app – Prepare environment | Clone repo, set up Python environment | Included in this repo; no Cloud Shell setup needed |
| Create AI agents | Manually edit agent_triage.py |
scripts/bootstrap_agents.py & scripts/test_all_agents.py automate agent creation and testing |
| Sign into Azure and run the app | Run python agent_triage.py interactively |
FastAPI service + verification scripts provide automated and API-based execution |
If you’re following the lab for certification prep, you can use this repository to accelerate the “build” phase, then compare outputs against the step-by-step guide.
-
Modify application code (e.g., update
src/api/app.py). -
Rebuild and redeploy:
azd deploy
-
Re-run
python scripts/bootstrap_agents.pywhenever you change instructions or tear down the AI project resources.
To remove all resources and avoid charges:
azd downAlternatively, delete the resource group from the Azure portal (mirroring the “Clean up” section in the Microsoft Learn instructions).
- Rate limits: Increase
modelSkuCapacityininfra/modules/foundry.bicepor adjust retry flags (--max-attempts,--initial-backoff,--max-backoff) on the verification scripts. - Agent not found: Run
python scripts/bootstrap_agents.pyto refresh the agent IDs after redeployments or project resets. - Environment variables missing: Ensure
.azure/<env>/.envexists. You can supply an explicit file with--env-file. - Authentication errors: Run
az loginand, if using managed identity locally, ensure you have access to the AI project.
- Develop a multi-agent solution – Microsoft Learn lab
- Azure AI Foundry SDK documentation
- Azure AI Agent Service overview
Feel free to extend the project with additional agents, integrate telemetry, or adapt the infrastructure modules for your organization’s deployment process.