Implement Generative AI and Agentic Solutions · Topic 2 of 3
Building Agents with Foundry Agent Service
AI-103 agents: defining agents, built-in and custom tools, retrieval and memory, multi-agent orchestration, approvals and evaluating agent behavior.
- 4 min
- Includes a diagram
- An agent is a model plus instructions, tools and conversation state.
- Function calling: the model chooses the function and arguments; your code runs it.
- Code interpreter runs Python in a sandbox; file search and Azure AI Search ground answers.
What it is
An agent is an AI application that uses a model to decide what to do, then acts with tools to complete a goal. Foundry Agent Service hosts agents: you define the model, instructions and tools, and the service manages conversations, tool calls and identity.
How it works
Defining an agent
| Part | What it sets |
|---|---|
| Model deployment | The model the agent reasons with |
| Instructions | Role, goal, tone, rules and limits |
| Tools | What the agent can do or look up |
| Conversation state | How earlier messages are kept so the agent can follow up |
Tool definitions include a schema: the name, description and parameters. Clear descriptions help the model choose the right tool.
Tools
| Tool | Use it to |
|---|---|
| File search | Search files you upload to the agent |
| Azure AI Search | Ground the agent on an existing search index |
| Web search or Grounding with Bing | Answer with current public web information |
| Code interpreter | Write and run Python in a sandbox, for calculations, data analysis and charts |
| Function calling | Call your own code; the model returns the function name and arguments, your app runs it and returns the result |
| Azure Functions | Call code hosted in Azure Functions |
| OpenAPI | Call a REST API described by an OpenAPI specification |
| Model Context Protocol (MCP) | Connect to tools exposed by an MCP server |
| Computer use | Operate an application through its screen, for apps with no API |
| Browser automation | Carry out tasks in a web browser |
| SharePoint and Fabric data | Ground on enterprise content and data |
| Agent-to-agent (A2A) | Delegate a task to another agent through its A2A endpoint |
Other services, such as Azure Content Understanding for documents and media, can be reached through function calling, OpenAPI or MCP tools.
Retrieval, function calling and memory

- Retrieval tools ground answers in documents or indexes and return citations.
- Function calling lets the agent trigger business logic, such as looking up an order.
- Memory keeps the conversation history; longer-term memory can store facts about a user across sessions.
Multi-agent solutions
Complex work can be split across specialized agents:
| Pattern | How it works |
|---|---|
| Orchestrator with sub-agents | A main agent delegates tasks to specialist agents and combines their results |
| Sequential workflow | Agents run in a fixed order, each passing output to the next |
| Group chat or handoff | Control passes between agents based on context or rules, for example to escalate or hand off to an expert agent |
Multi-agent designs keep each agent's instructions and tools focused, but add latency and complexity. Use them when one agent's instructions and tools become too large to manage.
Agents built with other frameworks, such as LangGraph, can be packaged in a container and run in Foundry as hosted agents, keeping their own orchestration code while gaining managed hosting and identity.
Autonomy and safeguards
- Decide which actions the agent may take alone and which need human approval.
- Limit tools and the agent's identity to what is needed.
- Set limits on steps or cost to stop runaway loops.
Monitoring and evaluating agents
- Tracing shows each model call and tool call in a run.
- Agent evaluators check task completion, correct tool selection and accurate tool arguments.
- Error analysis groups failed runs to find the cause: wrong tool, bad arguments, missing data or unclear instructions.
If the system must call your own internal logic and keep it in your code, use function calling. If the API is already described by an OpenAPI spec, use the OpenAPI tool.
How the exam asks about this
- "An agent must run Python to analyze an uploaded CSV." Code interpreter.
- "An agent must use a legacy desktop app with no API." The computer use tool.
- "A team has an agent built with LangGraph and wants Foundry to host it." Deploy it as a hosted agent.
What to remember for the exam
- An agent is a model plus instructions, tools and conversation state.
- Function calling: the model chooses the function and arguments; your code runs it.
- Code interpreter runs Python in a sandbox; file search and Azure AI Search ground answers.
- Multi-agent patterns: orchestrator, sequential, handoff.
- Safeguard autonomy with approvals, least privilege and limits; evaluate tool choice and task completion.
With function calling, the model does not execute your function. It returns the call; your application runs it and sends back the result.
Common mistakes
Giving one agent every tool. Too many tools confuse tool selection.
Assuming function calling runs code in Azure. Your app runs it.
Using multi-agent designs for simple tasks. One agent is simpler and faster.
Check yourself
Which tool lets an agent run Python code in a sandbox?
Code interpreter.
What happens when an agent uses function calling?
The model returns the function name and arguments; the application runs the function and returns the result to the agent.
When should you split work across multiple agents?
When one agent's instructions and tools become too large or the work divides into distinct specialist tasks.
Topic 2 of 3 in Implement Generative AI and Agentic Solutions
Test yourself on Implement Generative AI and Agentic Solutions
The full Microsoft AI-103 question bank has 648 questions, with timed practice exams and an explanation for every answer.
This study guide is independent and is not affiliated with, endorsed by, or sponsored by Microsoft. Vendor names, certification names and exam codes are trademarks of their respective owners and are used for identification only.