IP Library Granted Patent US 12670045
Granted Patent B1
US 12670045 · App. 19/557,103 · Granted Jun 30, 2026

Code implemented tool calls

Inventor: Gabriel Vergnaud (Paris, FR)
Assignee: Mistral AI
G06F9/547
View Patent ↗
Loading inventors, assignments & file history…
Monitor This Case
Get email alerts when status or documents change.
Order Certified Copies
Most orders are placed with the USPTO same day — all within 24 business hours.
Order via The Patent Place →
Pre-filled with this patent's details
Quick Facts
Patent No.
US 12670045
App. No.
19/557,103
Granted
Jun 30, 2026
Kind
B1
Abstract

A method may include receiving a user request for execution of one or more tool calls. The method may also include generating a code block in a programming language. The code block may be configured to encapsulate the one or more tool calls. The method may further include executing the code block in a sandbox. The method may also include pausing execution of the code block in response to obtaining a pending tool call. The method may further include transmitting the pending tool call to a client for execution. The method may also include receiving a first result of the pending tool call. The method may further include resuming execution of the code block and substituting the first result of the pending tool call for the pending tool call in the code block. The method may also include returning a second result of the executed code block.

Claims (44)

1 . A method, comprising:

receiving, at a server, a user request for execution of one or more tool calls;

generating, by a large language model (LLM), a code block in a programming language, the code block configured to encapsulate the one or more tool calls;

executing, by the server, the code block in a sandbox;

in response to obtaining a pending tool call, pausing execution of the code block;

transmitting the pending tool call to a client for execution;

receiving, from the client, a first result of the pending tool call;

resuming execution of the code block and substituting the first result of the pending tool call for the pending tool call in the code block; and

returning a second result of the executed code block to the LLM.

2 . The method of claim 1 , wherein at least one tool call of the one or more tool calls is designated for execution by the client.

3 . The method of claim 1 , wherein the sandbox is a resumable code execution sandbox.

4 . The method of claim 1 , wherein resuming the execution of the code block comprises using an evaluation stack that replays the code block from a beginning of the code block.

5 . The method of claim 4 , wherein the evaluation stack ensures deterministic execution by capturing and replaying results of non-deterministic operations.

6 . The method of claim 1 , wherein the LLM receives the second result and does not receive the first result.

7 . The method of claim 1 , wherein:

the code block supports parallel execution and sequential execution of the one or more tool calls;

the parallel execution is achieved using a parallel execution construct; and

the sequential execution is achieved using an await construct.

8 . The method of claim 1 , further comprising translating, by the server, tool definitions associated with the one or more tool calls from a JSON schema into a type definition in the programming language prior to generating the code block by the LLM.

9 . The method of claim 1 , wherein in response to determining an error in the execution of the one or more tool calls, capturing error information and providing the error information to the LLM.

10 . The method of claim 1 , further comprising wrapping non-deterministic operations in the code block with a function configured to store initial values of the non-deterministic operations.

11 . A computing system, comprising:

a processor; and

a memory storing instructions that, when executed by the processor, cause the computing system to:

receive, at a server, a user request for execution of one or more tool calls;

generate, by an LLM, a code block in a programming language, the code block configured to encapsulate the one or more tool calls;

execute, by the server, the code block in a sandbox;

in response to obtaining a pending tool call, pause execution of the code block;

transmit the pending tool call to a client for execution;

receive, from the client, a first result of the pending tool call;

resume execution of the code block and substituting the first result of the pending tool call for the pending tool call in the code block; and

return a second result of the executed code block to the LLM.

12 . The computing system of claim 11 , wherein at least one tool call of the one or more tool calls is designated for execution by the client.

13 . The computing system of claim 11 , wherein the sandbox is a resumable code execution sandbox.

14 . The computing system of claim 11 , wherein resume the execution of the code block comprises use an evaluation stack that replays the code block from a beginning of the code block.

15 . The computing system of claim 14 , wherein the evaluation stack ensures deterministic execution by capturing and replaying results of non-deterministic operations.

16 . The computing system of claim 11 , wherein the LLM receives the second result and does not receive the first result.

17 . The computing system of claim 11 , wherein:

the code block supports parallel execution and sequential execution of the one or more tool calls;

the parallel execution is achieved using a parallel execution construct; and

the sequential execution is achieved using an await construct.

18 . The computing system of claim 11 , wherein the computing system is further operable to translate, by the server, tool definitions associated with the one or more tool calls from a JSON schema into a type definition in the programming language prior to generating the code block by the LLM.

19 . The computing system of claim 11 , wherein in response to determining an error in the execution of the one or more tool calls, capture error information and providing the error information to the LLM.

20 . The computing system of claim 11 , wherein the computing system is further operable to wrap non-deterministic operations in the code block with a function configured to store initial values of the non-deterministic operations.