Lesson 15 of 26 · see all lessons
  1. Start here: the exam, Python basics and responsible AI (skill area 1, 40-45%)

    1. 1. Start here: the AI-901 exam, the plan and what you already know
    2. 2. The Python and Azure basics AI-901 expects
    3. 3. Responsible AI: the six principles in practice
  2. AI models: how they work, choosing and deploying (skill area 1)

    1. 4. How generative AI models work
    2. 5. Choosing the right AI model for the job
    3. 6. Deploying a model: deployment options and configuration parameters
  3. AI workloads: text, speech, vision and extraction (skill area 1)

    1. 7. Common AI workloads: from chat and agents to vision and extraction
    2. 8. Text analysis: key phrases, entities, sentiment and summaries
    3. 9. Speech: recognition and synthesis
    4. 10. Computer vision and image generation
    5. 11. Extracting information from documents, images, audio and video
  4. Generative AI apps and agents in Foundry (skill area 2, 55-60%)

    1. 12. Writing system and user prompts
    2. 13. Deploying a model and chatting with it in the Foundry portal
    3. 14. Building a lightweight chat client with the Foundry SDK
    4. 15. Creating and testing a single agent in the Foundry portal
    5. 16. Building a lightweight client app for an agent
  5. Text, speech, vision and extraction apps in Foundry (skill area 2)

    1. 17. Building a text analysis app
    2. 18. Building speech apps: spoken prompts and Azure Speech
    3. 19. Building vision apps: images in prompts and generated images
    4. 20. Extracting information with Content Understanding: documents and forms
    5. 21. Content Understanding for images, audio and video, and a small extraction app
  6. Final review and four mock exams

    1. 22. Final review and exam day: every decision on one page
    2. 23. Mock exam 1
    3. 24. Mock exam 2
    4. 25. Mock exam 3
    5. 26. Mock exam 4
See the leaderboard

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.

[2]

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.

[103][104][105]

An agent wraps a model with instructions and toolsFernhill support agentModel deploymentInstructionsToolsFile search: policy PDFsWeb searchCode interpreterOpenAPI: booking systemGenerates the wordsRole, rules and when to usewhich toolActions on other systems needthe tightest limits

[103]

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.

ToolWhat it doesPick it when
File searchSearches 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 interpreterWrites and runs Python in a sandbox.Math, data files, charts.
Function callingThe agent asks your app to run a function you defined.Your own code must do the work.
OpenAPICalls a REST API described by an OpenAPI spec.An existing web API should be called.
MCPConnects 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).

[49][103][106][107]

Match

Match each Fernhill request to the agent tool that handles it

Pick an item on the left, then its match on the right.

[103][106]

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.

[106][107]

Model: "I can't check today's weather." Agent with web search: "Checking now." Picture: Claymation-style scene: soft clay figures on a small clay desk.

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.

[51][104][105]

Rendering diagram…
The app picks an agent, keeps one conversation, and each response adds items to it. The follow-up question works because the conversation holds the first turn.

[104]

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.

[105]

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.

[49][105][107]

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.

[102][103][105]

[105]

Try it in the Foundry portal

You need a project with a deployed model, from lesson 13.

  1. On the project home page, under Build an agent, select Create an agent. (Or go to Build > Agents > Create agent.)
  2. Enter a unique name, such as fernhill-support. Keep interaction mode on Text. Select Create to open the playground.
  3. In Model, pick your deployment.
  4. In Instructions, paste your system prompt from lesson 12. Add: "Use web search for current travel news. Cite your sources."
  5. In Tools, select Add > Add tools. Choose Web search, then Add tool.
  6. Select Save and start new chat. That saves a version.
  7. Ask about a current event at a Fernhill destination. Select Traces under the reply to confirm the web search call.
  8. Clean up: delete the agent, or delete the resource group in the Azure portal.

[18][107]

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.

[103][106]

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.

[105]

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.

[102][105]

FlashcardsIndex cardsFlashcards ⚡

Card 1 of 17

[49][51][103][104][105][106]

Worth keeping

  1. Agent = model + instructions + tools; Foundry Agent Service runs it.
  2. Your files: file search. Current facts: web search. Math: code interpreter. Other systems: function, OpenAPI, MCP.
  3. Conversations hold items; responses run the agent. Old terms: threads, messages, runs.
  4. Save to create a version; trace tool calls; evaluate before you publish.
  5. 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.

  1. [2]Microsoft Learn: Study guide for Exam AI-901: Microsoft Azure AI Fundamentals
  2. [18]Microsoft Learn: Quickstart: Get started with Microsoft Foundry SDK
  3. [49]Microsoft Learn: Microsoft Foundry Playgrounds
  4. [51]Microsoft Learn: What is Microsoft Foundry?
  5. [102]Microsoft Learn: Use the Azure OpenAI Responses API
  6. [103]Microsoft Learn: Agents in Microsoft Foundry
  7. [104]Microsoft Learn: Build with agents, conversations, and responses
  8. [105]Microsoft Learn: Agent development lifecycle
  9. [106]Microsoft Learn: What is Toolbox in Foundry?
  10. [107]Microsoft Learn: Quickstart: Create a web research agent