# BEAT IT MuleSoft AI and agents workshop

Original learning material for Developer Level 1, production-focused Developer Level 2, Integration Architect and Application Network Architect practice. Read the expanded AI and Agent-Assisted MuleSoft Delivery course, then apply its controls in the Architect readings.

[Download the complete lab pack](./lab-pack.zip) · [Printable workbook with exercises and worked solutions](./workbook.pdf)

## What you will build

A local Store support assistant simulation that reads an authorized order, retrieves a runbook as untrusted evidence, rejects unauthorized actions, requires an exact approval before creating a synthetic review task, recovers a lost response with one recorded effect, and stops at a whole-run attempt budget.

The planner is scripted. This lab uses no model provider, network connection, Mule runtime, live MCP transport or real business system. It needs no paid AI credits. The in-memory approval and operation ledgers do not survive restarts or establish distributed concurrency safety.

## Choose your level

| Track | Starting point | Evidence to deliver |
| --- | --- | --- |
| Developer 1 | Core concept, tool contract and call direction | Tool schema, valid/invalid calls and safe result projection |
| Developer 2 | Identity, retrieval, approval, recovery and evaluation | Executable local checks, failure matrix and Mule sandbox mapping |
| Integration Architect | Operation boundaries and cross-system delegation | ADR, approval/reconciliation design and provider failure model |
| Application Network Architect | Asset discovery, governance and operating model | Owned inventory, policy boundaries, cost/observability and release gates |

## Local setup

Download these files into one folder. Use Python 3. No dependencies need installation.

- [agent_lab.py](./agent_lab.py)
- [test_agent_lab.py](./test_agent_lab.py)
- [tool-contracts.json](./tool-contracts.json)
- [Full text workbook](./workbook.md)

From that folder run:

```sh
python agent_lab.py --scenario all
python -m unittest -v test_agent_lab.py
```

On systems that use `python3`, substitute it for `python`.

## Expected local results

| Scenario | Expected result |
| --- | --- |
| A/dev reads O-100 | delayed with evidence E-100, no private address |
| A/dev reads B order O-200 | not_available, no record details |
| Model overrides tenant or URL | invalid_arguments |
| Runbook includes restart instruction | text remains evidence, restart tool is forbidden |
| Approved action arguments change | approval_mismatch, no effect |
| Approved write response is lost | operation remains recorded, client must reconcile |
| Same operation and payload repeat | same TASK-1 result, one total effect |
| Six reads proposed with limit four | four returned results, budget_exhausted on fifth, loop stops |

Use the printed solutions after predicting the result yourself. Record observed results separately from expected results. Unit-test success measures the supplied deterministic executor, not LLM quality or deployed Mule behavior.

## Mapping to Mule and MCP

1. Start with an existing authenticated Store API contract or a sandbox mock. Keep business logic behind the same resource authorization.
2. For a custom MCP adapter, select a currently compatible MCP Connector version and transport. Define narrow tool inputs in the installed connector schema. `tool-contracts.json` supplies teaching schemas, not a complete MCP server configuration.
3. Map tool arguments to a Mule validation step, trusted caller context, fixed HTTP/connector operation and safe response projection. Do not let a model select a backend URL, credential or tenant.
4. Bind a real approval workflow and durable operation ledger before enabling writes. Prove restart and concurrent-request behavior with the actual persistence/transaction design.
5. Add MUnit checks for argument validation, forbidden downstream calls, projected outputs, typed errors and operation-key conflicts. Add sandbox integration checks for actual auth, transport, dependency failure and recovery.
6. Connect a real model only through an approved provider with data-handling rules and bounded spend. Evaluate planner behavior and answer support separately from executor enforcement.

No invented Mule XML or Agent Script configuration is presented as a runnable solution. Use the exact installed connector/configuration reference, pin versions and retain actual build/runtime output.

## Current product map

Documentation checked November 3, 2026. Recheck support and organization product access before executing optional platform work.

| Component | Role in this workshop |
| --- | --- |
| MCP Connector | Server exposing a narrow Mule capability, or client invoking external MCP tools |
| Agentforce Connector | Mule integration with a Salesforce agent and its sessions |
| AI Chain | Model, tool and retrieval operations inside a Mule flow |
| Agent Fabric | Discovery and governance of agentic assets, with networks for orchestration |
| A2A | Communication and task delegation between agents |

The checked MCP release notes list 1.7.3 with Mule 4.9.6+ and Java 17. The AI Chain 2.0 overview lists Mule 4.9.0+ and Java 17. The MCP security page restricts SSE server transport to a single replica and recommends Streamable HTTP for multiple replicas. These are dated documentation observations, not a completed compatibility or deployment test.

## Capstone handoff

Submit the tool inventory, identity/data-flow design, local transcript, test output, worked failure explanations, exact-action approval record, reconciliation design, held-out model evaluation plan, cost budget and fallback runbook. Name what you actually ran. Leave unexecuted Mule/MUnit, Agentforce, provider and cloud work labeled pending.

[Open the AI course](/learning-paths/mulesoft-developer?course=mulesoft-ai-agents#sample-lesson)

[Developer and Architect bundles](../learning-stages.md)

Official source links and per-lesson references appear in the full workbook. These are BEAT IT original explanations, exercises and solutions, separate from vendor training handouts and vendor certification.
