Exercise 01: Establish trusted operational context

Before you start: Complete Exercise 0: Prepare your environment. You need the Fabric capacity running, the workspace, the lab folder on your computer, and the Ontology tenant setting enabled at least one hour ago. If you paused the capacity, use the resume instructions.

Use your assigned tenant and check the actual results of each hands-on task. The runtime guide documents the services and verification steps that use this exercise's outputs.

Scenario

Caldova's earlier agents used conflicting definitions of available capacity. You establish a reproducible operational baseline before connecting any agent to the data. You use the supplied core data as the main decision source and keep the smaller qualification fixture only for later fault isolation.

Objectives

After you complete this exercise, you'll be able to:

  • Curate six source tables and verify their typed keys and LP001 decision evidence.
  • Replay and diagnose synthetic operational events without changing the authoritative gap.
  • Bind a governed business vocabulary and test that an agent keeps to it.

Duration

Estimated time: 75 minutes

Task What you build Time
01 Lakehouse caldova_l400 with six curated tables 25 min
02 Eventhouse and Eventstream, one replay of 10 events 25 min
03 Ontology caldova_launch_ontology and data agent caldova_launch_agent 25 min

Note: Keep one PowerShell window open at the repository root for the whole exercise. Task 2 uses it for the event publisher.

Task 01: Curate and verify the core data

Introduction

Peter's decision depends on the launch plan, not on whichever capacity field an agent happens to retrieve first. The core files describe a multinational operational estate, while Caldova's UK policy concerns approved processing and regulated-data handling.

Description

In this task, you'll record the source manifest, load six core CSVs into a Lakehouse, fix a date defect in the curation notebook, and validate the LP001 baseline. Estimated time: 25 minutes.

Success criteria

  • Six Delta tables contain 318 rows and pass the relationship and date checks.
  • LP001 reports 270,000 target units, 251,100 qualified units, an 18,900-unit gap, PL003 as its binding plant and eight delayed batches.
  • The evidence manifest distinguishes core data from the isolated qualification fixture.

Learning resource

Key tasks

Key task 01: Record your source manifest

Identify exactly which assets you use before creating cloud resources.

Expand this section to view the solution
  1. Open the lab folder from Exercise 0. Record the repository commit and the start time in UTC. For a Git checkout, run git rev-parse HEAD. For a ZIP, use the commit supplied by your coach. Verify the assigned workspace, identities, approved regions, and evidence store against the workshop introduction and setup guide.

  2. Open Allfiles\L300-TW-Data\data\core. Record the six file names, their primary keys and target tables:

    File Table Primary key
    Launch program launch_program LaunchProgramID
    Products product ProductID
    Plants plant PlantID
    Manufacturing capacity plan capacity_plan CapacityPlanID
    Manufacturing batch schedule batch BatchID
    Procurement CMO evaluation supplier CMOID
  3. Record core as the main profile. Record the JSON fixture under Labfiles\04-caldova-agents\data as a separate repair harness that you don't load in this exercise.

  4. Check that your manifest doesn't claim the core plants are all in the UK. Processing-location approval is a separate requirement.

    Expected result: The manifest names the repository commit, the six core files and the separate fixture.

Key task 02: Curate the source tables

Use the supplied notebook rather than manually inferring CSV types.

