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.
Choose a path
Section titled “Choose a path”Learn the basics
- Tool calling basics: OpenAI tool calls and the mistral.rs server-side loop.
- Strict tool calling: constrain tool arguments to the declared JSON Schema.
Use built-in tools
- Enable code execution: Python execution, file outputs, media capture, and sandbox isolation.
- Web search: built-in search, extraction, and embedding reranking.
Build an app runtime
- Agentic runtime for apps: streaming model output, tool progress, files, generated media, and sessions.
- Persist agent sessions: state across HTTP requests.
Bring or expose tools
- Connect to an MCP server: use external MCP tools.
- Configure the tool loop: round caps and dispatch URLs.
- Expose mistralrs as an MCP server: let other agents call your models.
Recommended order
Section titled “Recommended order”- Tool calling basics
- Strict tool calling
- Enable code execution
- Web search
- Agentic runtime for apps
- Persist agent sessions
- Connect to an MCP server
- Configure the tool loop
- Expose mistralrs as an MCP server
For design rationale (server-side tool loops, session splicing), see the explanation section.