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
@@ -1,4 +1,5 @@
FROM mcr.microsoft.com/devcontainers/python:3.12-bookworm
# Python 3.13 matches the Azure Functions runtime of the Financial Evidence MCP (azure-functions 2.x needs 3.13).
FROM mcr.microsoft.com/devcontainers/python:3.13-bookworm

USER root

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,10 @@
"GitHub.copilot-chat"
],
"settings": {
"python.defaultInterpreterPath": "/usr/local/bin/python"
"python.defaultInterpreterPath": "/usr/local/bin/python",
"workbench.editorAssociations": {
"*.md": "vscode.markdown.preview.editor"
}
}
}
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
FROM mcr.microsoft.com/devcontainers/python:3.12-bookworm
# Python 3.13 matches the Azure Functions runtime of the Financial Evidence MCP (azure-functions 2.x needs 3.13).
FROM mcr.microsoft.com/devcontainers/python:3.13-bookworm

USER root

Expand Down
22 changes: 13 additions & 9 deletions 03-Azure/01-04-AI/07_Fraud_Intelligence/challenges/challenge-02.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,12 @@ Copy the value of the `mcp_extension` key and add it to `hackenv`:
echo 'financialEvidenceMcpSystemKey=<mcp-extension-value>' >> hackenv
```

Or read the key from the terminal instead of the portal:

```bash
echo "financialEvidenceMcpSystemKey=$(az functionapp keys list -g "$rg" -n "$functionAppName" --query systemKeys.mcp_extension -o tsv)" >> hackenv
```

Load the new environment variables into your shell:

```bash
Expand All @@ -127,13 +133,13 @@ In the Azure portal, open your **Microsoft Foundry** resource and select **Go to

#### Explore the Foundry project

The provided Microsoft Foundry project contains two model deployments: a chat model used by the agent and an embedding model. Find both deployments and review their details.
The provided Microsoft Foundry project contains two model deployments: a chat model used by the agent and an embedding model. Open **Models** under **Build** to find both deployments and review their details.

Next, connect the Application Insights resource deployed in your environment to the Foundry project. This connection allows you to monitor agent performance and investigate issues.

Open **Manage** and select **Project details** from the left menu. Select **Connected resources**, then **Add connection**.
Open **Manage** and select **Project details** from the left menu. Select the **Connections** tab, then **Add connection**.

![Connected resources in Microsoft Foundry](./images/foundry-connected-resources.png)
![Project connections in Microsoft Foundry](./images/foundry-connected-resources.png)

Select **Application Insights**, then select **Continue**. Choose the Application Insights resource deployed for your lab, leave **API key** as the authentication method, and select **Connect**.

Expand All @@ -145,11 +151,9 @@ Under **Build**, open **Agents**, select **New agent**, then select **Build an a

Name the agent `EvidenceEnrichmentAgent`.

The new agent opens with a blank configuration:

![Blank agent in Microsoft Foundry](./images/foundry-blank-agent.png)
The new agent opens with a blank configuration. Its **Model** may default to `model-router`, listed under **Models**. Open the **Model** list and select `gpt-5.6-luna` under **Deployments**. This is the chat model deployed for the lab; the embedding deployment is not a chat model.

The chat model is selected automatically because it is the only deployed model that can power this agent. The embedding deployment is not a chat model.
![Select the gpt-5.6-luna deployment in Microsoft Foundry](./images/foundry-blank-agent.png)

Select **Instructions** and copy the contents of `walkthrough/challenge-02/evidence-enrichment-agent/instructions.md` into the instruction editor.

Expand All @@ -173,9 +177,9 @@ Configure these values:

Select **Connect**. Foundry returns to the agent page and displays the new MCP tool.

Open the MCP tool's `...` menu and select **Configure**:
Open the MCP tool's `...` menu and select **Edit**:

![Configure MCP tool menu in Microsoft Foundry](./images/foundry-configure-mcp-tool-menu.png)
![Edit MCP tool menu in Microsoft Foundry](./images/foundry-configure-mcp-tool-menu.png)

Then enable **Always auto-approve all tools**.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,11 @@ After the resource is created, select **Create a knowledge base** and set the fo

- **Name**: kb-aml
- **Description**: Synthetic AML / CFT / KYC corpus for Fraud Intelligence
- **Chat completion model**: gpt-5-mini (or gpt-5.4-mini, new models are being added/delete to/from this configuration section)

Then expand **Improve retrieval** and set:

- **Chat completions model**: `gpt-5.6-luna` (the chat model deployed in your lab; it is the only one in the list)
- **Retrieval reasoning effort**: Minimal
- **Output mode**: Extractive data
- **Retrieval instructions**: You have to always retrieve first the global policies and rules.

![Foundry IQ Knowledge Base Creation](./images/foundry-iq-knowledge-base-creation.png)
Expand Down Expand Up @@ -150,7 +152,7 @@ Because this is the second agent, follow the same **Microsoft Foundry** agent cr
Relevant steps you should not miss include:

