Skip to main content

Mistral 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:

from mistralai import workflows

await workflows.run_worker([WeatherWorkflow])

Applications can also pass configuration in code. Values provided in code override environment variables; all other values use the environment or SDK defaults. Explicit configuration objects read and validate the environment when they are constructed:

from mistralai import workflows

config = workflows.WorkflowsConfig(
    worker=workflows.WorkerConfig(
        deployment_name=app_config.deployment_name,
        server_url=app_config.mistral_server_url,
    )
)

await workflows.run_worker([WeatherWorkflow], config=config)

Header precedence

Explicit WorkerConfig.mistral_api_headers and mistral_api_header_files values replace the entire mapping inherited from environment variables, dotenv files, or settings secrets; entries are not merged with a mapping supplied in code. Pass {} or None to clear the inherited mapping. Each field is independent: clearing static headers does not clear file-backed headers. The same rule applies to dictionaries passed through WorkflowsConfig(worker={"mistral_api_headers": {}}), including headers inherited through a WORKER JSON setting. When an explicit mapping drops inherited headers, the worker logs a warning that names them, without their values.

When either field is omitted, it keeps the usual settings-source behavior: environment variables take precedence over dotenv files and settings secrets, with dictionary entries merged across sources. A header mapping inherited through WORKER is not an explicit code override and continues to merge with direct header settings. Other nested configuration retains its usual merge behavior.

Process limitations

Within one process:

  • The same workflow type and task queue must use the same configuration.
  • The same workflow type may use a different configuration on another task queue, but its name, sandboxing, and versioning settings must stay the same.
  • While a worker or prepare_workflows() uses a workflow type name, no other workflow class can use it. Once they stop, another class can reuse the name.

License

Apache License 2.0 - see LICENSE for details.

Metadata

Release files for mistralai-workflows 4.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mistralai-workflows 4.0.0
File Size Uploaded Provenance Actions
mistralai_workflows-4.0.0.tar.gz 712.3 kB With provenance Details for mistralai_workflows-4.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for mistralai-workflows 4.0.0
File Interpreter ABI Platform Actions
mistralai_workflows-4.0.0-py3-none-any.whl Python 3 none any Details for mistralai_workflows-4.0.0-py3-none-any.whl

Total release size: 1.2 MB

Release files / mistralai_workflows-4.0.0.tar.gz

Download URL mistralai_workflows-4.0.0.tar.gz
Size 712.3 kB
Tags Source
SHA-256 checksum
How to use checksums
4df33b0ef57e7628a84f650dfabd0011df369596369b9f26929e4a5e2969feb2
BLAKE2b-256 checksum
How to use checksums
929b5de3ab3355545eb78515eee94fd2f69bfd6bbf51cb57684af34810de3bf1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 26, 2026.

Transparency log

Release files / mistralai_workflows-4.0.0-py3-none-any.whl

Download URL mistralai_workflows-4.0.0-py3-none-any.whl
Size 522.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4fef4d9e82d13068e8977cffa0f6f4294b412fc82540420f380d6e6ed6995b80
BLAKE2b-256 checksum
How to use checksums
f94ad18d18a7171d7336ca4010f348e54e82b38dafdba279867b64ffa9c0e83e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 26, 2026.

Transparency log

Security for mistralai-workflows 4.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for mistralai_workflows-4.0.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 26, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

4.0.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page