Search or ask Docker

Mistral

Use Mistral AI models with Docker Agent.

View Markdown

Use Mistral AI models with Docker Agent.

Overview

Mistral AI provides powerful language models through an OpenAI-compatible API. Docker Agent includes built-in support for Mistral as an alias provider.

Setup

  1. Get an API key from Mistral Console

  2. Set the environment variable:

    export MISTRAL_API_KEY=your-api-key

Usage

Inline Syntax

The simplest way to use Mistral:

agents:
  root:
    model: mistral/mistral-large-latest
    description: Assistant using Mistral
    instruction: You are a helpful assistant.

Named Model

For more control over parameters:

models:
  mistral:
    provider: mistral
    model: mistral-large-latest
    temperature: 0.7
    max_tokens: 8192

agents:
  root:
    model: mistral
    description: Assistant using Mistral
    instruction: You are a helpful assistant.

Available Models

ModelDescriptionContext
mistral-large-latestMost capable Mistral model128K
mistral-medium-latestBalanced performance and cost128K
mistral-small-latestFast and cost-effective (default)128K
codestral-latestOptimized for code generation32K
open-mistral-nemoOpen-weight model128K
ministral-8b-latestCompact 8B parameter model128K
ministral-3b-latestSmallest Mistral model128K

Check the Mistral Models documentation for the latest available models.

Auto-Detection

When you run docker agent run without specifying a config and no project-level docker-agent.yaml, docker-agent.yml, or docker-agent.hcl exists, Docker Agent automatically detects available providers. If MISTRAL_API_KEY is set and higher-priority providers (OpenAI, Anthropic, Google) are not available, Mistral will be used with mistral-small-latest as the default model.

Extended Thinking

Docker Agent's thinking_budget field is not applied to Mistral models: the underlying OpenAI-compatible client only sends reasoning_effort for OpenAI reasoning model names (o-series, gpt-5). Setting thinking_budget on a Mistral model passes config validation but has no effect on the request.

Mistral reasoning models (e.g. magistral) reason on their own without configuration. For non-reasoning models, use the think tool instead.

How It Works

Mistral is implemented as a built-in alias in Docker Agent:

  • API Type: OpenAI-compatible (openai_chatcompletions)
  • Base URL: https://api.mistral.ai/v1
  • Token Variable: MISTRAL_API_KEY

This means Mistral uses the same client as OpenAI, making it fully compatible with all OpenAI features supported by Docker Agent.

Example: Code Assistant

agents:
  coder:
    model: mistral/codestral-latest
    description: Expert code assistant
    instruction: |
      You are an expert programmer using Codestral.
      Write clean, efficient, well-documented code.
      Explain your reasoning when helpful.
    toolsets:
      - type: filesystem
      - type: shell
      - type: think