Conversational AI (artificial intelligence) · 12 / 22

Microsoft Foundry Example

The booking assistant built on Microsoft Foundry: agent service, Azure AI Search, Entra ID (identifier), tracing and evaluation.

The same assistant on Microsoft Foundry

Microsoft Foundry (formerly Azure AI Foundry) is Microsoft's platform for building and running AI applications and agents. This build keeps the contracts from the overall design and maps each part onto a Foundry or Azure service. It suits teams already standardised on Azure and Entra ID.

Design partIn Microsoft Foundry
Conversation service and agent loopA Foundry agent in a project, with instructions and tools. A thin service in front handles channels and the state machine
ModelsModel deployments in the project, reached through the enterprise AI gateway for scanning and budgets
Knowledge (RAG)Azure AI Search index (now presented as Foundry IQ) with a knowledge tool on the agent, filtered by airport and date
Tool gatewayThe booking API (Application Programming Interface) as an OpenAPI tool, or the MCP (Model Context Protocol) gateway attached as an MCP tool
IdentityMicrosoft Entra ID, managed identities and role-based access control; no keys in code
SafetyFoundry content filters and guardrails, in addition to Prisma AIRS at the gateway
Tracing and evaluationOpenTelemetry traces to Application Insights, and Foundry evaluators for agents

Build steps

  1. Create the project

    One Foundry project per environment, with a managed identity and role assignments for search, storage and the booking API.

  2. Deploy models

    Deploy the small and reasoning models and point the project at the enterprise gateway so every call is scanned and budgeted.

  3. Build the knowledge index

    Load airport and service documents into Azure AI Search with airport and effective-date fields, and attach it as the agent's knowledge tool.

  4. Register tools

    Describe the quote, hold, confirm and commit operations as an OpenAPI tool. The commit operation requires the confirmation token the service issues.

  5. Create the agent

    Write the instructions, attach the tools and run threads from the conversation service, one thread per guest conversation.

  6. Trace and evaluate

    Turn on tracing, run agent evaluators on the shared evaluation set and gate releases on the result.

Creating the agent

A sketch with the Azure AI Projects SDK (Software Development Kit). The SDK changes quickly, so confirm the current class and method names. The important points are the identity, the tool set and the thread per conversation.

foundry/agent.py · a sketch, not a pinned SDK version
from azure.identity import DefaultAzureCredential
from azure.ai.projects import AIProjectClient

project = AIProjectClient(
    endpoint=os.environ["FOUNDRY_PROJECT_ENDPOINT"],
    credential=DefaultAzureCredential(),            # managed identity in Azure, your login locally
)

agent = project.agents.create_agent(
    model="booking-reasoner",                       # deployment name, routed through the gateway
    name="fbo-booking-assistant",
    instructions=open("prompts/booking_assistant.md").read(),
    tools=[SEARCH_KNOWLEDGE_TOOL, BOOKING_OPENAPI_TOOL],   # knowledge from AI Search, actions via OpenAPI
)

def handle_turn(thread_id: str | None, message: str):
    thread = project.agents.threads.get(thread_id) if thread_id else project.agents.threads.create()
    project.agents.messages.create(thread_id=thread.id, role="user", content=message)
    run = project.agents.runs.create_and_process(thread_id=thread.id, agent_id=agent.id)
    return thread.id, run

Sequence: a Foundry agent run, hold and confirm

A Foundry agent run from request to confirmation The service adds the guest's message to a thread and runs the agent. The agent calls the model through the gateway, searches rules, holds resources through the booking tool and replies. After the guest confirms, the service issues a token and runs the agent again to commit. Guest Conversation service Foundry agent Model via gateway AI Search Booking API request add to thread, run plan the turn call search_rules query, airport filter clauses answer from clauses call hold_resources OpenAPI: hold hold id, expiry run complete terms and CONFIRM prompt CONFIRM issue single-use token run with token in context commit + key + token BK-20417 confirmation
A Foundry agent run from request to confirmation

The agent decides which tool to call. The service controls when a token exists, so the agent cannot commit on its own initiative.

Keeping the commit safe

Evaluation in Foundry

Run the shared evaluation set against the agent and score it with evaluators for the things that matter to a booking.

What is measuredEvaluatorThreshold
Did the agent understand the requestIntent resolutionAt least 0.9 on the set
Did it call the right tool with the right argumentsTool call accuracyAt least 0.95
Did it follow its instructions and policiesTask adherenceAt least 0.95
Are policy answers supported by the sourcesGroundednessAt least 0.9
Is anything unsafe or leakedSafety evaluators and a custom checkZero failures

Thresholds are illustrative. Set them from your own baseline and review them as the set grows.

When to choose it

Choose Foundry whenChoose another build when
The organisation standardises on Azure, Entra ID and Application InsightsYou need to control the graph and its checkpoints in code
Managed hosting of agent threads and tools is a benefitYou need to run the agent in a network where Foundry is not available
Security and operations teams already work in Azure toolsYour evaluation and tracing tools are built around another stack

Build this for your business

This example is a booking assistant for a ground-handling network, but the same pattern, a governed gateway, runtime security, grounded knowledge, deterministic commits and measured quality, fits any customer-facing assistant that takes actions. We can scope a pilot on your own systems.

Book a discovery call