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
In a nutshell
  • 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.

User requestAgentmodel and instructionsDecideanswer or call toolToolsearch, function, APIAgent respondsstate kept

How it works

Defining an agent

PartWhat it sets
Model deploymentThe model the agent reasons with
InstructionsRole, goal, tone, rules and limits
ToolsWhat the agent can do or look up
Conversation stateHow 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

ToolUse it to
File searchSearch files you upload to the agent
Azure AI SearchGround the agent on an existing search index
Web search or Grounding with BingAnswer with current public web information
Code interpreterWrite and run Python in a sandbox, for calculations, data analysis and charts
Function callingCall your own code; the model returns the function name and arguments, your app runs it and returns the result
Azure FunctionsCall code hosted in Azure Functions
OpenAPICall a REST API described by an OpenAPI specification
Model Context Protocol (MCP)Connect to tools exposed by an MCP server
Computer useOperate an application through its screen, for apps with no API
Browser automationCarry out tasks in a web browser
SharePoint and Fabric dataGround 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

Function calling: the agent's model decides a function is needed and returns the function name and arguments; your application runs the function and sends the result back, and the agent then writes the final answer.

  • 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:

PatternHow it works
Orchestrator with sub-agentsA main agent delegates tasks to specialist agents and combines their results
Sequential workflowAgents run in a fixed order, each passing output to the next
Group chat or handoffControl 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.
Exam tip

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.
Watch out

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.