Introduction
Let's imagine that we will build a coffee shop agentic app with the technical stack like
- Multiple channels: Slack and WebChat
- Claw agent: the simple agent that routes the message from a specific channel to an agent runtime (in this case, we use Microsoft Agent Framework, a.k.a MAF), and this agent should be hosted in Microsoft Foundry in hosted agent mode so that we don't have to think much about running and operating it
- ToolSearch gateway: because we will connect many MCP tools in this agent to serve our business, we need to control the guardrail, governance, and observability of token usage of all tools. This component is also implemented with the tool-search-tool pattern to save the token usage with MCP. And behind the scenes, it should allow connecting to Brave Search API to ground the latest news, connect to Microsoft Foundry Toolbox, from this point, we can connect the knowledge base and other components (code interpreter) inside the Microsoft Azure ecosystem
- CoffeeShop MCP: This is all the core business of the coffeeshop app, like showing the menu, searching customer information, and ordering flow
After some deep research sections with ChatGPT, Claude Code with Opus 4.7, and justifying the research with GPT 5.5 several times, we come up with the high-level architecture as follows:
And the source code for this claw agent can be found at https://github.com/thangchung/agent-engineering-experiment/tree/main/foundry-agentfx
This blog doesn't show you how to develop this app. If anyone wants to know how I developed it, please see the video record as follows:
This blog will focus on how to deploy the coffeeshop agentic app and run it on Microsoft Foundry - Hosted Agents.
Let's get started...
Deployment of my claw to Microsoft Foundry and other Azure services
We will use Bicep to model and provision all related components, and you can use Terraform if you want. The deployment scripts can be found at https://github.com/thangchung/agent-engineering-experiment/tree/main/foundry-agentfx/infra
First, to make sure all components are valid and no errors and violate no constraints, make sure you run azd provision --preview for a dry-run first:
Second, running azd provision:
After finishing the deploy with the command azd deploy:
Finally, you access https://ai.azure.com to access claw agent there:
Then click into claw-agent in the red box above to navigate to this agent. Once you are in the playground, try to type menu:
If everything works, then you can see the response just like above.
1. Test the search feature with Foundry IQ - Knowledge Base
In the Microsoft Foundry dashboard, you should see all the information about the coffee shop company, like:
And in the Azure Portal:
The code to insert the stuff data can be found at https://github.com/thangchung/agent-engineering-experiment/blob/main/foundry-agentfx/infra/create-search-indexes.py
And when you asked the company for information in Slack, you should see the information as:
2. Test the code interpreter in the sandbox feature
Type the text Calculate the total cost if I order 3 lattes at $4.75 each, 2 cappuccinos at $4.25 each, and apply a 10% loyalty discount. Show the breakdown in Slack, you should receive:
3. Test the tool calling with the Brave Search feature
Open up Slack, and type @MyDotNetClawApp trends in the coffee shop brands and drinks?, you should see:
4. Test the ordering coffee flow
On Slack, type show me your menu?
Observability
Because we need to track the token usage these days for all kinds of agentic apps. In development code, you have to instrument your code and component with OpenTelemetry GenAI Semantic Conventions. And when you deployed the app to Microsoft Foundry with Azure Monitor (AppInsight configuration correctly), then after many actions above, you should go to Azure Portal - AppInsights, and see the application map:
And to track more information about token usage (in, out and cached tokens), you can use the built-in Grafana dashboard inside Azure Monitor to track it:
And even more detail in tracing the claw agent operation:
How cool is that? 😍
That's enough for today. See you next time!















Top comments (0)