Tree BG 1
Tree
Tree
TreeLeaves
TreeLeaves
Cat IdleGrassGrassRockRock

Agents Endpoints

Agents API.

Agents Completion

POST /v1/agents/completions

200

Successful Response

created
*integer
id
*string
model
*string
object
*string
usage
*UsageInfo

Playground

Test the endpoints live

import { Mistral } from "@mistralai/mistralai";

const mistral = new Mistral({
  apiKey: "MISTRAL_API_KEY",
});

async function run() {
  const result = await mistral.agents.complete({
    messages: [
      {
        content: "Who is the best French painter? Answer in one short sentence.",
        role: "user",
      },
    ],
    agentId: "<id>",
  });

  console.log(result);
}

run();
from mistralai import Mistral
import os


with Mistral(
    api_key=os.getenv("MISTRAL_API_KEY", ""),
) as mistral:

    res = mistral.agents.complete(messages=[
        {
            "content": "Who is the best French painter? Answer in one short sentence.",
            "role": "user",
        },
    ], agent_id="<id>", stream=False)

    # Handle response
    print(res)

curl https://api.mistral.ai/v1/agents/completions \
 -X POST \
 -H 'Authorization: Bearer YOUR_APIKEY_HERE' \
 -d '{
  "agent_id": "ipsum eiusmod",
  "messages": [
    {
      "content": "consequat do"
    }
  ]
}'

200

{
  "id": "cf79f7daaee244b1a0ae5c7b1444424a",
  "object": "chat.completion",
  "model": "mistral-medium-latest",
  "usage": {
    "prompt_tokens": 24,
    "completion_tokens": 27,
    "total_tokens": 51,
    "prompt_audio_seconds": {},
    "__pydantic_extra__": {}
  },
  "created": 1759500534,
  "choices": [
    {
      "index": 0,
      "message": {
        "content": "Arrr, the scallywag Claude Monet be the finest French painter to ever splash colors on a canvas, savvy?",
        "tool_calls": null,
        "prefix": false,
        "role": "assistant"
      },
      "finish_reason": "stop"
    }
  ]
}