From 4fefdf7f7872126fce65755bd50193d1dc5a61ba Mon Sep 17 00:00:00 2001 From: Digvijay Chauhan Date: Sun, 29 Nov 2026 12:47:23 +0100 Subject: [PATCH] Predictive Maintenance: end-to-end verification and fixes I deployed the Predictive Maintenance lab and ran all five challenges in a Codespace, including the Aspire workflow (all five agents call their tools; about 51 seconds per run). The App Insights connection-string fix from #578 is in and works. ### What changed - `labautomation/main.bicep`: added the three Cosmos containers the Challenge 4 agents write to (`MaintenanceSchedules`, `PartsOrders`, `ChatHistories`), so the lab has all 13. - Challenge 1 and solution 1: container table and count, the verify query uses `[].name` (it listed full resource IDs), and the fallback path for the knowledge base files. ### How it was tested The lab was deployed with this hack's own `labautomation` into a test subscription (all test resources have since been deleted) and every challenge was run as a participant would. Links and the repository structure check pass. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../challenges/challenge-01.md | 12 +++++++++--- .../labautomation/README.md | 2 +- .../labautomation/main.bicep | 9 +++++++-- .../walkthrough/challenge-01/solution-01.md | 10 ++++++++-- 4 files changed, 25 insertions(+), 8 deletions(-) diff --git a/03-Azure/01-04-AI/08_Predictive_Maintenance/challenges/challenge-01.md b/03-Azure/01-04-AI/08_Predictive_Maintenance/challenges/challenge-01.md index 6f4e83fe2..4f28648e3 100644 --- a/03-Azure/01-04-AI/08_Predictive_Maintenance/challenges/challenge-01.md +++ b/03-Azure/01-04-AI/08_Predictive_Maintenance/challenges/challenge-01.md @@ -24,7 +24,7 @@ Before you can build any agents, the tire factory's data foundation and Azure re * **Container Registry** and a **Container Apps Environment** for the agents you deploy in later challenges
-Cosmos DB data model (7 containers) +Cosmos DB data model (13 containers) | Container | Partition key | Purpose | Sample count | |-----------|--------------|---------|--------------| @@ -35,6 +35,12 @@ Before you can build any agents, the tire factory's data foundation and Azure re | `PartsInventory` | `/category` | Spare parts | 16 parts | | `Technicians` | `/department` | Maintenance staff | 6 technicians | | `WorkOrders` | `/status` | Maintenance history | 5 work orders | +| `MaintenanceHistory` | `/machineId` | Past repairs per machine | 12 records | +| `MaintenanceWindows` | `/isAvailable` | Production windows for planned work | 17 windows | +| `Suppliers` | `/category` | Parts suppliers | 5 suppliers | +| `MaintenanceSchedules` | `/id` | Written by the Maintenance Scheduler Agent (challenge 4) | empty | +| `PartsOrders` | `/id` | Written by the Parts Ordering Agent (challenge 4) | empty | +| `ChatHistories` | `/entityId` | Agent conversation history (challenge 4) | empty |
@@ -176,10 +182,10 @@ az cosmosdb sql container list \ --account-name "$COSMOS_ACCOUNT_NAME" \ --resource-group "$RESOURCE_GROUP" \ --database-name "FactoryOpsDB" \ - --query "[].id" --output tsv + --query "[].name" --output tsv ``` -You should see all seven containers listed in [Context and Background](#-context-and-background). Then confirm the knowledge base wiki articles were uploaded to Blob Storage: +You should see all 13 containers listed in [Context and Background](#-context-and-background). Then confirm the knowledge base wiki articles were uploaded to Blob Storage: ```bash az storage blob list \ diff --git a/03-Azure/01-04-AI/08_Predictive_Maintenance/labautomation/README.md b/03-Azure/01-04-AI/08_Predictive_Maintenance/labautomation/README.md index 5e0386092..83c113bdf 100644 --- a/03-Azure/01-04-AI/08_Predictive_Maintenance/labautomation/README.md +++ b/03-Azure/01-04-AI/08_Predictive_Maintenance/labautomation/README.md @@ -18,7 +18,7 @@ across the agents and workflow. ## What `main.bicep` provisions - Storage account with a `machine-wiki` blob container (knowledge base articles). -- Cosmos DB account (serverless) with the `FactoryOpsDB` database and its 10 containers +- Cosmos DB account (serverless) with the `FactoryOpsDB` database and its 13 containers (10 seeded with data, 3 empty for the challenge 4 agents) (partition keys and the 30-day TTL on `Telemetry` match the source hack's seeding script). - Azure AI Search, Microsoft Foundry account/project with the `gpt-5.4-mini`, `gpt-5.4`, and `text-embedding-3-large` model deployments, and the AI Search/App Insights connections. diff --git a/03-Azure/01-04-AI/08_Predictive_Maintenance/labautomation/main.bicep b/03-Azure/01-04-AI/08_Predictive_Maintenance/labautomation/main.bicep index 4325f1562..bf78ffcdb 100644 --- a/03-Azure/01-04-AI/08_Predictive_Maintenance/labautomation/main.bicep +++ b/03-Azure/01-04-AI/08_Predictive_Maintenance/labautomation/main.bicep @@ -39,8 +39,10 @@ var openAiContributorRoleId = subscriptionResourceId('Microsoft.Authorization/ro var storageBlobDataContributorRoleId = subscriptionResourceId('Microsoft.Authorization/roleDefinitions', 'ba92f5b4-2d11-453d-a403-e96b0029c9fe') var cosmosDbDataContributorRoleId = '00000000-0000-0000-0000-000000000002' -// The 10 Cosmos containers seeded with sample factory-operations data. -// Matches challenge-0/seed-data.sh's `containers_config` in the source hack. +// The 10 Cosmos containers seeded with sample factory-operations data, plus the 3 that the +// challenge 4 agents write to (created empty so the agents never need to create them). +// Matches challenge-0/seed-data.sh's `containers_config` in the source hack and the partition +// keys in src/agents/services/cosmos_db_service.py. var cosmosContainers = [ { name: 'Machines', partitionKeyPath: '/type' } { name: 'Thresholds', partitionKeyPath: '/machineType' } @@ -52,6 +54,9 @@ var cosmosContainers = [ { name: 'MaintenanceHistory', partitionKeyPath: '/machineId' } { name: 'MaintenanceWindows', partitionKeyPath: '/isAvailable' } { name: 'Suppliers', partitionKeyPath: '/category' } + { name: 'MaintenanceSchedules', partitionKeyPath: '/id' } + { name: 'PartsOrders', partitionKeyPath: '/id' } + { name: 'ChatHistories', partitionKeyPath: '/entityId' } ] resource storageAccount 'Microsoft.Storage/storageAccounts@2023-05-01' = { diff --git a/03-Azure/01-04-AI/08_Predictive_Maintenance/walkthrough/challenge-01/solution-01.md b/03-Azure/01-04-AI/08_Predictive_Maintenance/walkthrough/challenge-01/solution-01.md index 0fb860bce..d9cf9e024 100644 --- a/03-Azure/01-04-AI/08_Predictive_Maintenance/walkthrough/challenge-01/solution-01.md +++ b/03-Azure/01-04-AI/08_Predictive_Maintenance/walkthrough/challenge-01/solution-01.md @@ -82,7 +82,7 @@ az cosmosdb sql container list \ --account-name "$COSMOS_ACCOUNT_NAME" \ --resource-group "$RESOURCE_GROUP" \ --database-name "FactoryOpsDB" \ - --query "[].id" --output tsv + --query "[].name" --output tsv ``` Expected output (order may vary): @@ -95,6 +95,12 @@ KnowledgeBase PartsInventory Technicians WorkOrders +MaintenanceHistory +MaintenanceWindows +Suppliers +MaintenanceSchedules +PartsOrders +ChatHistories ``` ```bash @@ -112,7 +118,7 @@ Expected output: `5` ```bash # Re-upload the knowledge base wiki articles - for f in data/kb-wiki/*.md; do + for f in 03-Azure/01-04-AI/08_Predictive_Maintenance/labautomation/data/kb-wiki/*.md; do az storage blob upload \ --connection-string "$AZURE_STORAGE_CONNECTION_STRING" \ --container-name machine-wiki \