Building a Pizza Ordering Agent: Hands-on with Foundry and MCP
Hands-on lab session demonstrating how to build production-ready AI agents using Foundry Agent Service and Model Context Protocol (MCP). Starting with basic prompts and progressively adding RAG, tool calling, and external service integration for a working pizza ordering system.
This intermediate-level lab session provides practical experience with the full agent development lifecycle, from initial setup through external system integration, using a relatable use case that demonstrates enterprise patterns.
Session context
LAB571-R1 - Build a Pizza Ordering Agent with Microsoft Foundry and MCP
Speakers:
- Henk Boelman (Microsoft)
- Gustavo Cordido (Microsoft)
When: November 19, 2025, 2:00 PM - 3:15 PM PST Where: Moscone West, Level 3, Room 3001 Level: Intermediate (200) Format: Hands-on lab (in-person only, not recorded)
Session description:
"In this hands-on workshop, you'll learn to build domain-specific AI agents with Foundry Agent Service. Starting from a simple agent, you'll add system prompts, custom instructions, and knowledge with RAG. You'll extend it with tool calling (like a pizza calculator) and connect external services via MCP for live menu and order handling. By the end, you'll have a working Contoso PizzaBot that can answer questions, recommend pizzas, and manage orders."
Key learning objectives:
- Build AI agents using Foundry Agent Service
- Add system prompts and custom instructions
- Implement knowledge retrieval with RAG
- Use tool calling for custom logic
- Connect external services via Model Context Protocol (MCP)
Lab experience
Well-structured workshop with clear progression through agent development concepts. Henk Boelman and Gustavo Cordido delivered practical guidance through each phase.
Setup challenges encountered
RBAC permissions issue:
Lab environment setup ran into permission problems requiring manual intervention. Participants needed to add:
- Contributor role assignment
- AI User role assignment
Via Azure RBAC permissions before progressing through lab exercises.
What this reveals:
Automated lab provisioning didn't grant sufficient permissions for Foundry Agent Service operations. Common enterprise pattern where least-privilege defaults require elevation for AI service access.
Time impact:
Permission troubleshooting consumed early lab time, reducing hands-on development time in 75-minute session.
Production insight:
RBAC configuration for AI agents isn't trivial. Plan for identity and access management complexity when deploying agent systems. Teams need clear runbooks for permission requirements.
Lab overview
The workshop progresses through five distinct phases, each building on the previous to create a functional pizza ordering agent.
Phase 1: Basic agent setup
Objective: Create minimal viable agent in Foundry Agent Service
What you build:
- Agent scaffold with basic conversation capability
- Initial prompt engineering
- Connection to language model
Skills learned:
- Foundry Agent Service interface
- Agent creation workflow
- Basic prompt structure
Phase 2: System prompts and custom instructions
Objective: Shape agent behavior with system-level guidance
What you add:
- System prompts defining agent role and constraints
- Custom instructions for domain-specific behavior
- Personality and tone configuration
Skills learned:
- Difference between system prompts and user prompts
- How custom instructions influence agent responses
- Prompt engineering for consistent behavior
Example patterns:
- "You are a helpful pizza ordering assistant..."
- Constraint setting (menu boundaries, order validation)
- Error handling guidance
Phase 3: Knowledge integration with RAG
Objective: Ground agent responses in actual pizza menu data
What you add:
- Knowledge base with menu information
- Retrieval Augmented Generation (RAG) implementation
- Context injection for grounded responses
Skills learned:
- RAG architecture in Foundry
- Knowledge base creation and indexing
- Grounding agent responses in factual data
Use case: Agent can answer "What toppings are available?" by retrieving from menu knowledge base rather than hallucinating options.
Phase 4: Tool calling with pizza calculator
Objective: Extend agent with custom logic execution
What you add:
- Tool definition for pizza price calculation
- Function calling integration
- Custom business logic execution
Skills learned:
- Tool/function calling architecture
- Defining tool schemas
- Handling tool execution results
Example tool: Pizza calculator that computes price based on:
- Size selection
- Topping selections
- Quantity
- Any special offers or discounts
Technical pattern: Agent recognizes when calculation needed → invokes tool → incorporates result into response
Phase 5: External service integration via MCP
Objective: Connect agent to live order management system
What you add:
- Model Context Protocol (MCP) integration
- External service connectivity
- Live menu data and order submission
Skills learned:
- MCP architecture and capabilities
- External system integration patterns
- Handling asynchronous operations
Use case:
- Fetch real-time menu data (availability, pricing changes)
- Submit orders to external order management system
- Handle order confirmation and tracking
Technical insight: MCP provides standardized interface for external tools and data sources, enabling agents to interact with systems beyond the language model.
Key technologies demonstrated
Foundry Agent Service
What it provides:
- Hosted agent execution environment
- Built-in observability and monitoring
- Integration with Azure AI services
- Deployment and scaling infrastructure
Why it matters: Eliminates infrastructure management, allowing focus on agent logic and behavior.
Model Context Protocol (MCP)
What it is: Standardized protocol for connecting AI agents to external tools, data sources, and services.
Architecture:
- Agent makes MCP request
- MCP server handles external system communication
- Results returned to agent for processing
Advantages:
- Vendor-agnostic integration
- Reusable MCP servers across agents
- Simplified external system connectivity
RAG (Retrieval Augmented Generation)
What it solves: Agents need factual, up-to-date information beyond training data.
How it works:
- User asks question
- Agent retrieves relevant documents from knowledge base
- Retrieved context injected into prompt
- Model generates response grounded in retrieved data
Pizza ordering example: Menu items, prices, and availability change frequently. RAG ensures agent always references current menu data.
Tool/Function Calling
What it enables: Agents can execute deterministic code for calculations, validations, or operations.
Pattern:
- Agent recognizes task requiring tool
- Constructs tool invocation with parameters
- Executes tool (code runs)
- Incorporates result into response
When to use:
- Mathematical calculations (pricing)
- Data validation (order correctness)
- External API calls (payment processing)
Practical takeaways
Progressive complexity works
Starting simple (basic prompt) and layering capabilities (RAG → tools → MCP) demonstrates realistic development workflow.
Pattern to follow:
- Validate core conversation flow
- Add knowledge grounding
- Extend with custom logic
- Integrate external systems
Domain-specific agents beat general agents
Pizza ordering agent outperforms general assistant because:
- System prompts constrain scope
- Knowledge base provides authoritative menu data
- Tools handle domain logic (pricing, validation)
- MCP connects to order management systems
Enterprise implication: Build focused agents for specific tasks rather than attempting one agent for everything.
MCP simplifies integration
Without MCP:
- Custom API integration for each external system
- Agent code tightly coupled to external services
- Difficult to swap or update external systems
With MCP:
- Standard protocol for all external connections
- MCP servers abstract external system complexity
- Swap implementations without changing agent code
RAG is essential for dynamic data
Hardcoding menu data in prompts:
- Becomes stale immediately
- Requires agent redeployment for menu changes
- Cannot handle real-time availability
RAG with knowledge base:
- Menu updates reflected immediately
- No agent code changes needed
- Supports real-time data
What this lab doesn't cover
Several production considerations remain outside lab scope:
Multi-turn conversation management
Challenge: Real pizza orders involve clarification questions, order modifications, and context spanning multiple turns.
What lab demonstrates: Basic conversation capability, but not complex multi-turn state management.
Production requirement: Conversation history management, context window optimization, and state persistence.
Error handling and edge cases
Challenge: What happens when:
- Menu item unavailable
- External order system down
- Payment processing fails
- User provides ambiguous input
What lab demonstrates: Happy path implementation.
Production requirement: Comprehensive error handling, graceful degradation, and clear user communication during failures.
Authentication and authorization
Challenge: Production pizza ordering requires:
- User authentication
- Payment authorization
- Order ownership verification
- PII protection
What lab demonstrates: Functional ordering flow without security layer.
Production requirement: Entra ID integration, payment security, data governance, and compliance controls.
Observability and monitoring
Challenge: How do you know if agent is:
- Completing orders successfully
- Handling errors appropriately
- Meeting performance SLAs
- Operating within cost budgets
What lab demonstrates: Basic Foundry observability features.
Production requirement: Comprehensive telemetry, alerting, cost tracking, and performance monitoring.
Scalability and cost management
Challenge: Pizza shop at scale:
- Thousands of concurrent orders
- Peak load during dinner rush
- Cost optimization for LLM calls
- Efficient RAG retrieval
What lab demonstrates: Single-user development scenario.
Production requirement: Load testing, auto-scaling configuration, cost monitoring, and optimization strategies.
The honest assessment
What this lab does well
Practical learning path: Progressive complexity from basic to advanced mirrors real development workflow.
Relevant use case: Pizza ordering translates directly to e-commerce, support ticketing, or booking systems.
Technology breadth: Covers agent fundamentals (prompts), knowledge (RAG), logic (tools), and integration (MCP) in 75 minutes.
Hands-on format: Building working agent beats PowerPoint architecture diagrams for skill development.
What's missing
Production readiness gap: Lab creates functional prototype, not production-ready system. The distance between "works in lab" and "handles customer orders reliably" is substantial.
MCP adoption uncertainty: Model Context Protocol is relatively new. Enterprise adoption patterns unclear. Betting on MCP means accepting protocol evolution risk.
Cost awareness: Lab doesn't address LLM costs at scale. Pizza ordering agent making multiple RAG retrievals and tool calls per order adds up quickly with volume.
Multi-agent orchestration: Real pizza shop might need:
- Order-taking agent
- Kitchen coordination agent
- Delivery tracking agent
- Customer service agent
Lab focuses on single agent, not orchestration patterns.
Who benefits from this lab
Developers building conversational AI: Practical patterns for prompt engineering, RAG, and tool calling apply beyond pizza ordering.
Enterprise architects evaluating agents: Hands-on experience with Foundry Agent Service, MCP, and integration patterns informs architecture decisions.
Product managers scoping agent projects: Understanding agent capabilities and limitations helps scope realistic features for MVP.
Not ideal for:
- Non-technical audience (requires coding)
- Pure researchers (focused on implementation, not theory)
- Foundry experts (intermediate level may be too basic)
What to try after the lab
Extend to complex scenarios
Multi-item orders: Add shopping cart functionality, order modification, and group ordering.
Delivery coordination: Integrate delivery tracking, ETA calculation, and driver communication.
Personalization: User preferences, order history, and recommendations based on past orders.
Explore agent patterns
Human-in-the-loop: Add approval step for large orders or unusual requests.
Multi-agent coordination: Separate agents for ordering, kitchen, and delivery, coordinated via agent-to-agent communication.
Durable workflows: Handle long-running processes like "remind me about my order in 30 minutes" with checkpointing.
Production hardening
Add authentication: Integrate Entra ID for user authentication and authorization.
Implement monitoring: Set up Application Insights, custom metrics, and alerting for production observability.
Cost optimization: Implement caching, reduce RAG retrievals, and optimize prompt efficiency.
Learn more
Lab repository:
- LAB571 GitHub Repository - Code samples, lab instructions, and supporting materials
Official resources:
- Microsoft Foundry SDK
- Microsoft Foundry Community Discord
- Model Context Protocol specification
- RAG implementation patterns
- Tool calling best practices
Technologies used:
- Microsoft Foundry Agent Service
- Visual Studio Code
- Python
Related Ignite sessions:
- AI Fleet Operations (Foundry)
- Building Multi-Agent Systems with Azure AI Foundry
- Multi-Agent Apps with MCP