Skip to content

Build agents

mistral.rs can run the tool loop for you, expose standard OpenAI tool calls to your client, or act as the local runtime behind an agent app. Unlike a plain OpenAI-compatible model server, mistral.rs can execute tools locally and stream model text, tool progress, files, media, and session state from the same request. Tutorial 5 is the end-to-end walkthrough.

The agent system has three layers:

  • Tool protocol: how a model requests external work.
  • Tool execution: built-in code execution, web search, MCP tools, callbacks, or external dispatch.
  • App runtime: streaming model output, tool progress, files, generated media, and sessions as one local surface.

Learn the basics

Use built-in tools

Build an app runtime

Bring or expose tools

  1. Tool calling basics
  2. Strict tool calling
  3. Enable code execution
  4. Web search
  5. Agentic runtime for apps
  6. Persist agent sessions
  7. Connect to an MCP server
  8. Configure the tool loop
  9. Expose mistralrs as an MCP server

For design rationale (server-side tool loops, session splicing), see the explanation section.