Skip to content

Commit d00821d

Browse files
grebettgithub-actions[bot]
authored andcommitted
chore: sync docs to v1.3.1
1 parent 506076b commit d00821d

6 files changed

Lines changed: 144 additions & 50 deletions

File tree

cookbooks.config.json

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2479,18 +2479,39 @@
24792479
"displayDate": true
24802480
},
24812481
{
2482-
"path": "mistral/connectors/01-connectors-management.md",
2482+
"path": "mistral/connectors/database-advisor-agent/01-connectors-management.md",
24832483
"labels": {
24842484
"integrations": [],
24852485
"useCases": [
2486-
"Connectors"
2486+
"Connectors",
2487+
"Agents"
2488+
]
2489+
},
2490+
"availableInDocs": {
2491+
"page": true,
2492+
"displayed": true
2493+
},
2494+
"title": "Build a Database Advisor Agent with the DeepWiki Connector (TypeScript)",
2495+
"mainSection": {
2496+
"featured": "False",
2497+
"latest": "True"
2498+
},
2499+
"displayDate": true
2500+
},
2501+
{
2502+
"path": "mistral/connectors/01-build-a-database-advisor-agent.ipynb",
2503+
"labels": {
2504+
"integrations": [],
2505+
"useCases": [
2506+
"Connectors",
2507+
"Agents"
24872508
]
24882509
},
24892510
"availableInDocs": {
24902511
"page": true,
24912512
"displayed": true
24922513
},
2493-
"title": "Connectors Management",
2514+
"title": "Build a Database Advisor Agent with the DeepWiki Connector (Python)",
24942515
"mainSection": {
24952516
"featured": "False",
24962517
"latest": "True"

public/studio-api/workflows/building-workflows/durable_agents.md

Lines changed: 47 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
---
22
id: durable-agents
3-
title: Durable Agents
3+
title: Durable agents
44
sidebar_position: 6
55
---
66

7-
# Durable Agents
7+
# Durable agents
88

9-
A Durable Agent is an LLM agent whose loop (model calls, tool use, handoffs) runs **inside a workflow**, so its state survives crashes and restarts. The Mistral plugin (`mistralai-workflows[mistralai]`) provides the primitives `Agent`, `Runner`, `RemoteSession`, and `LocalSession` (experimental) — for building them.
9+
A durable agent is an LLM agent whose loop (model calls, tool use, and handoffs) runs **inside a workflow**, so its state survives crashes and restarts. The Mistral plugin (`mistralai-workflows[mistralai]`) provides the primitives for building them: `Agent`, `Runner`, `RemoteSession`, and `LocalSession` (experimental).
1010

1111
What you get on top of a regular agent loop:
1212

1313
- **Durability**: agent state is preserved across worker crashes and restarts
1414
- **Tool integration**: workflow activities can be passed directly as agent tools
1515
- **Multi-agent handoffs**: agents can delegate tasks to specialized agents
16-
- **MCP support**: connect to external tools via the Model Context Protocol (stdio / SSE)
16+
- **MCP support**: connect to external tools with the Model Context Protocol (stdio or SSE)
1717

1818
<SectionTab as="h1" sectionId="installation">Installation</SectionTab>
1919

@@ -23,11 +23,11 @@ To use Durable Agents, install the Mistral plugin:
2323
uv add 'mistralai-workflows[mistralai]'
2424
```
2525

26-
<SectionTab as="h1" sectionId="core-components">Core Components</SectionTab>
26+
<SectionTab as="h1" sectionId="core-components">Core components</SectionTab>
2727

2828
<SectionTab as="h2" variant="secondary" sectionId="agent">Agent</SectionTab>
2929

30-
The `Agent` class defines an LLM agent with its model, instructions, tools and handoffs:
30+
The `Agent` class defines an LLM agent with its model, instructions, tools, and handoffs:
3131

3232
<Tabs>
3333
<TabItem value="python" label="Python">
@@ -77,7 +77,7 @@ The returned `outputs` is a list of output items produced by the agent during th
7777

7878
Sessions manage agent state and API communication. Two session types are available:
7979

80-
| Session | Use Case | Backend |
80+
| Session | Use case | Backend |
8181
| --------------- | -------------------------- | --------------------- |
8282
| `RemoteSession` | Production (recommended) | Mistral Agents SDK |
8383
| `LocalSession` | Experimental / On-premises | Direct completion API |
@@ -137,7 +137,7 @@ class FinanceAgentWorkflow:
137137
</TabItem>
138138
</Tabs>
139139

140-
<SectionTab as="h1" sectionId="multi-agent-handoffs">Multi-Agent Handoffs</SectionTab>
140+
<SectionTab as="h1" sectionId="multi-agent-handoffs">Multi-agent handoffs</SectionTab>
141141

142142
Agents can delegate tasks to specialized agents using handoffs. The coordinator agent's `instructions` and the specialized agents' `description` fields guide handoff decisions; the model decides when to hand off based on the user query and the available specialists' descriptions. The system automatically manages the handoff conversation.
143143

@@ -177,11 +177,11 @@ outputs = await workflows_mistralai.Runner.run(
177177

178178
When the finance agent receives a query about ECB interest rates, it can automatically hand off to the specialized `interest_rate_agent`.
179179

180-
<SectionTab as="h1" sectionId="mcp-integration">MCP Integration</SectionTab>
180+
<SectionTab as="h1" sectionId="mcp-integration">MCP integration</SectionTab>
181181

182182
Connect to external tool servers using the Model Context Protocol. Two transport types are supported:
183183

184-
<SectionTab as="h2" variant="secondary" sectionId="stdio-mcp-server">Stdio MCP Server</SectionTab>
184+
<SectionTab as="h2" variant="secondary" sectionId="stdio-mcp-server">Stdio MCP server</SectionTab>
185185

186186
For local command-line MCP servers:
187187

@@ -209,7 +209,32 @@ agent = workflows_mistralai.Agent(
209209
</TabItem>
210210
</Tabs>
211211

212-
<SectionTab as="h2" variant="secondary" sectionId="sse-mcp-server">SSE MCP Server</SectionTab>
212+
**Forwarding credentials to a stdio server**
213+
214+
Some stdio MCP servers need credentials, such as a bot token, to authenticate. Use `env_mapping` to pass them from the worker's environment into the subprocess. Each mapping entry pairs the subprocess variable name with the worker variable name:
215+
216+
<Tabs>
217+
<TabItem value="python" label="Python">
218+
219+
```python
220+
from mistralai.workflows.plugins.mistralai import MCPStdioConfig
221+
222+
mcp_config = MCPStdioConfig(
223+
command="npx",
224+
args=["-y", "@notionhq/notion-mcp-server"],
225+
name="notion",
226+
env_mapping={"NOTION_TOKEN": "NOTION_TOKEN_BOT_A"},
227+
)
228+
```
229+
230+
</TabItem>
231+
</Tabs>
232+
233+
Use a mapping instead of raw values because activity inputs are persisted to the workflow's [event history](/studio-api/workflows/getting-started/core_concepts/events). Loading secrets from the worker's environment and passing them directly would expose them there.
234+
235+
With `env_mapping`, only the variable names are serialized. The activity reads the secret values from the worker's environment, and the values never leave the worker. A mapping also lets you run several instances of the same server with different credentials on one worker. If a declared worker variable is missing from the environment, the activity fails fast.
236+
237+
<SectionTab as="h2" variant="secondary" sectionId="sse-mcp-server">SSE MCP server</SectionTab>
213238

214239
For remote MCP servers over Server-Sent Events:
215240

@@ -237,7 +262,7 @@ agent = workflows_mistralai.Agent(
237262
</TabItem>
238263
</Tabs>
239264

240-
<SectionTab as="h1" sectionId="built-in-tools">Built-in Tools</SectionTab>
265+
<SectionTab as="h1" sectionId="built-in-tools">Built-in tools</SectionTab>
241266

242267
Use Mistral's built-in tools alongside activities:
243268

@@ -276,9 +301,9 @@ These tools are executed server-side by the Mistral platform; they do not run in
276301
**Built-in tools require RemoteSession**: `LocalSession` silently drops built-in tools (logs a warning and proceeds without them). Use `RemoteSession` for any agent that relies on `WebSearchTool`, `CodeInterpreterTool`, `ImageGenerationTool`, or `DocumentLibraryTool`.
277302
:::
278303

279-
<SectionTab as="h1" sectionId="session-types">Session Types</SectionTab>
304+
<SectionTab as="h1" sectionId="session-types">Session types</SectionTab>
280305

281-
<SectionTab as="h2" variant="secondary" sectionId="remote-session">RemoteSession (Recommended)</SectionTab>
306+
<SectionTab as="h2" variant="secondary" sectionId="remote-session">RemoteSession (recommended)</SectionTab>
282307

283308
Uses the Mistral Agents SDK for production workloads:
284309

@@ -308,12 +333,12 @@ Features:
308333
- Managed conversation state
309334
- Production-ready
310335

311-
<SectionTab as="h3" variant="secondary" sectionId="agent-lifecycle">Agent Lifecycle</SectionTab>
336+
<SectionTab as="h3" variant="secondary" sectionId="agent-lifecycle">Agent lifecycle</SectionTab>
312337

313338
When a `RemoteSession` initializes a conversation, it iterates over every agent in the handoff graph and either creates or updates it via the Agents API:
314339

315-
- **`Agent(id=None)`**a new remote agent is created via `beta.agents.create()`. The returned ID is stored back on the `Agent` object, so subsequent runs with the **same instance** will reuse it.
316-
- **`Agent(id="existing-id")`**the existing remote agent is updated via `beta.agents.update()`. No new agent is created.
340+
- **`Agent(id=None)`**: a new remote agent is created with `beta.agents.create()`. The returned ID is stored back on the `Agent` object, so subsequent runs with the **same instance** reuse it.
341+
- **`Agent(id="existing-id")`**: the existing remote agent is updated with `beta.agents.update()`. No new agent is created.
317342

318343
To reuse a pre-existing agent across workflow executions, set `agent.id` before calling `Runner.run()`:
319344

@@ -337,7 +362,7 @@ agent = workflows_mistralai.Agent(
337362
Agents created by `RemoteSession` are **not cleaned up automatically** after a run completes. If you create agents dynamically (without setting `id`), a new remote agent will be created on every workflow execution.
338363
:::
339364

340-
<SectionTab as="h2" variant="secondary" sectionId="local-session">LocalSession (Experimental)</SectionTab>
365+
<SectionTab as="h2" variant="secondary" sectionId="local-session">LocalSession (experimental)</SectionTab>
341366

342367
Runs agents locally using the completion endpoint:
343368

@@ -367,12 +392,12 @@ Use cases:
367392
- Full context control
368393

369394
:::warning
370-
`LocalSession` is experimental and may be removed in future versions. Use `RemoteSession` for production workloads.
395+
`LocalSession` is experimental and might be removed in a later version. Use `RemoteSession` for production workloads.
371396
:::
372397

373-
<SectionTab as="h1" sectionId="complete-workflow-example">Complete Workflow Example</SectionTab>
398+
<SectionTab as="h1" sectionId="complete-workflow-example">Complete workflow example</SectionTab>
374399

375-
A full example combining activities, handoffs and workflow orchestration:
400+
A full example combining activities, handoffs, and workflow orchestration:
376401

377402
<Tabs>
378403
<TabItem value="python" label="Python">
@@ -453,5 +478,5 @@ Agent activity emits the same workflow and activity events as any other workflow
453478
<SectionTab as="h1" sectionId="best-practices">Best practices</SectionTab>
454479

455480
1. **Use `RemoteSession` for production** so the agent runs against the Agents API rather than the raw completion endpoint.
456-
2. **Set `agent.id`** on agents you want to reuse across runs, otherwise `RemoteSession` creates a new remote agent on every execution and never cleans them up.
481+
2. **Set `agent.id`** on agents you want to reuse across runs. Otherwise, `RemoteSession` creates a new remote agent on every execution and never cleans them up.
457482
3. **Wrap tool side-effects in activities** so they get retry isolation and appear in the execution history.

0 commit comments

Comments
 (0)