Items marked preview in this article are currently in preview. This preview is provided without a service-level agreement, and Microsoft doesn’t recommend it for production workloads. Certain features might not be supported or might have constrained capabilities. For more information, see Supplemental Terms of Use for Microsoft Azure Previews.
- Web search, which grounds responses in real-time public web results.
- The Microsoft Learn MCP server, which grounds responses in official Microsoft documentation. It’s a public endpoint that requires no authentication.
Prerequisites
This quickstart builds on the hosted-agent toolchain. Complete the Prerequisites in the hosted agent quickstart first, which cover the Azure subscription, project roles, Python, the Azure Developer CLI (azd), and the microsoft.foundry extension.
Step 1: Initialize the hosted agent
Initialize a hosted agent from the Foundry toolbox sample, which connects to a toolbox over MCP and exposes its tools to the model. You create the toolbox (my-toolbox) in the next step and point the agent at its endpoint. Run these commands in an empty directory.
--src flag scaffolds the agent into src/toolbox-agent.
Agent manifests (
agent.manifest.yaml) and standalone agent definitions (agent.yaml) are deprecated. As of the Foundry azd extensions (azure.ai.agents 1.0.0-beta.1), all hosted agent configuration lives in a single azure.yaml. See Author azure.yaml for hosted agents.Step 2: Create the toolbox
Create the toolbox, and then copy the MCP endpoint it returns. Set that endpoint as an environment variable in later steps. The sample’sazure.yaml defines the toolbox as an azure.ai.toolbox service and wires it to the hosted agent service with uses:. If you change the toolbox configuration, edit the toolbox service in azure.yaml, not src/toolbox-agent/agent.yaml.
First, point the toolbox commands at the Foundry project you selected during initialization. Reuse the endpoint that initialization already stored in your azd environment:
Step 3: Provision Azure resources
The agent reads the toolbox’s MCP endpoint from theTOOLBOX_ENDPOINT environment variable, which azure.yaml resolves from your azd environment. You set that value in the next steps. Provision the agent’s Azure resources:
Step 4: Run the agent locally
-
Point the local agent at your toolbox by setting these values in the
.envfile insrc/toolbox-agent. Paste the endpoint you copied in Step 2:azd ai agent runinjectsFOUNDRY_PROJECT_ENDPOINTand reads the.envfile for local runs. The sample handles the toolbox connection, headers, and authentication for you. -
Start the agent:
This command creates a virtual environment, installs dependencies, and serves the agent on
http://localhost:8088. Preview packages can produce pip warnings during setup. These warnings are nonblocking. -
In a separate terminal, send prompts that exercise the tools:
Step 5: Deploy to Foundry Agent Service
Store the endpoint you copied in Step 2 in yourazd environment, which azure.yaml resolves at deploy time. Then build and deploy the agent container:
Clean up resources
Delete the resources when you’re finished so you stop incurring charges.Troubleshooting
What you learned
In this quickstart, you:- Built a toolbox that combines web search and the Microsoft Learn MCP server behind one endpoint.
- Consumed the toolbox from a hosted agent that connects over the Model Context Protocol by using Azure Developer CLI, the Python SDK, or the .NET SDK.
- Ran the agent locally or validated it remotely and deployed it to Foundry Agent Service.