mistralM

Docs

Cookbooks

Copy short patterns for Managed Agents: hooks, approvals, session clients, connectors, and agents that work together.

Cookbooks are short programs that each show one pattern you can copy into your own agent. Each one runs as it is, with the Agents SDK and a Mistral API key. Some need more setup, such as a Tavily key stored for the workspace in One shared key for a connector.

Choose a cookbook

Each row names a cookbook and the pattern it shows:

Cookbook

The pattern

Validate structured outputA hook that checks the final answer and makes the agent correct it
Several clients on one sessionLive views of one session that race to answer one approval
One approval policy for every subagentA policy on the lead's session that answers for its subagents
Private data guardA stateful hook that refuses web search once the agent reads private data
One shared key for a connectorA connector that uses one API key stored for the workspace
Stop and answer a turn by idA dependency upgrade in a notebook: a stopped wait, the same turn back from a re-run cell, and the edit approved from another kernel with only its ids
Slack bot: one session per threadA bot that binds each thread's session by id and resumes from a stored cursor after a restart
Stop an agent that repeats itselfA stateful hook that blocks a tool after two calls in a turn, and ends the turn if the model keeps calling it
Live progressA hook that pushes each finished step to a progress bar in your app
Issue triage swarm300 agents, one per open issue, summarize their issues on one message board and flag the duplicates

Run a cookbook

To install the SDK, set your API key, and run a program and its test, follow Run an example. For complete programs that do a real job, see Examples.