Mistral Workflows SDK v4: Power-User Guide to Deployments, Identity and Events

Last updated: December 5, 2026

Mistral Workflows SDK v4 is the new major version of Mistral’s Python SDK for durable AI workflows, announced December 3, 2026. It routes workers by deployment name, adds explicit run_as identity, lets you configure workers in code and trims default events. SDK v3 is supported until May 31, 2027.

Contents

What Mistral released

Mistral’s release note says v4 makes the Python Workflows SDK “simpler, safer and faster to run” (Mistral release note). The package is mistralai-workflows. Version 4.0.0 reached PyPI on November 26, 2026, and 4.0.1 followed on December 4, 2026. It is Apache-2.0 licensed and requires Python 3.12 or later, below 3.15 (PyPI).

The five headline changes are:

  • Worker configuration in code, with settings read when the worker starts instead of at import.
  • Explicit execution identity for clients and connectors.
  • Deployment names that workers register with, and that you target when you execute or schedule workflows.
  • Selectable event categories, trading event detail against worker performance.
  • Studio ownership of display names, descriptions and schedules, so code and the UI stop drifting apart.

The release note does not mention pricing or plan changes. If you are new to the platform, start with our Mistral workflow builder guide, which covers building workflows in Vibe and connecting HTTP APIs.

SDK v3 vs. v4 at a glance

The migration guide lists every change that can break a v3 worker (Mistral migration guide). These are the ones most teams will hit:

Area SDK v3 SDK v4
Routing TEMPORAL_TASK_QUEUE / task_queue DEPLOYMENT_NAME required; worker will not start without it
Display name, description Set in @workflow.define Set in AI Studio or with PUT /v1/workflows/{name}
Schedules schedules= argument (deprecated since 3.8.0) Schedules API or AI Studio
Identity use_executor_credentials run_as=RunAs.AUTO (default), EXECUTOR or DEPLOYMENT
Activity events Sent by default Off by default; opt in with EMITTED_EVENT_CATEGORIES
Event route v2 with fallback to v1 v2 only, no fallback
SIGTERM Not handled; drain timeout default 0 Graceful drain; GRACEFUL_SHUTDOWN_TIMEOUT_SECONDS default 25
Telemetry endpoint OTEL_ENDPOINT Per-signal OTEL_TRACES_ENDPOINT, OTEL_METRICS_ENDPOINT, OTEL_LOGS_ENDPOINT
Connector client ToolCallClient ConnectorClient, which adds mcp_client() and http_client()

Calling execute_workflow() outside workflow code also changed. v3 ran the entrypoint inline; v4 raises a WorkflowsException with code child_workflow_outside_workflow and status 400 (Mistral migration guide).

How to upgrade a worker to v4

  1. Check your platform. v4 needs a Workflows API that serves the v2 event route with its token service. Mistral AI Studio supports it; a self-hosted platform without it must stay on v3.
  2. Upgrade to SDK 3.19.0 or a later v3 release first and fix the FutureWarning messages it emits for calls whose behavior changes in v4.
  3. Upgrade the SDK and plugin together with uv add "mistralai-workflows[mistralai]>=4,<5". Remove the webhook extra and allow temporalio>=1.35.0,<1.38.0.
  4. Replace TEMPORAL_TASK_QUEUE with DEPLOYMENT_NAME, and pass deployment_name= when you execute or schedule workflows.
  5. Remove workflow_display_name, workflow_description and schedules= from @workflow.define, then set them in AI Studio or through the API.
  6. Replace use_executor_credentials with an explicit run_as value, and rename ToolCallClient to ConnectorClient.
  7. Deploy, then confirm the worker is connected by calling GET https://api.mistral.ai/v1/workflows/workers/whoami.

The Workers page shows the in-code configuration that v4 introduces (Mistral Workers docs):

config = workflows.WorkflowsConfig(
    worker=workflows.WorkerConfig(
        deployment_name="invoice-service",
    )
)
await workflows.run_worker([MyWorkflow], config=config)

Values set in code take precedence over environment variables. Settings you leave out still come from the environment, a .env file or SDK defaults.

Execution identity with run_as

get_mistral_client(run_as=...) now decides which identity each request uses, and v4 defaults to RunAs.AUTO (Mistral migration guide):

run_as In an on_behalf_of=True workflow In any other workflow Outside a workflow
AUTO Executing user Deployment Raises
EXECUTOR Executing user Raises Raises
DEPLOYMENT Deployment Deployment Deployment

