Cookbook examples
Use the Workflows cookbook templates when you want to start with complete examples. Each cookbook demonstrates a different pattern such as human approval, parallel fan-out, or sub-workflows.
After setup, each generated project includes the workflow code, sample data, a worker entrypoint, and helper commands to run the example.
Before you begin
Before you begin
Before running a cookbook, make sure you have:
- A Mistral account.
- Python 3.12 installed.
- uvx available in your shell.
- A Mistral API key for the workspace where you want to run workflows.
You can inspect the execution timeline or complete a human approval step in AI Studio.
Set up a cookbook project
Set up a cookbook project
Run the setup command and select the cookbook template you want to scaffold:
uvx mistralai-workflows-cli setupAfter setup completes, move into the generated project directory and start the examples:
cd my-workflow # or the name of the folder you created
make start-examplesThis registers the cookbook workflows with your workspace and keeps the worker ready to process executions. You can start an execution either from a second terminal with the example command shown under each cookbook, or from AI Studio.
Available cookbooks
Available cookbooks
| Cookbook | What it demonstrates | Main workflow name in AI Studio |
|---|---|---|
| Cargo release | Human approval, sub-workflows, structured outputs | cargo-release-compliance |
| Insurance claims | Parallel activities, retries, deterministic routing | insurance-claims-triage |
| Code modernization | Parallel sub-workflows, syntax validation, human approval | code-modernization |
Cargo release and dangerous goods compliance
Cargo release and dangerous goods compliance
What it does
This cookbook automates cargo release for maritime logistics. It extracts the shipping document, classifies the cargo, runs dangerous goods checks when needed, validates customs compliance, and pauses for a reviewer if an anomaly is detected.
Use this example when you want to understand wait_for_input(), child workflows, and typed LLM outputs in one end-to-end flow.
How to run it
Run the default path with the included sample document:
make execute-cargo-releaseRun the anomaly path to trigger human review:
make execute-cargo-release \
input='{"document_uri":"examples/cargo_release/sample_data/shipping_doc_anomaly.png","shipment_id":"BL-2024-RTD-004812"}'You can also start cargo-release-compliance in AI Studio with this input:
{
"document_uri": "examples/cargo_release/sample_data/shipping_doc_anomaly.png",
"shipment_id": "BL-2024-HAM-009371"
}What to look for
In AI Studio, inspect the child workflow for dangerous goods validation, then find the wait_for_input event on the anomaly path. Approve or block the shipment and confirm that the parent workflow resumes from the approval step instead of replaying the earlier activities.
Insurance claims triage with vision
Insurance claims triage with vision
What it does
This cookbook triages an insurance claim from text and photo inputs. It analyzes claim photos in parallel, checks the written description for inconsistencies, assigns a deterministic severity, scores fraud risk, and returns a structured triage report.
Use this example when you want to see how a workflow can combine parallel activity execution with deterministic routing and typed outputs.
How to run it
Run the default workflow:
make execute-insurance-claimsYou can provide your own input:
make execute-insurance-claims input='{"claim_id":"CLM-001","claimant_name":"Jane","description":"My car was hit.","photos":["examples/insurance_claims/sample_data/photos/claim_low_scratch_door.jpg"]}'Or start the workflow in AI Studio with this input:
{
"claim_id": "CLM-2024-001",
"claimant_name": "Maria Gonzalez",
"description": "My car was T-boned at an intersection.",
"photos": [
"examples/insurance_claims/sample_data/photos/claim_high_totaled_front.jpg",
"examples/insurance_claims/sample_data/photos/claim_high_totaled_side.jpg"
]
}What to look for
In AI Studio, confirm that the analyze_photo activities start in parallel, then inspect the consistency check, fraud scoring, and final typed report. The routing decision comes from workflow code, not from a separate model call.
Code modernization assistant
Code modernization assistant
What it does
This cookbook modernizes a legacy Python codebase file by file. The parent workflow scans the repository, dispatches one child workflow per file, validates generated code in a subprocess, aggregates the results into a change set, and pauses for human review before producing a PR proposal.
Use this example when you want to learn how to combine sub-workflow fan-out with durable human approval.
How to run it
Run the default workflow:
make execute-code-modernizationYou can also start code-modernization in AI Studio with this input:
{
"repo_path": "examples/code_modernization/sample_data/legacy_repo",
"target": "Python 2.7 → 3.12"
}What to look for
In AI Studio, confirm that each source file appears as its own child execution. After the child workflows finish, inspect the wait_for_input pause, approve or decline the change set, and verify that the workflow only writes the PR proposal after approval.
Next steps
Next steps
After you're comfortable with a cookbook template, open the generated workflow files in src/workflows/ and adapt the activities, input models, and execution paths to your own use case.
For the SDK concepts behind these examples, continue with Core Concepts - Workflows and Building workflows.