Skip to content
This documentation covers the kagent 1.0 alpha. For the latest 0.x release, see the 0.x docs.

For the complete documentation index, see llms.txt. Markdown versions of all docs pages are available by appending .md to any docs URL.

Mistral

Page as Markdown

Configure kagent to use Mistral models by creating a ModelConfig for the Mistral provider.

The Mistral provider calls the Mistral API directly. Mistral speaks the OpenAI-compatible wire protocol, but kagent exposes it as its own provider: Mistral value rather than routing it through the OpenAI provider.

Note

This provider works on the kagent and byo runtimes, but not on codex or claude. For more information, see Agent harness.

Create the ModelConfig

  1. Save your Mistral API key as an environment variable.

    export MISTRAL_API_KEY=<your_api_key>
  2. Create a Kubernetes Secret that stores the API key. Create it in the same namespace as the AgentTemplates that use it, such as kagent.

    kubectl create secret generic kagent-mistral -n kagent --from-literal MISTRAL_API_KEY=$MISTRAL_API_KEY
  3. Create a ModelConfig that references the Secret. Every field in the mistral block is optional, and an empty block is valid.

    kubectl apply -f - <<EOF
    apiVersion: api.kagent.dev/v1alpha3
    kind: ModelConfig
    metadata:
      name: mistral-model-config
      namespace: kagent
    spec:
      apiKeySecret: kagent-mistral
      apiKeySecretKey: MISTRAL_API_KEY
      model: mistral-large-latest
      provider: Mistral
      mistral: {}
    EOF
    FieldDescription
    apiKeySecretThe name of the Kubernetes Secret that stores the API key, in the same namespace as this ModelConfig.
    apiKeySecretKeyThe key within that Secret that holds the API key.
    modelThe model to use. For the available models, see the Mistral model docs.
    providerThe provider to use, Mistral.
    mistralSettings that only the Mistral provider takes. An empty block is valid. A CEL rule rejects a mistral block on any other provider.

Mistral provider settings

The mistral block takes the following optional settings. For every field, including its type, default, and validation rules, see the API reference.

FieldDescription
baseUrlAn alternative Mistral API endpoint. Defaults to https://api.mistral.ai/v1.
temperatureHow much randomness the model applies when it picks the next token, written as a string.
topPThe nucleus sampling cutoff, written as a string.
maxTokensA cap on the tokens generated in one response. Minimum 1.
timeoutHow long to wait on a request to the provider, in seconds. Minimum 1.

Use the ModelConfig

Reference the ModelConfig by name from an AgentTemplate in the same namespace.

spec:
  modelConfig:
    name: mistral-model-config

Next steps