Two rules prevent most surprises. First, do not swap use_executor_credentials=True for AUTO: in a workflow not declared on-behalf-of, AUTO calls as the deployment where the old flag raised. Use EXECUTOR instead. Second, pass run_as=RunAs.DEPLOYMENT at worker startup, in scripts and in test setup, because AUTO raises without a workflow context.

Child workflows now take the on-behalf-of flag from their own declaration rather than their parent. The Workflows API refuses an on-behalf-of child whose parent does not run on behalf of a user, returning a 403.

Events and observability

A v4 worker sends only WORKFLOW and CUSTOM_TASK events. To restore activity events, set EMITTED_EVENT_CATEGORIES=WORKFLOW,CUSTOM_TASK,ACTIVITY. The list must include CUSTOM_TASK or the worker refuses to start (Mistral migration guide).

Cancelled runs now emit WORKFLOW_EXECUTION_CANCELED instead of WORKFLOW_EXECUTION_FAILED. Event publishing failures are no longer swallowed: a client error fails the workflow or activity, while temporary errors such as 5xx, 408 and 429 are retried. Events too large to publish (413) are dropped and logged.

On telemetry, OTEL_REDACTION now covers exported logs as well as spans, with default, strict and none modes. v4 also masks credential values such as MISTRAL_API_KEY in logs, and SDK log events no longer include exception messages or API response bodies.

Practical workflows and settings

  • Containers and Kubernetes: set GRACEFUL_SHUTDOWN_TIMEOUT_SECONDS a few seconds below your SIGTERM-to-SIGKILL delay. Kubernetes allows 30 seconds by default, so the default of 25 fits.
  • Several environments: run one deployment name per environment, such as staging and production, and schedule with deployment_name="production".
  • Testing: start workflows on an in-process worker with create_test_worker and the SDK’s pytest fixtures instead of calling entrypoints directly.
  • Custom Temporal workers: add *get_internal_activities() to your activities list, or workflows fail with an unregistered activity error.
  • Busy workers: leave activity events off in production and turn them on in staging when you need step-level traces.

For agents that run inside these workflows, see our Mistral Managed Agents guide and the Mistral Large 4 guide. If you are comparing durable agent frameworks, our Mastra 1.86 guide covers a TypeScript alternative.

Limitations and gotchas

  • No mixed versions: the resolver rejects SDK v4 with plugin v3 and the reverse.
  • Old schedules keep running: upgrading leaves existing schedules in place, including ones v3 code declared. Delete unwanted ones in AI Studio or with the schedules API. A v3 worker that registers again still replaces its deployment’s declared schedules.
  • No rollback mid-run: once a run has made a manual event publish on v4, keep it on v4 workers until it finishes, because a v3 worker cannot replay it.
  • Bare environment names: payload and storage settings now read only nested names such as TEMPORAL_PAYLOAD_ENCRYPTION__MAIN_KEY.
  • Python only: the release covers the Python SDK; display names from TypeScript SDK workers still arrive in events.

Frequently asked questions

What is new in Mistral Workflows SDK v4?

Workflows SDK v4 lets you configure workers in code, routes work by deployment name, adds explicit execution identity through run_as, lets workers choose which event categories they emit, and moves display names, descriptions and schedules into Mistral AI Studio.

How do I install Mistral Workflows SDK v4?

Run uv add “mistralai-workflows[mistralai]>=4,<5” so the SDK and the Mistral AI plugin share major version 4. The SDK needs Python 3.12 or later, and PyPI lists support below Python 3.15.

How long is Workflows SDK v3 supported?

Mistral says SDK v3 is deprecated and supported until May 31, 2027. It receives fixes and migration help until then, so plan the upgrade before that date.

Why does my v4 worker refuse to start?

The most common cause is a missing deployment name. SDK v4 removes TEMPORAL_TASK_QUEUE and requires DEPLOYMENT_NAME or WorkerConfig(deployment_name=…). A worker also refuses to start if EMITTED_EVENT_CATEGORIES leaves out CUSTOM_TASK.

Where did activity events go after upgrading?

A v4 worker sends only WORKFLOW and CUSTOM_TASK events by default. Set EMITTED_EVENT_CATEGORIES=WORKFLOW,CUSTOM_TASK,ACTIVITY to send activity started, completed, retrying and failed events again.

Sources

Related answers

Leave a Comment