Skip to content

MistralModel breaks with mistralai SDK v2.0 (import path change) #1924

@Autopsias

Description

@Autopsias

Description

mistralai v2.0.0 (released 2026-03-11) changed the import path for the Mistral client class:

# v1.x
import mistralai
mistralai.Mistral(...)  # works

# v2.x  
import mistralai
mistralai.Mistral(...)  # AttributeError: module 'mistralai' has no attribute 'Mistral'

# v2.x correct import:
from mistralai.client import Mistral

The strands.models.mistral module uses import mistralai at line 11 and mistralai.Mistral(...) at lines 431, 439, 532, which breaks with v2.0.

Since strands-agents doesn't pin mistralai<2.0, installing/upgrading in a fresh environment pulls v2.0.4 and breaks all Mistral model usage.

Impact

Suggested Fix

Add a compatibility shim in strands/models/mistral.py:

# Support both mistralai v1.x and v2.x import paths
try:
    from mistralai.client import Mistral as MistralClient
except ImportError:
    from mistralai import Mistral as MistralClient

Then replace mistralai.Mistral(...) with MistralClient(...) at lines 431, 439, 532.

Alternatively, pin mistralai>=1.9.11,<2.0 in the [mistral] extra dependencies until a full v2 migration is done.

Reproduction

pip install 'strands-agents[mistral]'
# Pulls mistralai 2.0.4

python -c "from strands.models.mistral import MistralModel; print('OK')"
# Works (import doesn't trigger the error)

# But using the model fails:
python -c "
from strands.models.mistral import MistralModel
import asyncio
m = MistralModel(model_id='mistral-small-latest')
# Any call that triggers stream() or structured_output() will fail with:
# AttributeError: module 'mistralai' has no attribute 'Mistral'
"

Environment

  • strands-agents: 1.19.0
  • mistralai: 2.0.4 (breaks) / 1.12.4 (works)
  • Python: 3.11

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions