DEV Community

Breach Protocol
Breach Protocol

Posted on • Originally published at groundtruth.day

Mistral patented letting the model write the tool call as code

Mistral AI holds a granted United States patent titled "Code implemented tool calls," covering an agent architecture in which a language model writes executable code that wraps its tool calls, rather than emitting a structured request for the harness to dispatch. The patent, US 12,670,045 B1, was filed on March 4, 2026 and granted on June 30, 2026, with 20 claims. It became one of the most argued-about AI stories of the day because the pattern it describes resembles how a growing number of coding agents already work.

Key facts

  • Patent US 12,670,045 B1, "Code implemented tool calls," assigned to Mistral AI, inventor Gabriel Vergnaud.
  • Application 19/557,103, filed March 4, 2026; granted June 30, 2026; 20 claims.
  • Claim 1 covers a specific loop: model writes a code block, server sandboxes it, pauses at a pending tool call, round-trips it to a client, resumes with the result substituted.
  • Primary source: the USPTO Official Gazette entry.

To see why this matters, it helps to know that agents call tools in two quite different ways. The older and more common way is structured function calling: the model outputs something like a form -- a tool name and its arguments -- and the surrounding program reads the form and makes the call. That is the pattern described in our lesson on tool use and function calling, and it is what most APIs expose.

The newer way is to let the model write a program. Instead of one form per call, the model emits a block of code that loops, branches, and calls several tools in sequence, and the harness runs that code. It is the difference between a shopper who asks the clerk for one item at a time and a shopper who hands over a written shopping list with conditional instructions on it. The second is dramatically more efficient when a task needs ten calls, because the model writes the plan once instead of being re-prompted ten times. It is also why the top repository on GitHub recently turned out to run its agent inside a Python shell.

Mistral's Claim 1 is more specific than either description, and the specificity is the whole legal story. It covers a server receiving a user request; a model generating a code block wrapping one or more tool calls; the server executing that code in a sandbox; the execution pausing when a pending tool call appears; the server shipping that pending call to a client for execution; receiving the result back; resuming the code block; substituting the returned value; and returning the final result. That is not "agents that write code." It is a particular distributed arrangement where execution straddles a server and a client, and pauses in the middle.

Whether it reads on existing systems depends on whether they really work that way. If a harness has the model write executable code, runs it in a sandbox, suspends at external calls, ships them across a process or network boundary, and resumes with substituted values, the claim starts to look uncomfortably close. If tool calls execute in the same place the code runs -- which is how many local coding agents work -- the round-trip element is missing. That is an inference from the claim language, not a legal opinion, and prior art arguments look plentiful: sandboxed read-eval-print loops, code interpreters, and serialize-and-resume harnesses all predate the March 2026 filing.

Mistral's own documentation is part of what makes the filing look deliberate rather than novel. Its agent tools documentation already lists a built-in code interpreter, and its human-in-the-loop cookbook documents a stateless, API-friendly flow where deferred tool calls are serialized, shipped across a boundary, and later reconstructed and resumed. The patent reads less like a description of a new user-facing feature and more like drawing a perimeter around mechanics the company already ships.

The tension is with positioning. Mistral's public identity rests on releasing open-weight models -- most recently a safety classifier that takes its policy as a question -- and "we give away the weights" sits awkwardly next to "we own the workflow." The honest caveat is that a granted patent is not an enforcement campaign. Companies file defensively all the time, and there is no public evidence Mistral has asserted this against anyone; no public Mistral statement about the patent could be found. Holding it and using it are different things, and most patents in this industry are held rather than used. But the filing exists, it is granted, and the pattern it targets is spreading fast enough that the question of what Mistral intends is now a reasonable one to ask out loud.


Originally published on Ground Truth, where every claim is checked against the primary source.

Top comments (0)