Lesson 15 of 26 · see all lessons
Start here: the exam, Python basics and responsible AI (skill area 1, 40-45%)
AI models: how they work, choosing and deploying (skill area 1)
AI workloads: text, speech, vision and extraction (skill area 1)
Generative AI apps and agents in Foundry (skill area 2, 55-60%)
Text, speech, vision and extraction apps in Foundry (skill area 2)
- 17. Building a text analysis app
- 18. Building speech apps: spoken prompts and Azure Speech
- 19. Building vision apps: images in prompts and generated images
- 20. Extracting information with Content Understanding: documents and forms
- 21. Content Understanding for images, audio and video, and a small extraction app
Final review and four mock exams
18 min
Creating and testing a single agent in the Foundry portal
Build an agent with instructions and tools in Foundry Agent Service and test it in the portal.
By the end of this lesson you can
- Explain what makes an agent different from a model deployment
- Choose the right tool for an agent: file search, web search, code interpreter and more
- Create, save and test a prompt agent in the Foundry portal
- Apply responsible AI limits to what an agent can do
From earlier lessons · 1 of 2
In a Foundry SDK chat app, which line prints the model's reply?
Pick one answer.
From earlier lessons · 2 of 2
A chat app must let the service keep the history between calls. Which argument do you pass on the second call?
Pick one answer.
Fernhill's chat app answers well, until a customer asks, "Is my Porto hotel's pool open in March?" The model doesn't know, and it can't look anything up. The support lead wants an assistant that reads Fernhill's policy files and searches the web when it must. That's not a better prompt. That's an agent.
What makes an agent
Exam depth: know it cold.
An agent is a model plus instructions plus tools. Instructions work like a system message. Tools let the agent look things up or take actions, such as searching files or calling an API. The agent decides when to use each tool.
Foundry Agent Service is the managed service that runs agents in Foundry. It handles conversations, tool calls and the agent's lifecycle.
It offers three agent types:
- Prompt agent: defined only by configuration, with no code to host. You build it in the portal. This is the one AI-901 tests.
- Voice-based prompt agent: a prompt agent for real-time spoken conversations.
- Hosted agent: your own code, run by Foundry as a container.
A model deployment answers. An agent is saved in the project and can use tools to act.
Fernhill wants an assistant that checks a customer's booking in its reservation system and then changes the date. What should you build?
Pick one answer.
Tools: how an agent acts
Exam depth: know it cold.
| Tool | What it does | Pick it when |
|---|---|---|
| File search | Searches documents you upload. | Answers must come from your files. |
| Web search (or Grounding with Bing Search) | Searches the web with Bing. | Answers need current public information. |
| Code interpreter | Writes and runs Python in a sandbox. | Math, data files, charts. |
| Function calling | The agent asks your app to run a function you defined. | Your own code must do the work. |
| OpenAPI | Calls a REST API described by an OpenAPI spec. | An existing web API should be called. |
| MCP | Connects tools on a remote Model Context Protocol server. | A team already exposes tools over MCP. |
| Foundry IQ (Azure AI Search) | Searches an existing search index. | Content is already indexed in Azure AI Search. |
Decision rule: your documents, file search. Today's public facts, web search. Calculations, code interpreter. Another system, function, OpenAPI or MCP.
Recognize the rest: SharePoint, Fabric, browser automation, image generation and agent-to-agent (A2A).
Match
Match each Fernhill request to the agent tool that handles it
Pick an item on the left, then its match on the right.
A bank's agent must answer questions about this morning's exchange-rate news. The answer can't come from the model's training data. Which tool should you add?
Pick one answer.
Conversations, responses and versions
Exam depth: recognize it.
Agent Service works with three pieces:
- Agent: the saved model, instructions and tools.
- Conversation: a stored history that later turns reuse. It holds items: messages, tool calls and tool outputs.
- Response: one run of the agent on some input. It adds output items to the conversation.
Older material, built on the Assistants API, uses threads, messages and runs. Today's terms are conversations, items and responses.
Each time you save an agent, Foundry stores a version. A saved version can't change; edits make a new one. In code you refer to an agent as <name>:<version>. You can't rename an agent after you create it.
For the statement, select Yes if it is true. Otherwise, select No. "After you create a prompt agent in the Foundry portal, you can rename it."
Pick one answer.
Test, trace and evaluate
Exam depth: know it cold for the playground, recognize it for tracing and evaluation.
The agents playground is where you build and test with no code. You set instructions, attach tools and knowledge, and hold multi-turn chats.
- Unsaved changes can be tested, but they're lost when you leave. Save to create a version.
- Traces show each model call and tool call, with inputs and outputs. Use them to check the agent used the tool you expected. Select Traces under a reply to see them.
- Evaluations score answers for quality and safety, so you catch regressions between versions. Playground evaluations are on by default and are billed.
Responsible AI for agents
Exam depth: know it cold.
An agent that acts can do more harm than one that only talks. Limit it.
- Least privilege: give the agent's identity and tool connections only the access they need. Read-only beats read-write.
- Human approval: for risky actions, make a person approve first. With MCP tools, the Responses API asks for approval by default before data goes to a remote server.
- Guardrails: they apply to agents too, and help block unsafe output and prompt injection.
- Clear instructions: say which tools to use and what never to do.
- Test and trace: check the tool calls before you publish, and keep monitoring after.
Try it in the Foundry portal
You need a project with a deployed model, from lesson 13.
- On the project home page, under Build an agent, select Create an agent. (Or go to Build > Agents > Create agent.)
- Enter a unique name, such as fernhill-support. Keep interaction mode on Text. Select Create to open the playground.
- In Model, pick your deployment.
- In Instructions, paste your system prompt from lesson 12. Add: "Use web search for current travel news. Cite your sources."
- In Tools, select Add > Add tools. Choose Web search, then Add tool.
- Select Save and start new chat. That saves a version.
- Ask about a current event at a Fernhill destination. Select Traces under the reply to confirm the web search call.
- Clean up: delete the agent, or delete the resource group in the Azure portal.
Exam-style practice
A clinic's agent must answer questions only from its 200-page patient handbook, which the team will upload. Which tool should you add?
Pick one answer.
You change an agent's instructions in the agents playground. You want to compare the new behavior with last week's in an evaluation. What must you do first?
Pick one answer.
An agent can issue refunds through an API tool. Managers want no refund sent without a person's OK. What should you do?
Pick one answer.
Worth keeping
- Agent = model + instructions + tools; Foundry Agent Service runs it.
- Your files: file search. Current facts: web search. Math: code interpreter. Other systems: function, OpenAPI, MCP.
- Conversations hold items; responses run the agent. Old terms: threads, messages, runs.
- Save to create a version; trace tool calls; evaluate before you publish.
- Control actions with least privilege and human approval, not instructions alone.
The Fernhill agent works in the playground. Now the website needs to talk to it, one customer conversation at a time. Next lesson you write the small Python client that calls your agent by name.
Leaderboard
Loading…
50 XP for each lesson you finish, 10 for each right answer. Names show only for learners who turn on Show me on leaderboards.
Embed this practice on your site
Free for classrooms, blogs and study groups. Paste this into any page that accepts HTML.
Report a copyright problem with this lesson
Sources for this lesson (10)
Each fact in the lesson is marked with the number of the page it comes from.
- [2]Microsoft Learn: Study guide for Exam AI-901: Microsoft Azure AI Fundamentals
- [18]Microsoft Learn: Quickstart: Get started with Microsoft Foundry SDK
- [49]Microsoft Learn: Microsoft Foundry Playgrounds
- [51]Microsoft Learn: What is Microsoft Foundry?
- [102]Microsoft Learn: Use the Azure OpenAI Responses API
- [103]Microsoft Learn: Agents in Microsoft Foundry
- [104]Microsoft Learn: Build with agents, conversations, and responses
- [105]Microsoft Learn: Agent development lifecycle
- [106]Microsoft Learn: What is Toolbox in Foundry?
- [107]Microsoft Learn: Quickstart: Create a web research agent