Plugins
Mistral Workflows plugins are standard Python packages that expose reusable workflows, activities, and dependencies under the mistralai.workflows.plugins namespace. Install them with pip and import into your code like any other package.
from mistralai.workflows.plugins.mistralai import mistralai_chat_complete
from mistralai.workflows.plugins.mistralai import Agent, RunnerOfficial Plugins
Mistral AI Plugin
Package: mistralai-workflows-plugins-mistralai
Provides native Mistral AI integration for LLM operations, agent execution, session management, and MCP support within workflows.
Key activities:
| Activity | Description |
|---|---|
mistralai_chat_complete | Single-turn chat completion |
mistralai_chat_stream | Streaming chat completion |
mistralai_chat_parse | Chat completion with structured output parsing |
mistralai_embeddings | Generate text embeddings |
mistralai_ocr | Extract text from images and documents |
mistralai_create_agent | Create a remote agent |
mistralai_update_agent | Update a remote agent |
mistralai_start_conversation | Start an agent conversation |
mistralai_start_conversation_stream | Start an agent conversation with streaming |
mistralai_append_conversation | Add messages to an existing conversation |
mistralai_append_conversation_stream | Add messages to an existing conversation with streaming |
Key components:
| Component | Description |
|---|---|
Agent | Agent definition with model, tools, and configuration |
Runner | Orchestrates agent execution with conversation and tool loops |
LocalSession | Local in-process agent session |
RemoteSession | Remote stateful agent session |
MCPStdioConfig | Configuration for local MCP servers (stdio) |
MCPSSEConfig | Configuration for remote MCP servers (SSE) |
MCPConfig | Union type alias for MCPStdioConfig | MCPSSEConfig |
collect_mcp_tools | Activity: collect tool definitions from one or more MCP servers |
execute_mcp_tool | Activity: execute a named tool on its MCP server |
get_mistral_client | Dependency: returns a configured mistralai.Mistral client with workflow-aware auth, telemetry, and observability metadata |
Example — chat completion:
import mistralai.workflows as workflows
from mistralai.workflows import workflow
from mistralai.workflows.plugins.mistralai import (
ChatCompletionRequest,
UserMessage,
mistralai_chat_complete,
)
from pydantic import BaseModel
class Input(BaseModel):
text: str
@workflow.define(name="summarize")
class SummarizeWorkflow:
@workflow.entrypoint
async def run(self, params: Input) -> str:
request = ChatCompletionRequest(
model="mistral-large-latest",
messages=[UserMessage(content=f"Summarize this text:\n\n{params.text}")],
)
result = await mistralai_chat_complete(request)
return result.choices[0].message.contentFor full documentation on Agent, Runner, sessions, MCP, and multi-agent handoffs, see the Durable Agents guide.
Evaluation Plugin
Package: mistralai-workflows-plugins-evaluations
Runs offline evaluations inside a workflow. Each record runs in its own child workflow, with the task and scorers as parallel activities, and results upload to Studio.
Key components:
| Component | Description |
|---|---|
evaluation.run | Run an evaluation over a dataset |
evaluation.rescore | Score a persisted run again without re-running the task |
evaluation.optimize | Search for better prompts and parameters |
evaluation.task / evaluation.scorer | Decorators that turn a task and its scorers into activities |
For the full guide, see Workflow evaluation plugin.
Installation
Install the plugins you need alongside the main SDK:
pip install mistralai-workflows
pip install mistralai-workflows-plugins-mistralai
pip install mistralai-workflows-plugins-evaluationsCreating Your Own Reusable Libraries
You can create custom packages to share reusable workflows, activities, and dependencies within your organization.
The mistralai.workflows.plugins namespace is reserved for Mistral-supported plugins. For your own reusable code, use your own top-level package name.
Directory structure:
acme-workflows/
├── pyproject.toml
├── acme_workflows/
│ ├── __init__.py
│ ├── activities.py
│ └── workflows.py
└── tests/pyproject.toml:
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
[project]
name = "acme-workflows"
version = "0.1.0"
dependencies = [
"mistralai-workflows>=2.0.0",
]After installing your package, import directly:
from acme_workflows.activities import my_custom_activity
from acme_workflows.workflows import my_rag_pipeline