Devstral and Mistral's Code Agents
On this page
Lesson rewritten November 2, 2026. The entire Devstral lineup has been removed from the API: Devstral Small 2 on March 31, 2026, and Devstral 2 on July 31, 2026. Mistral Medium 3.5 serves as the designated replacement (though it is itself deprecated in favor of Mistral Large 4). Open weights remain published, and Mistral still recommends Devstral Small 2 for running Vibe locally. This section of the course (Lessons 5–8) now teaches agentic coding using current models. Sources: Models · Devstral 2 · Using offline models (Vibe).
Completion vs. Agent: Two Different Jobs
If Codestral is the completion specialist, the code agent is its counterpart: a model that doesn’t just complete a line but handles an entire task. Confusing the two is costly in practice. Assigning autocompletion to an agent means paying for unnecessary latency; assigning multi-file refactoring to a completion model means you’re stuck piecing things back together manually.
A bug fix makes this distinction concrete. With Codestral, you identify the faulty file, you place the cursor in the right spot, and the model suggests the correction. With an agent, you describe the symptom: it explores the repository, traces the issue to its root cause, proposes a plan, modifies the relevant files, and writes the accompanying tests. In the first case, the diagnosis is yours; in the second, it’s delegated.
Devstral: The Lineup That Paved the Way
Mistral initially developed specialized models for this role under the Devstral name: Devstral Small 1.0 in May 2025, followed by Devstral Medium 1.0 and Devstral Small 1.1 in July 2025. Then, on December 9, 2025, Devstral 2 and Devstral Small 2 launched alongside the Mistral Vibe command-line tool.
| Devstral 2 | Devstral Small 2 | |
|---|---|---|
| Parameters | 123 billion (dense) | 24 billion |
| Context | 256,000 tokens | 256,000 tokens |
| Weight License | Modified MIT | Apache 2.0 |
| SWE-bench Verified (Mistral announcement) | 72.2% | 68.0% |
| API Removal Date | July 31, 2026 | March 31, 2026 |
These models excelled at using tools to explore repositories, modify multiple files, and drive software engineering agents. Their removal from the API hasn’t erased their weights: they remain downloadable on Hugging Face, and the Vibe documentation still recommends Devstral Small 2 for local use (Lesson 13).
Current API Models for Coding
Agentic coding didn’t disappear with Devstral; it shifted to general-purpose models designed for code as well as other tasks.
| Model | Identifier | Documentation Description | Status |
|---|---|---|---|
| Mistral Medium 3.5 | mistral-medium-3-5 | ”Optimized for agentic use cases and code”; integrated into Vibe Code, recommended in its configuration | Deprecated, removal April 30, 2027 |
| Mistral Small 4 | mistral-small-2603 | Combines instruction, reasoning, and code in a single model | Available (GA) |
| Mistral Large 4 | mistral-large-4-0 | Most capable model in the lineup, one million token context | Public Preview |
| Codestral | codestral-2508 | Low-latency code completion, including FIM | Available (GA) |
Two implications follow. For an agent built on the API, start with Small 4 (GA and cost-effective) and benchmark Large 4 on your hardest tasks. Medium 3.5 remains usable until April 2027, but don’t start a new project on it. For a ready-to-use agent, Vibe Code (the CLI, VS Code extension, or web version) already includes Medium 3.5 and handles the entire agentic loop (Lesson 8).
What a Code Agent Can Do
Tasks chain together within a single mission. First, the agent explores the repository: it traverses the directory tree, opens files, and reconstructs the architecture. Next comes diagnosis: it analyzes logs and traces calls to the root cause rather than just the symptom. Then planning: it proposes a sequence of steps before writing a single line of code. This is your chance to correct it before it makes mistakes across ten files. Implementation follows, with coherent changes spread across multiple files. Finally, verification: it runs tests, reviews its diff, and fixes anything that breaks.
Tools: The Agent’s Key Differentiator
What separates an agent from a generative model is tool calling (function calling). A code agent’s tools are few and standard:
# Typical code agent tools:
# - read_file(path): Read a project file
# - write_file(path, content): Modify a file
# - run_command(cmd): Execute a shell command
# - search_code(query): Search within the repository
With these four primitives, the agent interacts with its environment iteratively: it reads, decides, acts, observes the result, and repeats. A standard generative model produces text and stops, never knowing whether that text compiles. The next lesson builds this loop in Python.
The Impact of Open Weights
Open weights—whether from Devstral, Small 4 (Apache 2.0), or Medium 3.5 (Modified MIT)—have concrete consequences: local hosting keeps your code on your servers; customization lets you adapt a model to your conventions (nothing prohibits it); auditability satisfies requirements for regulated enterprises; and fixed infrastructure costs replace usage-based API billing that scales with your activity. Always verify the exact license for each model before commercial use: they differ from model to model.
Key Takeaways
- Codestral completes code; an agent handles an entire task using tools
- The entire Devstral lineup is removed from the API (Devstral 2 on July 31, 2026), but its weights remain published
- For the API: default to Small 4, benchmark Large 4, and use Medium 3.5 only until its removal in April 2027
- Vibe Code includes Medium 3.5 and provides a turnkey agentic loop
- Devstral Small 2 remains the local model recommended by the Vibe documentation