Mistral Workflows - Build reliable AI workflows with Python
Actively maintained. Last release 4 days ago. A safe choice.
pip install mistralai-workflowsMistral Workflows
Build reliable, production-grade AI workflows with Python.
Overview
Mistral Workflows is a Python SDK for building AI-powered workflows with built-in reliability, observability, and scalability. It provides fault tolerance, durability, and exactly-once execution guarantees.
Features
- Simple Python API: Define workflows using Python decorators
- Built-in Reliability: Automatic retries, timeouts, and error handling
- Distributed Execution: Scale workflows across multiple workers
- LLM Integration: Native support for Mistral AI and other LLM providers
- Observability: Distributed tracing, structured logging, and event streaming
- Type Safety: Full type hints and Pydantic validation
Installation
pip install mistralai-workflows
Quick Start
from mistralai.workflows import workflow, activity
@activity() # timeout and retries go here, e.g. start_to_close_timeout (default 5 minutes)
async def get_weather(city: str) -> str:
# Your activity implementation
return f"Weather in {city}: Sunny"
@workflow.define(name="weather")
class WeatherWorkflow:
@workflow.entrypoint
async def run(self, city: str) -> str:
weather = await get_weather(city)
return weather
The workflow awaits the activity like any coroutine, and the SDK runs it as an activity with the
settings passed to @activity(). To serve the workflow, start a worker with run_worker, as shown
under Worker configuration below.
Documentation
For full documentation, visit docs.mistral.ai/studio/workflows.
Examples
Example projects are in the Mistral cookbook. Each one has a README that covers setup, running the worker and starting the workflow in Studio.
Worker configuration
Importing the SDK and declaring workflows do not read or validate environment settings. Unprepared
workflow definitions use SDK defaults; run_worker or prepare_workflows applies the configured name
prefix, determinism enforcement, and versioning before the worker runs.
By default, run_worker reads configuration from environment variables when it starts: