https://github.com/kardelruveyda/foundry-commerce-demo
Multi-agent e-commerce operations center built with Microsoft Agent Framework v1.0 + Foundry on .NET 10. Fraud detection, inventory, fulfillment, and customer comms โ all in C#.
https://github.com/kardelruveyda/foundry-commerce-demo
azure-ai csharp demo dotnet microsoft-agent-framework microsoft-foundry net10
Last synced: about 1 month ago
JSON representation
Multi-agent e-commerce operations center built with Microsoft Agent Framework v1.0 + Foundry on .NET 10. Fraud detection, inventory, fulfillment, and customer comms โ all in C#.
- Host: GitHub
- URL: https://github.com/kardelruveyda/foundry-commerce-demo
- Owner: KardelRuveyda
- Created: 2026-05-03T19:49:00.000Z (3 months ago)
- Default Branch: master
- Last Pushed: 2026-05-03T20:04:50.000Z (3 months ago)
- Last Synced: 2026-05-03T22:09:41.366Z (3 months ago)
- Topics: azure-ai, csharp, demo, dotnet, microsoft-agent-framework, microsoft-foundry, net10
- Language: C#
- Homepage:
- Size: 55.7 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# ๐ FoundryCommerceDemo
> **Enterprise E-Commerce Operations Center โ Multi-Agent Demo**
> Built with Microsoft Agent Framework v1.0 + Microsoft Foundry.
> A simple end-to-end pipeline:
> fraud check โ inventory โ fulfillment โ customer email.
[](https://dotnet.microsoft.com/)
[](https://github.com/microsoft/agent-framework)
[](https://foundry.azure.com)
---
## ๐ Table of Contents
1. [What is this?](#-what-is-this)
2. [Architecture](#-architecture)
3. [Hosting model โ this is a LOCAL agent demo](#-hosting-model--this-is-a-local-agent-demo)
4. [Other hosting options](#-other-hosting-options)
5. [What you need](#-what-you-need)
6. [Quick start](#-quick-start)
7. [Azure setup (`az login` step by step)](#-azure-setup-az-login-step-by-step)
8. [Environment variables](#-environment-variables)
9. [How to run](#-how-to-run)
10. [Project structure](#-project-structure)
11. [Demo orders](#-demo-orders)
12. [Local mode (Ollama)](#-local-mode-ollama)
13. [Troubleshooting](#-troubleshooting)
14. [License](#-license)
---
## ๐ฏ What is this?
This demo shows an online shop. When a new order comes in, **four AI agents**
work together like a team:
| Agent | What it does |
|-------|--------------|
| ๐ก๏ธ **FraudDetectionAgent** | Looks for risky orders. Checks the country, the device, and how many orders the customer made today. |
| ๐ฆ **InventoryAgent** | Checks if the products are in stock. Looks at all warehouses. Can reserve items. |
| ๐ **FulfillmentAgent** | Picks the best warehouse. Calculates shipping cost. Can split the order if needed. |
| ๐ฌ **CustomerAgent** | Writes a nice email to the customer. Never shares secret data (like fraud scores). |
### Why is this cool?
- โ
**Real C# code** does the math. The AI does **not** invent numbers.
- โ
**Multiple warehouses** with real stock data.
- โ
**Split shipments** when one warehouse is not enough.
- โ
**Agent-as-a-tool**: one agent can use another agent like a function.
- โ
**Local mode**: payment data stays on your computer (good for PCI-DSS).
---
## ๐ Hosting model โ this is a **LOCAL agent demo**
> **Important:** In this repo the agents run **on your computer**, not in the cloud.
> Microsoft Foundry is used **only as the LLM gateway** (model + auth + project scope).
> All agent logic, tools, and state live inside your local `dotnet run` process.
### ๐ Architecture diagrams
| Scenario | SVG (preview) | draw.io (editable) |
|----------|---------------|--------------------|
| ๐ **Local agents** (this repo) | _inline below_ | โ |
| โ๏ธ **Option 1 โ Container Apps** | [option2-container-apps.svg](docs/architecture/option2-container-apps.svg) | [.drawio](docs/architecture/option2-container-apps.drawio) |
| ๐๏ธ **Option 2 โ Foundry Agent Service (Azure resources)** โญ | [option3-foundry-agent-service-azure.svg](docs/architecture/option3-foundry-agent-service-azure.svg) | [.drawio](docs/architecture/option3-foundry-agent-service-azure.drawio) |
| ๐ Option 2 โ Foundry Agent Service (run lifecycle, story-style) | [option3-foundry-agent-service-detailed.svg](docs/architecture/option3-foundry-agent-service-detailed.svg) | [.drawio](docs/architecture/option3-foundry-agent-service-detailed.drawio) |
| ๐ค Option 2 โ Foundry Agent Service (compact overview) | [option3-foundry-agent-service.svg](docs/architecture/option3-foundry-agent-service.svg) | [.drawio](docs/architecture/option3-foundry-agent-service.drawio) |
| โฑ๏ธ **Option 4 โ Azure Durable Functions** (long-running workflows) | [option4-durable-functions-azure.svg](docs/architecture/option4-durable-functions-azure.svg) | [.drawio](docs/architecture/option4-durable-functions-azure.drawio) |
### What runs where?
```
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ YOUR MACHINE (dotnet run) โ
โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ Pipeline orchestrator (Program.cs) โ โ
โ โ โโ FraudDetectionAgent โ โ
โ โ โโ InventoryAgent โ โ
โ โ โโ FulfillmentAgent โ โ
โ โ โโ CustomerAgent โ โ
โ โ โ โ
โ โ Tools = your C# code (FraudTools.cs etc.)โ โ
โ โ State = in-memory (OrderDatabase) โ โ
โ โโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโ โ
โโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ HTTPS
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Microsoft Foundry โ
โ โข gpt-4o-mini model โ โ only LLM calls go here
โ โข DefaultAzureCredential
โโโโโโโโโโโโโโโโโโโโโโโโโโ
```
### What Foundry does (in this demo)
| # | Feature | Used? | Notes |
|---|---------|:-----:|-------|
| ๐ง Model hosting | โ
| `gpt-4o-mini` |
| ๐ Authentication | โ
| `DefaultAzureCredential` + `az login` (no API keys) |
| ๐ฆ Project scope | โ
| One project for billing, quota, monitoring |
| ๐ค Foundry Agent Service (cloud-hosted agents) | โ | Agents are local |
| ๐ฌ Threads / conversation history | โ | Not persisted |
| ๐ Vector stores / file search | โ | Not used |
| ๐ Content safety filters | โ | Not configured |
| ๐ Tracing / evaluation | โ | Add OpenTelemetry to enable |
### Why this design?
- ๐ **Fast** to demo โ no deployment needed.
- ๐ฐ **Cheap** โ you only pay for LLM tokens.
- ๐งช **Easy to debug** โ set breakpoints in Visual Studio.
- ๐ค **Great for talks** โ everything visible on stage.
### Limitations of running locally
- โ No state persistence โ process restart wipes everything.
- โ Single user only.
- โ No autoscale.
- โ Not production-ready as-is.
๐ If you need any of those, see the next section.
---
## โ๏ธ Other hosting options
Foundry can host much more than just the model. Here are **three ways** to move
the agents to the cloud, from least to most cloud-native.
### Comparison at a glance
| Option | Code change | State persistence | Multi-user | Scale-to-zero | Best for |
|--------|:-----------:|:-----------------:|:----------:|:-------------:|----------|
| ๐ **Local** (this repo) | โ | โ | โ | โ | Demos, dev loop |
| โ๏ธ **Container Apps** | Small | โ (add Cosmos DB) | โ
| โ
| Most teams |
| ๐ค **Foundry Agent Service** | Medium | โ
Auto | โ
| โ
| Cloud-first agents |
| โฑ๏ธ **Durable Functions** | Medium | โ
Auto | โ
| โ
| Long-running workflows |
---
### Option 1 โ Azure Container Apps (recommended next step)
Wrap the same .NET 10 code in an ASP.NET Core API and deploy to a serverless
container runtime. Your agent code does **not** change โ only `Program.cs`
becomes a web app.
๐ **Architecture diagram:**
[`docs/architecture/option2-container-apps.svg`](docs/architecture/option2-container-apps.svg)
ยท editable [`.drawio`](docs/architecture/option2-container-apps.drawio)
**Topology:**
```
Client โ Front Door / APIM โ Container Apps (foundry-commerce-api)
โโ pulls image from ACR
โโ uses Managed Identity โ Foundry (LLM)
โโ logs to App Insights
โโ stores data in Cosmos DB / Service Bus
```
**Sketch of the code:**
```csharp
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddSingleton(sp =>
new AIProjectClient(new Uri(endpoint), new DefaultAzureCredential()));
var app = builder.Build();
app.MapPost("/api/orders/{orderId}/process", async (string orderId, AIProjectClient client) =>
{
var fraudAgent = client.AsAIAgent(
model: "gpt-4o-mini",
instructions: "...",
tools: [...]);
var result = await fraudAgent.RunAsync($"Process order {orderId}");
return Results.Ok(result);
});
app.Run();
```
**Deploy:**
```powershell
az containerapp up `
--name foundry-commerce-api `
--resource-group rg-demo `
--location swedencentral `
--source .
```
or with Azure Developer CLI:
```powershell
azd up
```
**Pros**
- โ
Minimal code changes.
- โ
Scale-to-zero (you pay $0 when idle).
- โ
Managed Identity โ no secrets in code.
- โ
HTTPS endpoint, custom domains, revisions, blue/green deploys.
**Cons**
- โ You still manage state yourself (add Cosmos DB or SQL).
- โ Threads/conversations are not built-in.
---
### Option 2 โ Microsoft Foundry **Agent Service** (cloud-hosted agents)
Let Foundry host the agent itself. Tool definitions, instructions, and
conversation threads all live in the cloud. Your code calls the agent and
responds to tool-call requests.
๐๏ธ **Azure architecture (production-ready resource topology):**
[`docs/architecture/option3-foundry-agent-service-azure.svg`](docs/architecture/option3-foundry-agent-service-azure.svg)
ยท editable [`.drawio`](docs/architecture/option3-foundry-agent-service-azure.drawio)
This is the **โwhat do I deploy?โ** view. It shows real Azure resources, resource
groups, networking, identity, and data services laid out the way they would look
in production.
**Resource groups in the diagram:**
| RG | Color | Contents |
|----|-------|----------|
| `rg-foundrycommerce-app` | ๐ฉ Green | Container Apps (api + worker), ACR, UAMI, Key Vault, App Configuration, Service Bus |
| `rg-foundrycommerce-foundry` | ๐ง Orange | Foundry Hub + Project, PersistentAgents, Threads/Runs, model deployments, vector store, content safety |
| `rg-foundrycommerce-data` | ๐ช Purple | Cosmos DB (NoSQL), Azure SQL, Storage Account, Azure Managed Redis |
**Cross-cutting concerns (shown on the side):**
- ๐ **Microsoft Entra ID** โ issues tokens to a User-Assigned Managed Identity. **No API keys anywhere.**
- ๐ **VNet** (`vnet-foundry-prod`) with private endpoints for Key Vault, ACR, Cosmos DB, Storage, Foundry.
- ๐ก๏ธ **Edge** โ Front Door + WAF + API Management + DDoS Protection.
- ๐ **Observability** โ Application Insights, Log Analytics, Azure Monitor, Foundry built-in tracing, Defender for Cloud.
**Run lifecycle (numbered arrows on the diagram):**
| # | Color | What happens |
|---|-------|--------------|
| โ | ๐ง Orange | Container App calls `Runs.CreateRunAsync` on Foundry Agent Service |
| โก | ๐ช Purple | Foundry replies with `requires_action` โ โcall tool Xโ |
| โข | ๐ฉ Green | Container App runs the C# tool and posts back via `SubmitToolOutputsAsync` |
For a step-by-step **run lifecycle** explanation (story-style), see
[`option3-foundry-agent-service-detailed.svg`](docs/architecture/option3-foundry-agent-service-detailed.svg).
For a single-page **compact overview**, see
[`option3-foundry-agent-service.svg`](docs/architecture/option3-foundry-agent-service.svg).
**Topology:**
```
Client โ Container Apps (thin API)
โ โ start run
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Microsoft Foundry โ Agent Service โ
โ โข PersistentAgents (definitions) โ
โ โข Threads + Runs (auto-saved state) โ
โ โข Vector store (optional, RAG) โ
โ โข Model deployment (gpt-4o-mini) โ
โ โข Built-in safety + tracing โ
โโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ โก "call tool X"
โผ
Container Apps tool handler โ runs C# in your code
โ โข returns tool result
โผ
Foundry continues the run โ โฃ final reply
```
**Run lifecycle (4 steps):**
| # | Who | What happens |
|---|-----|--------------|
| โ | Your API | `Runs.CreateRunAsync(thread, agent)` |
| โก | Foundry | Sends a `requires_action` event with tool name + args |
| โข | Your API | Runs the C# tool, posts result back via `SubmitToolOutputsAsync` |
| โฃ | Foundry | Continues reasoning, returns the final assistant message |
> ๐ก Foundry stores **conversation data** (threads, runs, tool calls).
> Your backend stores **business data** (orders, warehouses) in Cosmos DB / SQL.
**Sketch:**
```csharp
using Azure.AI.Agents.Persistent;
var agentsClient = new PersistentAgentsClient(endpoint, credential);
// 1. Create the agent in Foundry (once)
var agent = await agentsClient.Administration.CreateAgentAsync(
model: "gpt-4o-mini",
name: "FraudDetectionAgent",
instructions: "You analyze fraud risk...",
tools: [
new FunctionToolDefinition(
name: "AnalyzeGeoConsistency",
description: "Checks geographic consistency",
parameters: BinaryData.FromString("""
{ "type": "object", "properties": {
"orderId": { "type": "string" }
}}
"""))
]);
// 2. Create a conversation thread
var thread = await agentsClient.Threads.CreateThreadAsync();
// 3. Send a message and run
await agentsClient.Messages.CreateMessageAsync(
thread.Id, MessageRole.User, "Check ORD-50002");
var run = await agentsClient.Runs.CreateRunAsync(thread.Id, agent.Id);
```
**What Foundry stores for you**
- โ
Agent definition (tools, instructions, model)
- โ
Thread history (every conversation)
- โ
Run state (resumable if your code crashes)
- โ
Tool call audit trail
**Pros**
- โ
Automatic state, threads, history.
- โ
Built-in safety, evaluation, tracing in Foundry portal.
- โ
You only host the **tool execution** (a webhook or function).
**Cons**
- โ More refactoring โ moves agent definition out of C#.
- โ Slightly higher cost (storage + agent runtime).
---
### Option 3 โ Azure Durable Functions (long-running workflows)
Use this if your pipeline can take **hours or days** (e.g. waits for a manager
approval, retries failed shipments, cross-day reconciliation).
**Sketch:**
```csharp
[Function(nameof(OrderPipeline))]
public async Task OrderPipeline(
[OrchestrationTrigger] TaskOrchestrationContext context)
{
var orderId = context.GetInput();
// Step 1: fraud check
var verdict = await context.CallActivityAsync(
nameof(RunFraudAgent), orderId);
if (verdict == "BLOCKED")
return await context.CallActivityAsync(
nameof(SendBlockEmail), orderId);
// Step 2: wait up to 24h for human approval
var approved = await context.WaitForExternalEvent(
"ManagerApproval", TimeSpan.FromHours(24));
// Step 3: fulfillment
return await context.CallActivityAsync(
nameof(RunFulfillmentAgent), orderId);
}
```
**Pros**
- โ
State and progress are checkpointed automatically.
- โ
Survives restarts, scale-out, and long waits.
- โ
Perfect for human-in-the-loop steps.
**Cons**
- โ More moving parts (Functions runtime, storage account).
- โ Steeper learning curve than Container Apps.
---
### Which option should you pick?
```
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Do agents need to keep โ
โ state across requests? โ
โโโโโโโโฌโโโโโโโโโโโโโโฌโโโโโโโโ
No โ โ Yes
โผ โผ
โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโ
โ Container โ โ Pipeline can take โ
โ Apps โ โ hours / human waits? โ
โ (Option 1) โ โโโโโโฌโโโโโโโโโโฌโโโโโโโโ
โโโโโโโโโโโโโโโ No โ โ Yes
โผ โผ
โโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโ
โ Foundry Agent โ โ Durable โ
โ Service โ โ Functions โ
โ (Option 2) โ โ (Option 3) โ
โโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโ
```
**Rule of thumb for this demo:** start with Container Apps. It is the smallest
jump from the local code in this repo and covers ~80% of real-world needs.
---
## ๐๏ธ Architecture
```
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ NEW ORDER โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโ
โ FraudDetectionAgent โ
โ โข Geo check โ
โ โข Velocity check โ
โ โข Final verdict โ
โโโโโโโโโโโฌโโโโโโโโโโโโโโ
โ
โโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโ
โผ BLOCKED โผ APPROVED
โโโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโโโ
โ CustomerAgent โ โ FulfillmentAgent โ
โ writes a polite โ โ uses โ as a tool โ
โ "we need more โ โ โโโโโโโโโโโโโโโโโโโโ โ
โ info" email. โ โ โ InventoryAgent โ โ
โ No secret data. โ โ โ โข CheckStock โ โ
โโโโโโโโโโโโโโโโโโโโโ โ โ โข Optimize โ โ
โ โ โข Reserve โ โ
โ โโโโโโโโโโโโโโโโโโโโ โ
โโโโโโโโโโโโฌโโโโโโโโโโโโโโ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโ
โ CustomerAgent โ
โ writes a thank-you โ
โ email with the ETA. โ
โโโโโโโโโโโโโโโโโโโโโโโโโ
```
---
## ๐งฐ What you need
| Tool | Version | Note |
|------|---------|------|
| .NET SDK | **10.0** (8.0+ also works) | Check with `dotnet --version` |
| Azure CLI | latest | Check with `az --version` |
| Visual Studio 2022/2026 or VS Code | โ | C# Dev Kit is helpful |
| Microsoft Foundry project | โ | One model must be deployed (e.g. `gpt-4o-mini`) |
| (Optional) Ollama | latest | For local mode: `llama3.1`, `mistral`, or `qwen2.5` |
> โ ๏ธ Some models (like `llama3`) **cannot call functions**.
> Please use `llama3.1` or newer.
---
## ๐ Quick start
```powershell
# 1. Clone the repo
git clone
cd FoundryCommerceDemo
# 2. Sign in to Azure
az login
# 3. Set the Foundry endpoint
$env:FOUNDRY_PROJECT_ENDPOINT = "https://.services.ai.azure.com/api/projects/"
$env:FOUNDRY_MODEL_NAME = "gpt-4o-mini"
# 4. Build and run
dotnet restore
dotnet build
dotnet run
```
---
## ๐ Azure setup (`az login` step by step)
### 1. Install Azure CLI
```powershell
# Windows (winget)
winget install -e --id Microsoft.AzureCLI
# macOS (brew)
brew update && brew install azure-cli
# Linux
curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash
```
Check that it works:
```powershell
az --version
```
### 2. Sign in to Azure
```powershell
az login
```
A browser window opens. Sign in with your Microsoft account.
Then go back to the terminal.
If you have more than one subscription, list all of them:
```powershell
az account list --output table
```
Pick the subscription you want to use:
```powershell
az account set --subscription ""
```
Check the active subscription:
```powershell
az account show
```
### 3. Create a Microsoft Foundry project (if you don't have one)
> Foundry Portal:
1. Click **+ New project** โ choose a name, region, and subscription.
2. Open **Models** and deploy a model:
- ๐ข Fast and cheap: `gpt-4o-mini` or `gpt-4.1-mini`
- ๐ต More powerful: `gpt-4o`
3. On the project page, copy the **Project endpoint**. It looks like this:
```
https://.services.ai.azure.com/api/projects/
```
### 4. Give yourself the right role
Your user (or managed identity) needs the **Azure AI User** role on the project:
```powershell
$user = az ad signed-in-user show --query id -o tsv
$projectId = "/subscriptions//resourceGroups//providers/Microsoft.CognitiveServices/accounts/"
az role assignment create `
--assignee $user `
--role "Azure AI User" `
--scope $projectId
```
### 5. Test the connection
```powershell
$token = az account get-access-token --resource https://ai.azure.com --query accessToken -o tsv
curl -H "Authorization: Bearer $token" $env:FOUNDRY_PROJECT_ENDPOINT
```
If you see `200 OK`, you are ready! โ
---
## ๐ง Environment variables
| Variable | What it is | Example |
|----------|------------|---------|
| `FOUNDRY_PROJECT_ENDPOINT` | The URL of your Foundry project | `https://admin-5418-resource.services.ai.azure.com/api/projects/admin-5418` |
| `FOUNDRY_MODEL_NAME` | The name of your deployed model | `gpt-4o-mini` |
### PowerShell (only this session)
```powershell
$env:FOUNDRY_PROJECT_ENDPOINT = "https://.services.ai.azure.com/api/projects/"
$env:FOUNDRY_MODEL_NAME = "gpt-4o-mini"
```
### PowerShell (save for later)
```powershell
[Environment]::SetEnvironmentVariable("FOUNDRY_PROJECT_ENDPOINT", "https://...", "User")
[Environment]::SetEnvironmentVariable("FOUNDRY_MODEL_NAME", "gpt-4o-mini", "User")
```
### Bash / Zsh
```bash
export FOUNDRY_PROJECT_ENDPOINT="https://.services.ai.azure.com/api/projects/"
export FOUNDRY_MODEL_NAME="gpt-4o-mini"
```
> ๐ก **Tip:** In Visual Studio you can also add these in `launchSettings.json`
> under `environmentVariables`.
---
## โถ๏ธ How to run
```powershell
dotnet run
```
The pipeline runs each demo order one by one:
```
+===================================================================+
| FOUNDRY โ Enterprise E-Commerce Operations Center |
+===================================================================+
STEP 1: Fraud Detection .....................................
STEP 2: Fulfillment Optimization ............................
STEP 3: Customer Communication ..............................
```
---
## ๐ Project structure
```
FoundryCommerceDemo/
โโโ Program.cs # Entry point + pipeline
โโโ FoundryCommerceDemo.csproj # Project file (.NET 10)
โโโ Models/
โ โโโ Order.cs # Order, LineItem, WarehouseStock
โโโ Data/
โ โโโ OrderDatabase.cs # Demo orders + customer history
โ โโโ WarehouseDatabase.cs # Stock and shipping rates
โโโ Tools/
โ โโโ FraudTools.cs # Geo + velocity + verdict
โ โโโ scoring/
โ โ โโโ InventoryTools.cs # Stock matrix, optimize, reserve
โ โโโ split-shipment/
โ โโโ CustomerTools.cs # Customer email helpers
โโโ Agents/
โโโ AgentDefinitions.cs # Agent instructions
```
---
## ๐งช Demo orders
| Order | Customer | Total | What happens |
|-------|----------|-------|--------------|
| `ORD-50001` | Zeynep Arslan (Platinum) | $18,249 | โ
APPROVED โ split shipment (IST + FRA) |
| `ORD-50002` | John Smith (Standard) | $11,599 | ๐ซ BLOCKED โ country mismatch + too many orders + GPUs |
| `ORD-50003` | Maria Gonzalez (Gold) | $8,219 | โ ๏ธ APPROVED โ smart stock plan |
### The "wow" moment โ `ORD-50002`
- ๐ณ Card from: ๐บ๐ธ USA
- ๐ IP from: ๐ท๐ด Romania
- ๐ฆ Ship to: ๐ณ๐ฌ Nigeria
- ๐ **7 orders** in the last 24 hours + new device
- ๐ฎ 4x RTX 5090 GPUs + a throwaway email
- โ **Risk: CRITICAL โ BLOCKED**
- The `CustomerAgent` writes a polite "we need more info" email.
It does **not** mention the fraud reasons. โจ
---
## ๐ Local mode (Ollama)
Do you want payment data to stay on your computer? (Good for PCI-DSS.)
```powershell
# 1. Install Ollama
winget install -e --id Ollama.Ollama
# or download from: https://ollama.com/download
# 2. Start the service
ollama serve
# 3. Pull a model that supports function calling
ollama pull llama3.1
```
In `Program.cs`, uncomment the local mode block and run again.
The same `Tools` and `Agents` code works โ only the "brain" changes.
---
## ๐ฉบ Troubleshooting
| Error | Reason | Fix |
|-------|--------|-----|
| `AuthenticationFailedException` | Token is expired | Run `az login` again |
| `404 โ Model not found` | Model is not deployed | Foundry Portal โ Models โ deploy a model |
| `429 โ Rate limited` | Too many requests | Wait 60 seconds or ask for more quota |
| `Insufficient permissions` | Missing role | Add the `Azure AI User` role |
| `Connection refused (Ollama)` | Ollama is not running | Run `ollama serve` in another terminal |
| `Wrong endpoint format` | Bad URL | Use `https://.services.ai.azure.com/api/projects/` |
### Quick check commands
```powershell
az account show # Check Azure login
dotnet list package # See package versions
dotnet clean; dotnet build # Clean and rebuild
curl http://localhost:11434/api/tags # Check Ollama
```
---
## ๐ Resources
- [Microsoft Foundry Portal](https://foundry.azure.com)
- [Agent Framework on GitHub](https://github.com/microsoft/agent-framework)
- [Agent Framework Samples](https://github.com/microsoft/Agent-Framework-Samples)
- [Learn Docs โ Overview](https://learn.microsoft.com/agent-framework/overview/)
- [Learn Docs โ Workflows](https://learn.microsoft.com/agent-framework/workflows/)
---
## ๐ License
This demo is made for the **DOTNET Conference** talk. It is for learning only.
- All company names, customer names, and order data are **fictional**.
- The fraud detection logic is **simplified** for the demo.
Please do **not** use it in production.
---
Built with Microsoft Agent Framework v1.0 โ a unified SDK for enterprise AI agents.
Presented at DOTNET Conference ยท 7 May 2026 ยท Sheraton Grand Istanbul Hotel.