Build and extend AI agents
Level ▰▰▰▱▱ L300
(L100 beginner → L500 expert)
Build a practical AI agent with Microsoft Foundry and Python, then extend it with company knowledge and tools.
The case
You work at Caldova, a pharmaceutical manufacturer. Caldova plans to launch a product sooner than expected, but its three factories can produce about 7% less than the launch requires.
The planning team must decide whether to move work between Caldova’s factories or hire an approved manufacturing partner, also called a contract manufacturer. You build a supply chain assistant to help them decide. It uses company policy, analyzes factory output, finds available production time, estimates partner costs, and checks whether enough materials are in stock.
What you’ll do
Complete the two core tasks for a working agent, then choose optional tasks based on what you want to practice.
| Section | Task | Level | Time |
|---|---|---|---|
| Core | Task 1 – Create and ground an agent | ▰▰▱▱▱ L200 | ~15 min |
| Core | Task 2 – Connect a remote MCP server | ▰▰▰▱▱ L300 | ~20 min |
| Optional | Task 3 – Call your agent from a client app | ▰▰▰▱▱ L300 | ~20 min |
| Optional | Task 4 – Add custom function tools | ▰▰▰▱▱ L300 | ~25 min |
| Optional | Task 5 – Capstone: build your own MCP server | ▰▰▰▰▱ L400 | ~35 min |
| Optional | Task 6 – Promote your assistant to a hosted agent | ▰▰▰▱▱ L300 | ~30 min |
Core tasks: about 35 minutes. Full lab, including every optional task: about 2 hours 25 minutes.
Note: Some of the technologies used in this exercise are in preview or in active development. You may experience some unexpected behavior, warnings, or errors.
Start with Getting started to create your Microsoft Foundry project and prepare the shared starter code. Each task includes the setup needed to start independently. If you complete the lab in order, you reuse the same environment and skip repeated setup.
![]()
Meet Anton, your AI guide.
You’ll spot Ask Anton tips throughout this lab. For more interactive help, use the Ask Anton app.
What is an agent?
An AI agent is a software service that uses generative AI to understand a request, decide what to do, and take action on a user’s behalf. What makes an agent genuinely useful isn’t the model alone. It also needs relevant knowledge and tools.
Is this lab for you?
Choose this lab if you want hands-on practice building an agent with Microsoft Foundry and Python. You write the agent code, connect remote and custom tools, and work directly with the tool-calling loop. The web chat interface is provided.
Tasks 4 and 5 also include a ready-to-run Microsoft Agent Framework version for comparison. Task 6 lets you deploy your code as a hosted agent.
Clean up
If you’re finished, delete the resources you created to avoid unnecessary Azure costs.
- In the Azure portal, navigate to the resource group that contains your Foundry resource.
- On the toolbar, select Delete resource group, enter the resource group name, and confirm.
The code you ran in Task 2 already deletes the agent version it creates. Portal agents are removed when you delete the resource group. If you provisioned with
azd, runazd downinstead to remove everything it created.