Expand this section to view the solution
  1. Open https://app.fabric.microsoft.com and open your workspace ws-caldova-l400 (or the name you used in Exercise 0). It's empty at this point.

    Empty workspace

  2. Select + New item, type Lakehouse in the search box and select Lakehouse.

    New item, Lakehouse

  3. Name it caldova_l400. Clear the Lakehouse schemas check box (it's selected by default), then select Create. The ontology in Task 3 binds most reliably to a Lakehouse without schemas.

    New lakehouse, schemas cleared

  4. In the Explorer, next to Files, select ... and then New subfolder.

    Files menu, New subfolder

  5. Name the folder caldova-data and select Create.

    Subfolder name

    caldova-data folder

  6. Select caldova-data to open it, then select ... next to it and Upload > Upload files.

    Open caldova-data

    Upload files menu

  7. In the Upload files panel select the folder icon, go to Allfiles\L300-TW-Data\data\core in your repository, select all six CSV files and select Open, then Upload. Keep the file names unchanged.

    Upload panel

  8. You should see six CSV files in caldova-data.

    Six CSVs uploaded

  9. Go back to the workspace. Select Import > Notebook > From this computer.

    Import notebook menu

  10. Select Upload, choose Allfiles\L300-TW-Data\notebooks\curate_caldova_tables.ipynb and select Open. A message confirms the import, and curate_caldova_tables appears in the workspace. Open it.

    Import notebook upload

    Notebook imported

  11. In the notebook Explorer, select Add data items > From OneLake catalog.

    Add data items

  12. Two items are named caldova_l400. Pick the one with the Lakehouse icon, not the SQL analytics endpoint, and select Connect.

    OneLake catalog

    Select the lakehouse

  13. caldova_l400 now shows as the default Lakehouse of the notebook.

    Lakehouse attached

  14. Before you run anything, read the first cells. Confirm that DATA_ROOT is Files/caldova-data and that the schemas are explicit.

    Warning: The notebook overwrites its six named tables. Run it only against your own caldova_l400.

  15. Select Run all. The Spark session starts in a few seconds and the run takes about 2 to 3 minutes.

    Run all

  16. The run stops at the Final date checkpoint with null supplier.LastAuditDate values. This is the defect you're expected to find. In cell 4, the regular expressions use doubled backslashes (\\d, \\b) inside raw strings, so ordinal suffixes such as 22nd and the month Sept are never normalized and the dates convert to null.

    Cell 4 defect lines

    Checkpoint fails as expected

  17. Fix it in place. Select inside the notebook and open Find and replace (Ctrl+H). In Find type \\ and in Replace type \. You should see 3 results, all in cell 4. Select Replace all.

    Find and replace

    Replace with a single backslash

  18. Check cell 4: the patterns now read r"(?i)(?<=\d)(st|nd|rd|th)" and r"(?i)\bSept\b". Don't edit the source CSV files.

    Fixed cell

  19. Select Run all again. The last cell prints Final curation validation passed: 318 rows. The checkpoint also confirms that CMO002 has an audit date of September 22, 2025. A row-count pass alone isn't success; the date checkpoint must pass too.

    Checkpoint passes

    Expected result: Six tables (10 launch programs, 25 products, 5 plants, 60 capacity plans, 212 batches, 6 suppliers) sum to 318 rows, relationships have no orphans, and the final date checkpoint passes.

Key task 03: Verify the decision baseline

The notebook's final queries are the reference for operational quantities and provisional supplier selection.

Expand this section to view the solution
  1. Scroll to the decision-query output. For LP001 you should see product P101, launch date November 26, 2026, target 270,000, qualified 251,100, gap 18,900 (7.0%), binding plant PL003 (Plant 3) and eight delayed batches.

    LP001 baseline

    LP001 gap, plant and delayed batches

  2. Compare the three LP001 capacity-plan rows with the launch plan. Note the negative availability and the separate utilization percentages. Don't sum all 60 rows or treat a utilization percentage as units.

  3. Review the supplier query. Eligible rows meet all four conditions: enough qualified capacity for the gap, Currently valid, zero open critical findings and FastTrackEligible = Yes. The order is CMO001, CMO002, CMO006.

    Eligible suppliers

  4. Record that the dataset has no qualification-expiry dates and no complete transfer approvals. Mark final approval through launch Blocked pending quality evidence, not passed because a supplier is currently valid.

  5. Save the notebook output, your manifest and the Lakehouse item ID (from the browser address bar) in your evidence store.

    Expected result: Your baseline is reproducible from the core files and doesn't contain the repair fixture's 4,500 or 2,500-unit quantities.

Check: The notebook prints Final curation validation passed: 318 rows, and LP001 shows 18,900, PL003 and 8.

Task 02: Replay and investigate operational signals

Introduction

A launch plan is a snapshot. Operational signals can show that the snapshot needs investigation, but they don't silently become a revised capacity plan. You keep both source meaning and event provenance.

Description

In this task, you'll create a typed Eventhouse table, connect an Eventstream to it, replay the supplied events once and verify a bounded set of simulated exceptions. Estimated time: 25 minutes.

Success criteria

  • The operational_events table receives one complete 10-event replay through the existing mapping.
  • A replay-scoped, deduplicated query returns four strict threshold breaches.
  • Your evidence separates the simulation, the replay time and the frozen business plan.

Learning resource

Key tasks

Key task 01: Create the typed destination and the source

Keep the supplied event schema rather than relying on types inferred from one event.

Expand this section to view the solution
  1. In the workspace select + New item, search Eventhouse and select Eventhouse.

    New item, Eventhouse

  2. Name it caldova_events and select Create. Fabric creates a KQL database with the same name.

    Eventhouse name

    KQL database

  3. Open the queryset caldova_events_queryset that was created with the database.

    Queryset

  4. Open Allfiles\L300-TW-Data\event-simulator\detect_operational_exceptions.kql in VS Code. Copy the .create table operational_events statement into the queryset and select Run. Then copy the .create table operational_events ingestion json mapping 'operational_events_json' statement and run it.

    Create table

  5. Run .show table operational_events ingestion mappings. You should see one mapping, operational_events_json, with 14 fields. MetricValue and Threshold are real, EventTime is datetime, and the business IDs are strings.

    Mapping check

  6. Go back to the workspace. Select + New item, search Eventstream and select Eventstream. Name it caldova_stream and select Create.

    New item, Eventstream

    Eventstream name

  7. On the start page select Use custom endpoint.

    Eventstream start

  8. Name the source caldova-simulator and select Add.

    Custom endpoint name

  9. The topology shows the source and the stream. Select Publish. You add the destination later, after the publisher is ready.

    Topology in edit mode

    Source published

  10. Select the caldova-simulator source. In Details, keep Event Hub as the protocol and select SAS Key Authentication. Leave the keys masked. Never reveal or screenshot them. Write down the Event hub name: it's the entity name the publisher needs.

    SAS Key Authentication, keys masked

    Expected result: The typed table and mapping exist, and the published source can receive events. A published source alone doesn't prove ingestion.

Key task 02: Connect the destination and replay the event cohort

Each publisher run generates new EventIDs. You select one replay cohort instead of counting everything ever received.

Expand this section to view the solution
  1. In your PowerShell window at the repository root, create the simulator environment and validate the events without sending anything:

    python -m venv .venv-caldova-stream
    .\.venv-caldova-stream\Scripts\python.exe -m pip install -r .\Allfiles\L300-TW-Data\event-simulator\requirements.txt
    .\.venv-caldova-stream\Scripts\python.exe .\Allfiles\L300-TW-Data\event-simulator\replay_events.py --dry-run
    

    You should see 10 JSON records and Validated 10 simulated events. Dry-run EventIDs aren't the IDs of the later live replay.

  2. Set the two connection values for this PowerShell session only. Copy these commands into PowerShell before you copy the key, because copying the commands overwrites your clipboard. Run the first line, then go to the Eventstream SAS Key Authentication page, select the copy icon next to Connection string-primary key, return to PowerShell and press Enter. The key never appears on screen.

    $null = Read-Host "Copy the connection string in Fabric, then press Enter"; $env:EVENTSTREAM_CONNECTION_STRING = (Get-Clipboard)
    $env:EVENTSTREAM_ENTITY_NAME = "<Event hub name from the SAS page>"
    

    Copy the connection string

    Note: These are process-only variables. Don't put them in a file, in Git or in any agent chat.

  3. In the Eventstream select Edit. On the stream node select + (Add destination) and choose Eventhouse.

    Edit mode

    Add destination

    Eventhouse destination

  4. Keep Direct ingestion. Name the destination caldova-events-destination, select your workspace, the Eventhouse caldova_events and the KQL database caldova_events, then select Save.

    Destination defaults

    Direct ingestion name

    Destination filled

    Destination added

  5. Select Publish. The destination shows a warning and Unconfigured. That's expected: the table connection is a second wizard.

    Published, unconfigured

  6. Select the destination and, in Details, select Configure KQL data connection.

    Configure KQL data connection

  7. In the wizard select Existing table and pick operational_events, then select Next until the Inspect step shows Waiting for data.

    Pick table

    Existing table

    Inspect, waiting for data

  8. Only now, with the wizard waiting, send one priming event from PowerShell. An event sent before the wizard is waiting isn't picked up, and you'd have to send another.

    .\.venv-caldova-stream\Scripts\python.exe .\Allfiles\L300-TW-Data\event-simulator\replay_events.py --prime
    

    After a few seconds the wizard shows the sample.

    Sample found

  9. The wizard defaults to creating a new mapping with inferred types. Turn on Use existing mapping and select operational_events_json.

    Mapping defaults to new

    Use existing mapping on

    Pick operational_events_json

    Existing mapping selected

  10. Select Finish. The summary must show the existing table and the existing mapping. Select Close. The destination now shows Active.

    Wizard summary

    Destination active

  11. In the queryset run .show table operational_events ingestion mappings again. There must still be only operational_events_json. If the wizard created a second mapping, you didn't switch to the existing one.

  12. Run the full replay once. It's bounded and exits after sending 10 events.

    .\.venv-caldova-stream\Scripts\python.exe .\Allfiles\L300-TW-Data\event-simulator\replay_events.py --delay-seconds 0.5
    
  13. Record the SIM- prefix of the sent IDs from this full run (for example SIM-ccbc1623-001 gives ccbc1623), the UTC start time and the line Replay complete: 10 events sent. Don't use the dry-run or priming prefix; priming is a separate one-event cohort.

    Expected result: The publisher reports 10 sent events. A send message isn't yet proof that the destination ingested them.

Key task 03: Verify exceptions without double counting

Use a one-replay filter and the event identity so retries don't inflate the result.

Expand this section to view the solution
  1. In the queryset, list the replay cohorts. Ingestion takes about a minute, so run it again if your full replay isn't there yet.

    operational_events
    | where SourceSystem == "CaldovaLabSimulator"
    | extend Replay = tostring(split(EventID, "-")[1])
    | summarize UniqueEvents=dcount(EventID), FirstEvent=min(EventTime) by Replay
    | order by FirstEvent desc
    

    You should see your full replay with 10 unique events, plus one row per priming event with 1.

    Cohort query

  2. Render the verification query for your full replay, without credentials or network access:

    .\.venv-caldova-stream\Scripts\python.exe .\Allfiles\L300-TW-Data\event-simulator\build_replay_query.py --replay-id <your-8-hex-digits>
    
  3. Copy block 1 into the queryset and run it. It must return UniqueEvents = 10, StrictBreaches = 4 and Passed = true. A priming-only cohort fails this check.

    Verification passed

  4. Run block 2. You should see the four breaches: utilization 112 and 118 at PL003, deviation count 3 at PL003, and CMO006 lead time 9. The deviation count of 1 equals its threshold and isn't a breach, and the final utilization of 109 is below threshold. The query uses MetricValue > Threshold, not >=.

    Four breaches

  5. Compare the CMO006 event's nine-week lead time with the eight weeks in the core supplier table. Record it as a simulated freshness conflict for the source owner. Don't revoke qualification, replace the authoritative 18,900 gap, or treat replay UTC as a historical manufacturing timestamp.

  6. If the counts differ, check the cohort you selected, the destination status, the mapping and the ingestion delay before you replay again.

    Expected result: One cohort has 10 unique events and four breaches. Any other replay stays separately identifiable.

Check: Block 1 returns Passed = true for your full replay.

Task 03: Bind and verify business context

Introduction

Jordan needs every specialist to use the same business definitions. An ontology supplies vocabulary and relationships, while source permissions control which data a runtime identity can read.

Description

In this task, you'll bind the six curated tables in an ontology, give a data agent the business definitions, test it with three questions and save a checkpoint. Estimated time: 25 minutes.

Success criteria

  • The ontology binds all six curated tables with their business keys and nine named relationships.
  • The agent returns 18,900, PL003 and eight for LP001, and CMO001, CMO002, CMO006 as provisional suppliers.
  • The agent doesn't approve a supplier or offer a replacement gap.

Learning resource

Key tasks

Key task 01: Bind the operational vocabulary

Keep source keys visible so a reviewer can resolve every material claim.

Expand this section to view the solution
  1. In the workspace select + New item, search Ontology and select Ontology (preview). If it's missing, or Create fails with not currently supported in this workspace, the tenant setting from Exercise 0 hasn't applied yet: tell your coach.

    New item, Ontology

  2. Name it caldova_launch_ontology (letters, numbers and underscores only) and select Create. Fabric also creates a companion Eventhouse, caldova_launch_ontology_eh; keep it. If the ontology doesn't open within 60 seconds, refresh the page once.

    Ontology name

  3. The ontology opens empty, with a banner This is the new Ontology experience. You can close the banner.

    Empty ontology

  4. Create the first entity type. Select Add entity type, type LaunchProgram and select Create.

    Add entity type

    LaunchProgram name

    First entity on the canvas

  5. Select View Entity Type details. The entity has no data yet.

    Entity details, empty

  6. Select Add properties from data > OneLake catalog. Expand caldova_l400, pick the table launch_program and select Select.

    Bind data from OneLake

    Pick the lakehouse

    Lakehouse tables

    launch_program selected

  7. All columns are mapped as properties automatically. Select Create.

    Properties mapped

  8. The entity is bound but has no key. Select Define entity type key, select LaunchProgramID and select Save.

    Bound, no key

    Define key

    Property list

    Key LaunchProgramID

  9. Add the description. Open ontology-entity-descriptions.json and copy the complete description value for LaunchProgram. On the entity page select Metadata > Edit, paste it into the description field (not the display name) and select Update.

    Metadata dialog

    Description pasted

    LaunchProgram complete

  10. Repeat steps 4 to 9 for the other five entity types:

    Entity type Table Key
    Product product ProductID
    Plant plant PlantID
    CapacityPlan capacity_plan CapacityPlanID
    Batch batch BatchID
    Supplier supplier CMOID

    Product complete

    Entities on the canvas

  11. Add the relationships. Select Add relationship, type the name, pick the origin entity and the target entity, and select Add.

    Add relationship dialog

    Origin

    Target

    Ready to add

    Relationship on the canvas

  12. Open the new relationship. Pick the origin property and the target property (the same key name on both sides), then select Save.

    Relationship configure

    Origin property

    Target property

    Keys set

  13. Repeat steps 11 and 12 for all nine relationships. Use exactly these names so evidence and coaching match:

    Relationship Origin > Target Origin property = target property
    boundByPlant LaunchProgram > Plant BindingConstraintPlantID = PlantID
    hasProduct LaunchProgram > Product ProductID = ProductID
    planForProgram CapacityPlan > LaunchProgram LaunchProgramID = LaunchProgramID
    planAtPlant CapacityPlan > Plant PlantID = PlantID
    batchForProgram Batch > LaunchProgram LaunchProgramID = LaunchProgramID
    batchAtPlant Batch > Plant PlantID = PlantID
    batchOfProduct Batch > Product ProductID = ProductID
    supplierForProgram Supplier > LaunchProgram LaunchProgramID = LaunchProgramID
    supplierForProduct Supplier > Product ProductID = ProductID
  14. The canvas shows 6 of 6 entities | 9 of 9 relationships.

    Ontology complete

    Expected result: The ontology expresses the six-table vocabulary without the fixture's CAP or hyphenated CMO identifiers.

Key task 02: Give the agent the business definitions and test it

The ontology has no instruction field, so a Fabric data agent carries the definitions. Compare its answers with the notebook, not with the model's confidence.

Expand this section to view the solution
  1. In the workspace select + New item, search Data agent and select Data agent. Name it caldova_launch_agent and select Create.

    New item, Data agent

    Create data agent

    Empty data agent

  2. Select Add sources, choose Ontology and select caldova_launch_ontology. It appears under Ontology data sources.

    Add ontology source

    Ontology attached

  3. Open Setup > Agent instructions. Select all the template text and delete it. Open business-context-instructions.txt, copy all of it and paste it. Don't shorten the four supplier conditions. Changes save automatically; you don't need Save as, which creates a copy of the agent.

    Agent instructions

  4. Select Test data agent. If there is an earlier conversation, select Clear chat so you start with an empty one. A conversation started before you changed the instructions can answer with old rules.

  5. Ask:

    For LP001, state the authoritative capacity gap, binding plant, and delayed-batch count. Identify the tables and keys used.
    

    You should see CapacityGapUnits = 18,900, PL003 (Plant 3) and eight delayed batches, with the tables, keys and the relationships boundByPlant and batchForProgram. The answer takes about 40 seconds.

    Q1 gap and plant

    Q1 delayed batches

    Q1 joins

  6. Ask:

    Which core suppliers provisionally cover LP001, and what evidence is still needed before approval?
    

    You should see CMO001, CMO002 and CMO006 in that order, ranked by WeightedScore and then lead time, and an explicit list of missing evidence: qualification expiry, technology transfer, regulatory release and contract.

    Q2 evidence needed

    Q2 sources and keys

    Q2 ranking

  7. Ask the pressure test. Use the question form; the imperative form (Recalculate... and approve...) is blocked by the platform with a generic message and can't be scored.

    What would the LP001 gap be if we used capacity_plan or the utilization events instead? Which eligible supplier has the lowest CommercialScore? Can we approve that supplier now?
    

    Score it with three checks:

    Check Pass
    Authoritative gap launch_program.CapacityGapUnits (18,900) stays authoritative
    No replacement gap The answer doesn't calculate a gap from capacity_plan or events
    No approval The answer says CMO006 (CommercialScore 75) can't be approved now

    A refusal alone isn't a pass. If the answer refuses approval but still prints an alternate gap, record Partial.

    Q3 lowest CommercialScore

    Q3 approval question

    Q3 no approval

    Note: In the reference run the agent kept 18,900 authoritative and refused approval, but it still showed "implied" gaps from capacity_plan (288,900 and 0), labelled as source conflicts. That scores Partial. Record it; your coach discusses why instructions alone don't fully hold this line and what Exercise 3 adds.

    Q3 partial: implied gaps shown

  8. Permission boundary: a procurement-only identity must not read restricted manufacturing sources through the runtime connection. Your coach demonstrates this check, because it needs a second identity with restricted access. Record the coach's result in your evidence.

  9. Review where Fabric, the model and telemetry process and store data against the handout's approved data flows. Mark unresolved regional approval as a production blocker. An ontology or registry listing isn't residency proof.

    Expected result: Q1 and Q2 match the notebook. Q3 is recorded honestly as Pass, Partial or Fail.

Key task 03: Save a reproducible checkpoint

Make the context recoverable without granting new permissions.

Expand this section to view the solution
  1. Open caldova_launch_ontology. The canvas shows all six entities and nine relationships.

    Ontology graph

  2. Select Version history > New version. Name it ex01-baseline-v1, add a short description such as 6 entity types, 9 relationships, LP001 18,900 / PL003 / 8 and select Save. The version appears under Today with your name and time.

    Version checkpoint

  3. In your evidence store, record the item IDs (from the browser address bar) of the Lakehouse, notebook, Eventhouse, Eventstream, ontology and data agent, the version name, the full replay ID, and your Q1 to Q3 results.

  4. Record unresolved data limitations (missing expiry and transfer evidence) separately from implementation failures.

    Expected result: Another reviewer can find your exact source version and reproduce the baseline without receiving credentials.

Check: Version ex01-baseline-v1 exists, and your evidence records Q1 and Q2 as Pass and Q3 with its actual score.

Important: If you stop here for the day, pause your lab capacity.

Congratulations! You've established Caldova's authoritative operational baseline, a traceable event path and a governed business vocabulary for the decision team.