The Patent on Everyone's Pattern: How Mistral Claimed the Agentic Loop
On June 30, 2026, the USPTO granted Mistral AI US Patent 12,670,045 B1 — “Code implemented tool calls.” The patent’s Claim 1 describes a method where an LLM writes a code block encapsulating one or more tool calls, a server executes that block in a sandbox, pauses on “pending” calls that require client-side execution, transmits them to the client, receives results, resumes the code substituting those results, and returns the final output to the model. Filed March 4, 2026, granted in under four months, it covers the architectural pattern that most of the agentic AI ecosystem has already converged on: letting models write executable code — loops, conditionals, intermediate variables — instead of emitting one JSON tool-call object per turn.
That pattern has a name. It’s called CodeAct, and it was described in an ICML 2024 paper (arXiv:2402.01030, Wang et al.) over two years before Mistral’s filing. The paper’s central thesis — use executable code as a unified action space for LLM agents because code natively supports control flow and composability that single-shot structured calls don’t — is Claim 1 restated in academic prose. By the time Mistral filed, Cloudflare had shipped “Code Mode” (September 2025), a production implementation where agents write JavaScript against typed MCP APIs instead of making sequential RPC calls, reducing token usage by up to 81%. Anthropic published “Code Execution with MCP” in November 2025. HuggingFace’s smolagents library implements the same loop. The explainx.ai analysis of the patent identified five independent prior-art sources, and the Hacker News thread surfaced them within minutes. As user rvz put it: “This is just an RPC with JSON being passed around like a messaging system. So we are just vibe patenting rubbish and rebranding it with AI?”
The technical insight behind code-implemented tool calls is genuine and worth understanding independent of the patent dispute. When a model emits one tool call, waits, emits the next, and waits again — the default pattern in OpenAI-style function calling — it burns a model turn and a token budget per call, and the orchestration logic lives in the harness rather than in the model’s own reasoning. Letting the model write the orchestration as code compresses that into fewer, denser turns. A for loop calling the same tool twenty times, an if/else branch that only invokes a second tool when the first result meets a condition, a variable holding an intermediate result across three calls without round-tripping through the model — these are things a JSON object structurally cannot express. The efficiency gains are real. That’s why Cloudflare, Anthropic, and HuggingFace all arrived at the same design independently, driven by the same pressure: as tool counts explode and agent loops deepen, per-turn overhead becomes the bottleneck.
The critical question isn’t whether code-implemented tool calls are useful — they clearly are — but whether a patent claiming this pattern can survive a prior-art challenge. The USPTO granted it in roughly 120 days, which suggests either an exceptionally fast examination or a continuation of an earlier application with a deeper priority chain. Either way, the HN community’s instinct was correct: user maeln noted that “I do fully expect every [lab] to try to fill these kinds of ‘almost for sure invalid and overturnable’ patent [as] a way to defend themselves.” This is the defensive patenting playbook. Mistral, a French company, filed in the US rather than at the European Patent Office because the EPO generally excludes pure software from patentability. The US doesn’t, and the patent’s framing as a “method” involving server, sandbox, client, and pause/resume mechanics is the legal hook that lets software patents survive Alice challenges. Whether it would actually survive inter partes review is an open question nobody has tested yet.
The deeper story is about the agentic AI stack crystallising. When a pattern gets patented, it’s a signal that someone considers it worth owning — which means it’s already infrastructure, not innovation. Code-implemented tool calls are becoming the default way agents interact with tools, and the convergence across Cloudflare, Anthropic, OpenAI, and HuggingFace proves the idea was in the air. Mistral’s patent is less a claim of invention than a land grab on shared ground. The pattern will survive regardless of whether the patent does. But the patent’s existence changes the calculus for every framework shipping CodeAct-style execution: you now operate in a space where a competitor holds a granted US patent on the loop your agent runs every day. That’s not innovation policy. That’s a toll booth on the obvious.
Sources
- US Patent 12,670,045 — Code implemented tool calls (Justia)
- Mistral Patented “Code Implemented Tool Calls” — But Is It New? (explainx.ai)
- Executable Code Actions Elicit Better LLM Agents (arXiv:2402.01030, ICML 2024)
- Code Mode: give agents an entire API in 1,000 tokens (Cloudflare Blog)
- Mistral Patent for “Code implemented tool calls” — Hacker News discussion
- Governed Code Mode: From Tool-Calling to Zero-Trust Execution (VeriStamp)
- The LLM Whisperers: How Cloudflare and Anthropic Cracked the Code on AI Agent Efficiency (iKangai)