- Define the agent's name as `RegulatoryAssessmentAgent`
- Set the model: `gpt-5.6-luna`
- Set the model: `gpt-5.6-luna` (under **Deployments**, not `model-router`)
- Set instructions: find them under `walkthrough/challenge-03/regulatory-assessment-agent/instructions.md`. Review and validate content.
- Remove the `Web Search` tool, irrelevant for this agent.

Expand Down Expand Up @@ -367,7 +369,7 @@ Next, add the internal and regional policy sources.

Return to **Knowledge** and select the `kb-aml` knowledge base you created.

First, modify the **Retrieval instructions** to include the internal and regional policy sources after the global policies:
First, expand **Improve retrieval** and modify the **Retrieval instructions** to include the internal and regional policy sources after the global policies:

```text
You have to always retrieve first the global policies and rules, then the internal rules and policies, and finally the regional rules and policies based on the transaction's bank origin and destination. Only the ones for these countries if documentation exists.
Expand Down
23 changes: 20 additions & 3 deletions 03-Azure/01-04-AI/07_Fraud_Intelligence/challenges/challenge-04.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ The report must preserve source identifiers so an analyst can trace each finding
This is the third agent you will build, so follow the same creation and configuration process used for the previous agents. Configure the following settings:

- Define the agent's name as `AMLReportAgent`
- Set the model: `gpt-5.6-luna`
- Set the model: `gpt-5.6-luna` (under **Deployments**, not `model-router`)
- Set instructions: find them under `walkthrough/challenge-04/aml-report-agent/instructions.md`. Review and validate content.
- Remove the `Web Search` tool, irrelevant for this agent.

Expand Down Expand Up @@ -803,9 +803,9 @@ The source code is in the `orchestration` directory under `challenge-04`. Review
- `src/main.py`: The main entry point for the orchestration logic. That is where we will initialize and coordinate the various agents involved in the process.
- `azure.yaml`: Configuration file for the agent that is required during the phase of deploying the agent as **Hosted Agent** in **Microsoft Foundry**.

Ensure that the agents are defined correctly in the `main.py` file and that their names and versions match those running in the Foundry environment. Open the **Agents** section in the portal to verify these values.
The orchestration finds each agent by name and uses its **latest** saved version, so you do not need to edit `main.py`. The names must match the agents you created: `EvidenceEnrichmentAgent`, `RegulatoryAssessmentAgent` and `AMLReportAgent`. Open the **Agents** section in the portal to check the names and versions.

Those names and versions should be set correctly in the `main.py` file:
To pin a version, or if you named an agent differently, add it to the `.env` file you create below, for example `AML_REPORT_AGENT_VERSION=3` or `AML_REPORT_AGENT_NAME=MyReportAgent`. The prefixes are `EVIDENCE_ENRICHMENT_AGENT`, `REGULATORY_ASSESSMENT_AGENT`, `AML_REPORT_AGENT` and, from Challenge 5, `ALERT_MANAGER_AGENT`.

![Agents versions](./images/agents-versions.png)

Expand Down Expand Up @@ -912,6 +912,22 @@ Track the deployment progress in the **Output** panel in Visual Studio Code by s

![Deployment progress in Output panel](./images/deployment-progress-in-output-panel.png)

#### Allow the orchestration to call your agents

The hosted orchestration runs with its own managed identity. Give that identity the **Foundry User** role on the Foundry account so it can read and invoke the three agents. Run this once, after the first deployment:

```bash
agentPrincipalId=$(az rest --method get --resource https://ai.azure.com \
--url "https://$foundryAccountName.services.ai.azure.com/api/projects/$foundryProjectName/agents/fraud-intelligence-orchestration?api-version=v1" \
--query "versions.latest.instance_identity.principal_id" -o tsv)

az role assignment create --assignee-object-id "$agentPrincipalId" --assignee-principal-type ServicePrincipal \
--role "Foundry User" \
--scope "$(az cognitiveservices account show --name $foundryAccountName --resource-group $rg --query id -o tsv)"
```

Wait one to two minutes for the role to take effect, then start a **new** conversation in the playground. Without the role, the playground returns `424 session_not_ready` because the orchestration cannot read the agents when it starts.

Once the deployment is complete, you can run a test using the **Hosted Agent Playground**:

![Hosted Agent Playground](./images/hosted-agent-playground.png)
Expand Down Expand Up @@ -944,6 +960,7 @@ Add idempotent case identifiers and checkpointing so a transient failure can res

## 🛠️ Troubleshooting

- **The hosted agent returns `424 session_not_ready`:** The orchestration container failed to start. If its logs show `does not have permissions for .../agents/read`, run the role assignment in [Allow the orchestration to call your agents](#allow-the-orchestration-to-call-your-agents), wait two minutes, and start a new conversation.
- **A remote agent cannot be invoked:** Verify the project endpoint, agent name and version, managed identity, and role assignments.
- **A handoff fails validation:** Compare the producing agent's output with the consuming schema and inspect the raw response in the trace.
- **The report changes the decision:** Ensure the report agent receives the assessment as authoritative and has no instruction to reassess it.
Expand Down
Loading