Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ The data lives in **Microsoft Fabric** (a governed Lakehouse with inventory, dem
```text
What can you do?
```
- You will inspect agent decisions in Challenges 3 and 4 via **Traces → Response view** on an agent (not a top-level *Tracing* menu).
- You will inspect agent decisions in Challenges 3 and 4 in the agent's **Traces** tab (not a top-level *Tracing* menu).

![Models and endpoints view in the Foundry portal showing gpt-5.4-mini deployed with status Succeeded](../images/challenge-00-model-deployments.png)

Expand Down Expand Up @@ -172,7 +172,7 @@ The data lives in **Microsoft Fabric** (a governed Lakehouse with inventory, dem
- **Workspace ID** — the value between `/workspaces/` and `/dataagents/`
- **Agent ID** — the value between `/dataagents/` and `/agent`

You paste both IDs into the Fabric Data Agent tool in Challenge 2.
Keep both IDs for diagnostics. In Challenge 2 you select your published `inventory-hack-agent` by name through **Fabric IQ**, so you don't paste them anywhere.

![MCP server URL with the Workspace ID and Agent ID segments identified](../images/challenge-00-agent-ids.png)

Expand Down Expand Up @@ -210,7 +210,7 @@ The data lives in **Microsoft Fabric** (a governed Lakehouse with inventory, dem
> 2. Then **either** re-run the notebook's publish cell (it's idempotent), **or** open the **`inventory-hack-agent`** data agent → tick **all 7 tables** in the **Explorer** (left pane) → **Publish**.

**d. Copy your two IDs.**
When it finishes, the **last cell prints your Workspace ID and Agent ID**. Note both — you paste them into the Fabric Data Agent tool in Challenge 2.
When it finishes, the **last cell prints your Workspace ID and Agent ID**. Note both for diagnostics. Challenge 2 selects the published item by name through **Fabric IQ**, so you don't paste them anywhere.

![Final notebook cell output printing the Workspace ID and Data Agent ID](../images/challenge-00-notebook-ids.png)

Expand All @@ -229,10 +229,9 @@ The data lives in **Microsoft Fabric** (a governed Lakehouse with inventory, dem
|-------|---------------------|
| Workspace ID | printed by the notebook's last cell (also in the workspace URL) |
| Artifact / Data Agent ID | printed by the notebook's last cell |
| Connection name | `inventory-hack-agent` |

> [!NOTE]
> You attach the **Fabric Data Agent** as a *tool* on each Foundry agent, and the connection is created the **first time** you add it (Challenge 2). After that you simply **select** it. It points your Foundry agents at the data agent on top of **your** inventory Lakehouse.
> You attach your published Data Agent as a *tool* on each Foundry agent through **Fabric IQ (OneLake Catalog)**. The connection is created the **first time** you add it (Challenge 2). After that you simply **select** it. It points your Foundry agents at the data agent on top of **your** inventory Lakehouse. The IDs above are for diagnostics only, because you pick the agent by name.

5. **Understand the three-agent pattern.**
Draw (on paper or a whiteboard) the flow:
Expand All @@ -257,7 +256,7 @@ The data lives in **Microsoft Fabric** (a governed Lakehouse with inventory, dem

- [ ] You can name the key inventory tables and explain what each one is used for.
- [ ] You have confirmed the `gpt-5.4-mini` model is deployed in your Foundry project.
- [ ] You have created your own Fabric workspace on your Fabric capacity, run the setup notebook, and published your `inventory-hack-agent` Data Agent — and noted its **Workspace ID** and **Agent ID** (used in Challenge 2).
- [ ] You have created your own Fabric workspace on your Fabric capacity, run the setup notebook, and published your `inventory-hack-agent` Data Agent — and noted its **Workspace ID** and **Agent ID** (for diagnostics; Challenge 2 selects the agent by name through Fabric IQ).
- [ ] You can describe, in one sentence each, what each of the three agents does.
- [ ] You can explain why combining web signals with governed data produces better decisions than either source alone.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

## 🎯 Objective

Build your first Foundry prompt agent. Configure it with two tools — **Web Search** and the **Fabric Data Agent** — and use it to sense a real-world demand change and reconcile it against the current inventory position. No code required; everything is done in the Foundry portal.
Build your first Foundry prompt agent. Configure it with two tools — **Web Search** and **Fabric IQ** (connected to your published Fabric Data Agent) — and use it to sense a real-world demand change and reconcile it against the current inventory position. No code required; everything is done in the Foundry portal.

## 🧭 Context

Expand All @@ -28,7 +28,7 @@ Your agent must sense this signal from the web, query the governed inventory dat
Your role is to detect real-world signals that could affect product demand and reconcile
them against the company's current inventory position.

IMPORTANT - tool use (non-negotiable): You have a Fabric Data Agent tool connected to the
IMPORTANT - tool use (non-negotiable): Fabric IQ connects inventory-hack-agent to the
governed Zava inventory data (Inventory, Products, Stores, DemandHistory, ExternalSignals,
Suppliers, ReplenishmentOrders). EVERY response that gives a demand assessment MUST include
at least one Fabric Data Agent call - this is mandatory and NOT conditional on Web Search.
Expand Down Expand Up @@ -61,26 +61,25 @@ Your agent must sense this signal from the web, query the governed inventory dat

### Part B — Confirm the Web Search tool (5 min)

**Web Search** is added to prompt agents by default and needs no configuration — it grounds the demand signal in live external context (news, market trends). Confirm it's listed under **Tools** in the agent editor. If it isn't there, add it via **+ Add tool → Web Search** (no API key required), then **Save**.
**Web Search** is added to prompt agents by default and needs no configuration — it grounds the demand signal in live external context (news, market trends). Confirm it's listed under **Tools** in the agent editor. If it isn't there, select **Add** under **Tools** and switch **Web search** on (no API key required), then **Save**.

![Tool catalogue in the agent editor showing Web Search and Fabric Data Agent available to add](../images/challenge-01-add-tool.png)
### Part C — Connect the Data Agent through Fabric IQ (10 min)

### Part C — Add the Fabric Data Agent tool (10 min)
The published **Fabric Data Agent** is still your governed query backend. The Foundry tool that connects to it is now **Fabric IQ (OneLake Catalog)**: the earlier **Fabric Data Agent** tool (which asked for a Workspace ID and Agent ID) is deprecated and greyed out in the tool catalogue. You select your Data Agent by name, so you no longer need the two IDs.

This is the first agent where you attach the Fabric Data Agent, so you'll **create** the `inventory-hack-agent` connection here using the two IDs from Challenge 1. Every later challenge just selects it.
1. In the agent editor, under **Tools**, select **Add → Add tools**.
2. In the **Select a tool** dialog, stay on the **Configured** tab, choose **Fabric IQ (OneLake Catalog)** and select **Add tool**. The older **Fabric Data Agent** tile is greyed out; don't use it.

1. In the agent editor, expand **Tools** and select **Add**.
2. Choose **Fabric Data Agent** from the tool catalogue.
3. Create the connection with the two IDs your **setup notebook printed in Challenge 1**:
- **Workspace ID** → your Fabric workspace ID
- **Artifact / Data Agent ID** → your `inventory-hack-agent` Agent ID
- **Connection name** → `inventory-hack-agent`
4. Select **Add tool**, then **Save**.
![The Select a tool dialog with Fabric IQ (OneLake Catalog) selected and the retiring Fabric Data Agent greyed out](../images/challenge-01-add-tool.png)

![The Add tool → Fabric Data Agent connection dialog with the Workspace ID and Artifact ID fields, named inventory-hack-agent](../images/challenge-01-new-connection.png)
3. In the **OneLake Catalog**, filter by **Data agent**, then select your published **`inventory-hack-agent`**. Check that its **Location** is **your** `inventory-hack-…` workspace. Do not select another team's item. Then select **Add**.

![The OneLake Catalog dialog with inventory-hack-agent selected and its Location column visible](../images/challenge-01-fabric-iq-catalog.png)

4. If the portal asks you to sign in or consent for Fabric, do so with your lab account in the same browser. Then select **Save**. The tool appears under **Tools** as **Fabric IQ (inventoryhackagent)**; later challenges reuse this connection.

> [!TIP]
> **No "Fabric Data Agent" in the catalogue?** Your Fabric capacity must be running (Azure portal → your Fabric capacity → **Resume**) and the setup notebook must have published the agent.
> **Data Agent missing from the catalog?** Your Fabric capacity must be running (Azure portal → your Fabric capacity → **Resume**), and the setup notebook must have published the agent.

> [!NOTE]
> **Why two tools?** Web Search gives the agent access to what is happening *outside* the business. The Fabric Data Agent gives access to what is happening *inside* — including the `ExternalSignals` table of pre-loaded market signals. Combining live web context with governed internal data is the core pattern of this hack.
Expand Down Expand Up @@ -115,7 +114,7 @@ This is the first agent where you attach the Fabric Data Agent, so you'll **crea

## 🏁 Success criteria

- [ ] The `demand-sensing-agent` prompt agent exists in your Foundry project with the Fabric Data Agent tool attached (and Web Search too, if it is enabled).
- [ ] The `demand-sensing-agent` prompt agent exists in your Foundry project with Fabric IQ connected to `inventory-hack-agent` (and Web Search too, if it is enabled).
- [ ] A test run produces a response backed by at least one governed data point from the Fabric Data Agent (and an external web source, if Web Search is enabled).
- [ ] The agent produces a clear demand assessment (adequate / at risk / critically exposed) with reasoning.
- [ ] You can explain in your own words what each tool contributed to the response.
Expand All @@ -124,15 +123,14 @@ This is the first agent where you attach the Fabric Data Agent, so you'll **crea

| Symptom | Fix |
|---------|-----|
| **Web Search** isn't listed on the agent | Add it via **+ Add tool → Web Search** — it needs no extra configuration. |
| **Fabric Data Agent** isn't in the catalogue | The integration needs **your** Fabric capacity to be running — resume it (Azure portal → your Fabric capacity → **Resume**) and confirm the setup notebook published the agent. |
| **Web Search** isn't listed on the agent | Under **Tools**, select **Add** and switch **Web search** on. It needs no extra configuration. |
| **Fabric IQ (OneLake Catalog)** or your Data Agent isn't there | The integration needs **your** Fabric capacity to be running — resume it (Azure portal → your Fabric capacity → **Resume**) and confirm the setup notebook published the agent. |
| The agent answers inventory questions from memory | Strengthen the *IMPORTANT – tool use* line in the instructions; it must call the Fabric Data Agent for any stock number. |
| The agent gives a demand assessment from web signals only (says it *"couldn't verify inventory"*) | It skipped the Fabric call. Reply *"Call the Fabric Data Agent now for current stock + sales velocity of the affected SKUs before assessing,"* or set **tool choice = required** in the agent's tool settings. `gpt-5.4-mini` (a reasoning model) sometimes skips available tools. |
| The agent has `fx` functions like `query_inventory` / `list_low_stock` instead of the Fabric Data Agent | The portal **auto-generated stub functions** from your instructions — they're empty and never reach your Lakehouse. Remove them (each tool row → **⋮ → Remove**) and add the **Fabric Data Agent** connector (Part C). |
| You didn't copy the **Workspace ID / Agent ID** in Challenge 1 | Reopen `inventory-hack-agent` in Fabric → **Settings → Model Context Protocol → MCP server URL** (both IDs are in the URL), or re-run the setup notebook's last cell. |
| The agent has `fx` functions like `query_inventory` / `list_low_stock` instead of Fabric IQ | The portal **auto-generated stub functions** from your instructions — they're empty and never reach your Lakehouse. Remove them (each tool row → **⋮ → Remove**) and add **Fabric IQ (OneLake Catalog)** (Part C). |
| You see a message that the **Fabric Data Agent** tool is deprecated, or it asks for a Workspace ID and Agent ID | That is the earlier connector. Cancel and use **Add → Add tools → Fabric IQ (OneLake Catalog)** (Part C). You select the agent by name, so you don't need the IDs. |
| *"Your requests to gpt-5.4-mini … exceeded rate limit"* | You hit the model's tokens-per-minute (TPM) limit. Wait ~30–60s and retry, and avoid firing many runs back-to-back. Facilitators can raise the deployment TPM or give each attendee their own subscription (see [`labautomation/README.md`](../labautomation/README.md)). |
| The run fails with **`Stage configuration not found`** (or *configuration not found*) | Your Fabric Data Agent works in Fabric's **Test data agent** pane but isn't **published** — the Foundry tool consumes the *published* stage, not the draft/Preview runtime. In Fabric, open `inventory-hack-agent` → confirm the 7 tables → click **Publish**, then retry. |
| The connection dialog asks for IDs you don't have | Copy the **Workspace ID** and **Agent ID** your setup notebook printed in its last cell (Challenge 1). |

## 🚀 Go further

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Your Inventory Optimisation Agent answers these questions by querying the Fabric
description of the affected product categories or SKUs. Your job is to produce a
concrete reorder recommendation.

IMPORTANT - tool use: You have a Fabric Data Agent tool connected to the governed Zava
IMPORTANT - tool use: Fabric IQ connects inventory-hack-agent to the governed Zava
inventory data (Inventory, Products, Stores, DemandHistory, Suppliers, ReplenishmentOrders).
For ANY inventory number - stock level, reorder point, safety stock, average daily sales -
you MUST call the Fabric Data Agent and answer from its result. Never answer from memory
Expand All @@ -59,8 +59,10 @@ Your Inventory Optimisation Agent answers these questions by querying the Fabric
If you cannot find a SKU in the data, say so clearly - do not invent numbers.
```

5. Add the **Fabric Data Agent** tool and select the existing **`inventory-hack-agent`** connection (created in Challenge 2).
6. **Remove the Web Search tool.** New prompt agents ship with **Web Search** attached by default, and `gpt-5.4-mini` will happily reach for it instead of the governed data. Under **Tools**, delete **Web Search** so the **only** tool is the Fabric Data Agent — this agent works from internal data only.
5. Add **Fabric IQ** by **reusing the connection you made in Challenge 2**: under **Tools** select **Add → Add tools**, and on the **Configured** tab choose the existing **`inventoryhackagent`** tile, then **Add tool**. It points to your published `inventory-hack-agent`, so you don't need to browse the catalog again. Do not use the deprecated **Fabric Data Agent** tool.

![The Select a tool dialog with the existing inventoryhackagent connection listed under Configured](../images/challenge-02-reuse-connection.png)
6. **Remove the Web Search tool.** New prompt agents ship with **Web Search** attached by default, and `gpt-5.4-mini` will happily reach for it instead of the governed data. Under **Tools**, delete **Web Search** so the **only** tool is Fabric IQ — this agent works from internal data only.
7. Click **Save**.

### Part B — Run the agent (15 min)
Expand Down Expand Up @@ -94,26 +96,26 @@ Your Inventory Optimisation Agent answers these questions by querying the Fabric
> [!IMPORTANT]
> This is the most important part of the challenge. Understanding what an agent did — and why — is essential for building trust with stakeholders and catching errors before they reach production.

1. Open the `inventory-optimisation-agent` and select **Traces → Response view**. (In the current Foundry portal, tracing lives on the agent as **Traces** — there is no top-level *Tracing* menu.)
2. Find the most recent run of `inventory-optimisation-agent`.
3. Open the trace and locate:
- The **model call** — what instructions and context were sent to gpt-5.4-mini?
- The **tool call** — what exact NL query was sent to the Fabric Data Agent?
- The **tool response** — what data did Fabric return?
- The **final generation** — how did the model synthesise the data into the recommendation?
1. Open the `inventory-optimisation-agent` and select the **Traces** tab (next to **Playground** and **Details**). The **Trace view** lists each run with its duration, tokens, estimated cost and agent version.
2. Select the **Trace ID** of the most recent run.
3. In the **Trajectories** tab, expand the span tree and locate:
- The **model call**: the `Chat` span. Select it to see what instructions and context were sent to gpt-5.4-mini.
- The **tool call**: the `Execute Tool` span (`mcp_inventoryhackagent.DataAgent_inventory_hack_agent`). Select it to see the exact natural-language query sent to the Fabric Data Agent.
- The **tool response**: the same span. Select **Input + Output** on the right to see what data Fabric returned.
- The **final generation**: the `Invoke Agent` span's output, which shows how the model turned the data into the recommendation.

![Expanded trace view showing the model call, Fabric tool call, tool response, and final generation spans](../images/challenge-02-trace.png)
![A trace showing the Invoke Agent span with its Execute Tool and Chat spans, and the Input + Output panel with the agent's final answer](../images/challenge-02-trace.png)

> [!NOTE]
> The **Traces → Response view** on the agent gives the full span tree shown above. The quick **Traces** link at the bottom of a playground chat opens a lighter, differently-laid-out view of the same run — either works, but the Response view is the one this challenge describes.
> The quick **Traces** link under an answer in the playground opens the same viewer as a popup for the whole conversation, with one **Invoke Agent** span per question. The **Traces** tab shows one run at a time. Either works.
4. Answer these questions by reading the trace:
- Did the agent query Fabric once or multiple times? Why?
- Was the reorder quantity calculation visible in the trace?
- Did the agent correctly identify the CRITICAL items?

## 🏁 Success criteria

- [ ] The `inventory-optimisation-agent` prompt agent exists with only the Fabric Data Agent tool (no Web Search).
- [ ] The `inventory-optimisation-agent` prompt agent exists with only the Fabric IQ tool (no Web Search).
- [ ] A test run returns a recommendation table with at least one CRITICAL flagged item.
- [ ] You have opened the trace for your run and can identify the model call, tool call, tool response, and final generation steps.
- [ ] You can explain, by pointing to the trace, why the agent made the recommendation it did.
Expand Down
Loading
Loading