Skip to content

Mistral

Use Mistral AI models with MistralModel — fast, cost-effective models for chat and tool-calling agents.

For standalone invoke / stream usage, see LLM Models — Mistral.

Install

bash
pip install --extra-index-url https://elsai-agents.elsai.ai/root/ elsai-agents==0.3.1
pip install --extra-index-url https://core-packages.elsai.ai/root/ "elsai-model[mistral]==2.1.0"

Setup

  1. Create a Mistral API key.
  2. Export credentials:
bash
export MISTRAL_API_KEY=...
export MISTRAL_MODEL_NAME=mistral-small-latest

Agent — basic

python
import os
from elsai import Agent
from elsai_model import LLM, Provider

model = LLM(
    provider=Provider.MISTRAL,
    model=os.getenv("MISTRAL_MODEL_NAME", "mistral-small-latest"),
    api_key=os.environ["MISTRAL_API_KEY"],
    temperature=0.2,
    max_tokens=256,
)
agent = Agent(
    model=model,
    system_prompt="You are a concise assistant.",
)
result = agent("Summarize what an AI agent is in two sentences.")
print(result)

Copyright © 2026 elsai foundry.