Agents in Microsoft Foundry
Agents are a flagship new AI-901 topic. They did not exist on the old AI-900 exam, and they sit inside objective 2.1, part of the Microsoft Foundry implementation skill area that makes up 55–60% of the exam.
What an agent is
A plain chat completion is one stateless request and one response. Your app sends a prompt to a deployed model, receives text back, and the service does not automatically keep the larger task, tool choices, or prior turns unless your app sends that context again. An agent is different. It pairs a model with persistent instructions, tools it may call, optional knowledge, and conversation state. It can run multiple steps toward a goal: reason, call a tool, read the result, call another tool, and answer with evidence.
| Aspect | Chat completion | Agent |
|---|---|---|
| State | Stateless unless your application resends context. | Can use persistent conversations so follow-up turns keep context. |
| Tools | The model only answers from the prompt unless your app separately calls services. | The agent can call configured tools such as search, functions, files, or MCP tools. |
| Steps | Usually one request and one answer. | Can run multiple reasoning and tool-use steps before returning a final response. |
| Typical use | Simple Q&A, rewriting, summarizing, or single-turn generation. | Goal-oriented work such as answering from documents, taking actions, or coordinating specialist agents. |
The exam name you need is Foundry Agent Service. It is part of Microsoft Foundry, the current platform name. You may still see older documentation say Azure AI Foundry; treat it as the same product, but use current names on this site. For AI-901, assume prompt agents are the default answer unless the question says you must write orchestration code, package it, or expose a managed custom endpoint.
| Type | You provide | Foundry provides | Best for |
|---|---|---|---|
| Prompt agent | Instructions, a model deployment, and tools through the portal or SDK. | Hosting, execution, versions, playground testing, and tool wiring. | Most exam scenarios where no custom orchestration code is required. |
| Hosted agent | Orchestration code written with an agent framework such as Agent Framework, LangGraph, or OpenAI Agents SDK. | A managed endpoint, autoscaling, deployment hosting, tracing, and the agent's own Entra identity. | Production agents that need custom control flow, custom routing, or code-owned orchestration. |
| Ephemeral agent | An agent definition inside your application request to the Responses API. | Model inference and tool calling for that request without creating a durable agent resource. | Lightweight or dynamic cases where the definition lives in code. |
An agent does not automatically mean a large application. Sometimes the correct implementation is a declarative prompt agent with the right grounding or action tool attached. That is a major difference from older study habits: AI-901 expects you to think like a builder using Foundry, not just name a workload.
Anatomy of a Foundry agent
An agent is built from a small set of pieces. The model is the deployed Foundry Models deployment that generates and reasons. The instructions are durable system-level guidance. Tools are capabilities the agent may call. A toolbox groups managed tools behind one MCP endpoint. Conversations hold persistent multi-turn state. Identity controls what the agent can access, often through Entra-based authorization.
Good instructions are specific. State the role, the scope, the tone, and the refusal boundaries. Tell the agent what sources to trust, when to call tools, when to ask for missing information, and when to say it cannot answer. Do not bury critical rules in a long personality paragraph. AI-901 questions often reward the candidate who separates model choice from instruction design and tool grounding.
A conversation is the durable state for a multi-turn exchange. Reusing the same conversation id is what makes the next turn a follow-up instead of a brand-new question. If the app creates a new conversation for every user turn, the agent loses the prior context unless the app restates it.
from azure.ai.projects import AIProjectClient
from azure.ai.projects.models import PromptAgentDefinition
from azure.identity import DefaultAzureCredential
project = AIProjectClient(
endpoint="https://<resource>.services.ai.azure.com/api/projects/<project>",
credential=DefaultAzureCredential(),
)
agent = project.agents.create_version(
agent_name="PolicyHelper",
definition=PromptAgentDefinition(
model="gpt-5-mini",
instructions="You answer policy questions from trusted sources and refuse unsupported claims.",
),
)openai = project.get_openai_client(agent_name="PolicyHelper")
conversation = openai.conversations.create()
first = openai.responses.create(
conversation=conversation.id,
input="What is the travel meal policy?",
)
print(first.output_text)
follow_up = openai.responses.create(
conversation=conversation.id,
input="Does that also apply to international trips?",
)
print(follow_up.output_text)The SDK package to recognize is azure-ai-projects 2.x. In examples, the project endpoint points to a Foundry project, authentication commonly uses DefaultAzureCredential, and the model value is the deployment name your project can use.
Tools: the highest-value agent decision
Tools are where agents become useful. A model can write language, but tools let the agent retrieve grounded information, execute deterministic code, call existing systems, use a browser, create images, or coordinate with other agents. On the exam, many questions are really tool-selection questions.
| Tool | What it does | Reach for it when |
|---|---|---|
| Code interpreter | Runs sandboxed Python for analysis, calculations, and file manipulation. | The agent must compute, transform a file, inspect tabular data, or produce a calculated result. |
| File search | Performs vector search over uploaded files attached to the agent. | You have a small or managed document set and want fast grounding without building a search service. |
| Web search / Grounding with Bing | Retrieves current public web information with grounding. | The answer depends on recent or public web content, not private corporate files. |
| Azure AI Search | Searches an existing or custom index, often with vector and keyword retrieval. | You already have enterprise search, need indexing control, or need RAG over larger internal content. |
| Function calling | Lets the model choose a typed function and arguments for your app to execute. | Your app owns the operation and needs structured parameters, such as looking up an order. |
| OpenAPI tools | Expose REST APIs described by an OpenAPI document as callable tools. | You need the agent to call existing HTTP APIs with documented operations. |
| MCP | Connects to Model Context Protocol servers that expose tools and resources. | You want a standard way to plug in external systems or reusable tool servers. |
| Agent-to-agent (A2A) | Allows an agent to delegate work to another specialist agent. | A coordinator must route tasks to specialists, such as research, planning, or support agents. |
| Browser automation | Lets an agent navigate and interact with web pages. | The task requires operating a web UI rather than calling a clean API. |
| SharePoint | Connects the agent to SharePoint content and permissions-aware files. | The source of truth is SharePoint documents or pages. |
| Azure Functions | Calls serverless functions you control. | You need custom business logic, validation, or system integration behind a managed endpoint. |
| Image generation | Generates images through current image models such as the gpt-image-1 family. | The agent must create visual assets from text instructions. |
Grounding an agent
Grounding means giving the model relevant source content at answer time. It is usually the answer before fine-tuning. If the question says the model is wrong because it does not know private or current facts, attach a retrieval tool instead of changing the model weights.
| Source need | Best grounding choice | Why |
|---|---|---|
| Internal documents uploaded for the agent | File search | Simple setup, agent-managed retrieval, and no separate index design. |
| Existing enterprise search index | Azure AI Search | Uses your index, analyzers, permissions strategy, vector fields, and retrieval tuning. |
| Current public web information | Grounding with Bing | Searches public web sources when freshness matters. |
Do not choose Grounding with Bing for internal documents. Do not choose file search when the organization already invested in a controlled Azure AI Search index. Match the tool to the content location and governance need.
Single-agent versus multi-agent
A single agent is easier to build and easier to test. Use it when one instruction set and one tool set can handle the task. A multi-agent design adds an orchestrator. The orchestrator receives the goal, decides which specialist should act, and routes work through A2A. That is useful when the work naturally splits into specialist responsibilities, not just because the scenario sounds important.
A toolbox is different from a multi-agent team. A toolbox is a managed group of tools exposed behind one MCP endpoint. It simplifies how agents discover and call a related set of tools. Think: many tools, one managed MCP doorway.
Building a single agent
“Create and test a single-agent solution in the Foundry portal” is an exam objective in its own words. Do this once and every agent question gets easier, because you will have seen where each concept actually lives.
- Pick a model deployment. The agent needs a deployed model to think with. A small, fast general chat model is fine to start.
- Write the instructions. State the role, the scope, the tone, and what to refuse. This is the agent’s persistent system prompt.
- Attach a tool. Start with one. File search over a handful of uploaded documents is the clearest first tool because you can see grounding working.
- Test it in the playground. Ask something answerable only from your files, then something that is not, and watch the difference.
- Call it from a client. Create a conversation, send a turn, then send a follow-up on the same conversation id.
openai = project.get_openai_client(agent_name="MyAgent")
conversation = openai.conversations.create()
r1 = openai.responses.create(
conversation=conversation.id,
input="What does our refund policy say about damaged goods?")
print(r1.output_text)
r2 = openai.responses.create(
conversation=conversation.id,
input="And how long do customers have?")
print(r2.output_text)The second call carries no restatement of the first question, yet the agent still understands “how long do customers have.” That is the conversation doing the work. Drop the conversation argument and the follow-up becomes a fresh, contextless question.
More than half of AI-901 is implementation. Reading about agents produces a shallow, brittle kind of knowledge that collapses under a BEST or FIRST question. Fifteen minutes in the portal — deploy a model, write three sentences of instructions, attach file search, ask it two questions — will teach you more than rereading this page.
Where people lose points
| The mistake | What is actually true |
|---|---|
| Choosing fine-tuning so the agent “knows” company documents | Fine-tuning changes style and format, not facts, and it goes stale the moment the documents change. Attach a grounding tool instead. |
| Assuming an agent requires custom code | A prompt agent is entirely declarative — model, instructions, tools. You write no orchestration code at all. |
| Expecting a follow-up turn to keep context automatically | Context comes from reusing the same conversation id. A new conversation starts from nothing. |
| Reaching for Grounding with Bing for internal content | Bing searches the public web. Internal documents mean file search or an Azure AI Search index. |
| Using Azure AI Search when the files were uploaded to the agent | The Azure AI Search tool queries an existing index. If you just uploaded documents to the agent, file search is the simpler answer. |
| Treating a toolbox as a multi-agent system | A toolbox is many tools behind one MCP endpoint. Multi-agent means an orchestrator routing to specialist agents through agent-to-agent. |
| Building a multi-agent system because the scenario sounds complex | Reach for multi-agent when the work genuinely splits into specialist responsibilities, not because the wording is impressive. |
| Answering with threads, messages, and runs | That is the older Assistants API vocabulary. Current Foundry uses conversations and responses. |
The night-before cheat sheet
The shape of it
- Chat completion — one request, one answer, no memory, no tools.
- Agent — model plus instructions plus tools plus conversation, running multiple steps toward a goal.
- Prompt agent — declarative, no orchestration code, hosted by Foundry.
- Hosted agent — your code, Foundry runs it with an endpoint, autoscaling, and its own identity.
- Ephemeral — defined only in your code via the Responses API, no agent resource.
The parts
- Model — the deployment it thinks with, swappable.
- Instructions — role, scope, tone, refusals.
- Tools — what it can actually do.
- Toolbox — a managed group of tools behind one MCP endpoint.
- Conversation — persistent multi-turn state; reuse the id to keep context.
- Identity — an Entra managed identity for reaching secured resources.
Reach for this tool when…
| Code interpreter | Calculate, analyze data, produce a chart |
| File search | Answer from documents uploaded to the agent |
| Azure AI Search | Answer from content already in a search index |
| Grounding with Bing | Answer needs current public web information |
| Function calling | Take an action or read a live system through your own code |
| OpenAPI tool | Call an existing REST API described by a spec |
| MCP | Connect to any MCP-compatible server |
| Agent-to-agent | Hand work to a specialist agent |
Uploaded documents → file search. Existing index → Azure AI Search. Public web, current information → Grounding with Bing. If the scenario says “without retraining” or “must cite sources,” the answer is grounding, never fine-tuning.