AI agents in Foundry

Prompt, voice and hosted agents, tools and toolboxes, and how a client application talks to an agent. Heavily updated since AI-900.

  • Gen AI apps & agents
  • 24 minutes
  • High priority

After this lesson you can

  • Define an agent as model + instructions + tools
  • Choose between a prompt agent, a voice-based prompt agent, a hosted agent, and the Responses API
  • Pick the right tools for a scenario and explain what a toolbox is

What makes something an agent

Know this: The definition to memorise

An agent = a model (the reasoning engine) + instructions (who it is, what it may do) + tools (how it acts on the world). Remove the tools and you have a chatbot.

Chat completionAgent
InputA questionA goal
ProcessOne prompt, one answerA loop of reasoning and tool calls
Can act on other systemsNoYes, through tools
StateYou manage the historyThe service manages conversation state

Check your understanding

Gen AI apps & agents

What are the three building blocks of an AI agent?

Three agent types, plus one escape hatch

Changed: This terminology is new and very likely to be tested

Foundry Agent Service now offers prompt agents, voice-based prompt agents and hosted agents. If your notes only describe "creating an agent with instructions and tools" without naming the types, they predate this.

Prompt agentVoice-based prompt agentHosted agentResponses API directly
What you provideConfiguration: instructions, model, toolsThe same, plus voice, audio and greeting settingsYour own code and frameworkYour own code, running anywhere
Authoring surfacePortal, SDK or RESTPortal, SDK or RESTAgent Framework, LangGraph, OpenAI or Anthropic Agent SDKs, GitHub Copilot SDK, custom codeAny client
Runtime code to maintainNoneNone - Voice Live runs the speech sideYes - your agent logicYes
Compute to manageNone, fully managedNone, fully managedContainer compute, Foundry-managedYours
Agent resource in FoundryYes, named and versionedYes, named and versionedYesNo - the agent is ephemeral
Cost modelInference + tool usageVoice Live + model usageInference + tool usage + container computeInference + tool usage
Best forFast start, production agents with no custom orchestrationReal-time spoken conversations, call centresAgents that call into your own code or custom orchestrationCode you already run elsewhere

Every agent type gets a managed endpoint, automatic scaling, a Microsoft Entra identity, and access to Foundry models and platform tools. The differences are about who writes the runtime logic, who pays for compute, and whether people type or talk. A hosted agent ships as a container image or a .zip of source code that Foundry builds for you.

Check your understanding

Gen AI apps & agents

Foundry Agent Service offers prompt agents, voice-based prompt agents and hosted agents. Which describes a prompt agent?

Check your understanding

Gen AI apps & agents Hard

Match each requirement to the way you should build the agent.

Drag each item into the row it belongs in, or select an item and then select the row. Each item may be used once, more than once, or not at all. Each correct selection is worth one point.

Best approach

Answer area

  • Ship an internal assistant quickly with no runtime code to maintain
  • Run custom orchestration logic written with LangGraph, with Foundry handling hosting and scaling
  • Call Foundry models and tools from code you already run elsewhere, with no agent resource in Foundry
  • Answer customer phone calls in real time, with no voice orchestration code to host
Fill every row, then check.

Tools and toolboxes

Tools are what let an agent do more than talk. Read the verbs in a scenario and the tool list writes itself.

The scenario says…Tool you need
"answer from our documents / policies / knowledge base"File search or a knowledge tool (Foundry IQ)
"calculate", "analyse this spreadsheet", "produce a chart"Code interpreter
"current", "today's", "latest news"Web search
"create a ticket", "update the CRM", "place an order"Custom function or OpenAPI tool
"remember what this user told us last week"Memory (preview)
"use the tools another team already exposes"An MCP server, or a toolbox
"reason over our Microsoft 365 content"Work IQ (preview)
"reason over our Fabric data"Fabric IQ (preview)

Changed: Toolboxes

A toolbox curates a set of tools once - web search, file search, code interpreter, MCP servers, custom functions - and shares them across many agents through a single managed MCP endpoint with centralised authentication, governance and versioning. It is the governance answer to "every team configured their own tools differently".

Check your understanding

Gen AI apps & agents

An agent must answer questions about company policy, run numerical calculations on an uploaded spreadsheet, and look up today's exchange rate.

Which combination of tools does it need?

Check your understanding

Gen AI apps & agents Hard

What is a Foundry toolbox?

Building and testing a single agent

In the Foundry portal

  1. Name the agent

    Pick carefully - the name cannot be changed later, and code refers to the agent as <name>:<version>.

  2. Choose a model

    Any supported model from the catalog. You can swap models later without changing your client code.

  3. Write the instructions

    This is the agent's system prompt: persona, scope, rules, and what to do when it is unsure.

  4. Attach tools and knowledge

    Enable code interpreter, file search, web search, or connect a Foundry IQ knowledge base.

  5. Test in the playground

    Chat with it, inspect the tool calls it makes, and iterate on the instructions until the behaviour is right.

  6. Take the code

    The playground's Code tab gives you a preconfigured snippet to drop into your application.

  7. Publish when ready

    Publish the agent version as an Agent Application with a stable endpoint, and optionally share it to Microsoft Teams and Microsoft 365 Copilot.

Check your understanding

Gen AI apps & agents

Where do you test an agent interactively before wiring it into an application?

A client application for an agent

Current shape: project endpoint, agent version, conversation, response
import os
from azure.ai.projects import AIProjectClient
from azure.ai.projects.models import PromptAgentDefinition
from azure.identity import DefaultAzureCredential

# pip install "azure-ai-projects>=2.3.0" azure-identity
project = AIProjectClient(
    endpoint=os.environ["PROJECT_ENDPOINT"],
    credential=DefaultAzureCredential(),
)

# Define the agent in code - or create it in the portal and skip this step.
project.agents.create_version(
    agent_name="triage-agent",
    definition=PromptAgentDefinition(
        model=os.environ["MODEL_DEPLOYMENT_NAME"],
        instructions="You are a tier-1 support triage agent. Be concise.",
    ),
)

# An OpenAI client bound to the agent, and a conversation that keeps history.
openai = project.get_openai_client(agent_name="triage-agent")
conversation = openai.conversations.create()

response = openai.responses.create(
    conversation=conversation.id,
    input="A customer reports the app crashes on launch. What should I ask them?",
)

print(response.output_text)

Changed: Threads and runs are the older API

Samples that call create_thread(), create_message() and create_and_process_run() against a connection string come from the earlier Assistants-style API and version 1.x of the SDK. The current pattern (version 2.x) uses a project endpoint, agent versions, conversations and the Responses API. You may be asked to recognise which is current.

Check your understanding

Gen AI apps & agents

In the current Foundry SDK, what does a client application do to have a conversation with an existing prompt agent?

Check your understanding

Gen AI apps & agents Hard

You find a code sample that calls create_thread(), create_message() and create_and_process_run() against a connection string. Which statement about the sample is correct?