Mistral Patent for "Code implemented tool calls"
摘要
这是一项美国专利(US 12,670,045 B1),由 Mistral AI 的 Gabriel Vergnaud 申请,标题为 “Code implemented tool calls”。专利权利要求 1 描述了一种方法:服务器接收用户执行一个或多个工具调用的请求,由大语言模型(LLM)生成一段编程语言代码块来封装这些工具调用,服务器在沙箱中执行该代码块;当遇到待处理的工具调用时暂停执行,将其发送给客户端执行,接收客户端返回的结果后恢复代码块执行,并将结果替换到代码块中,最后将代码块执行结果返回给 LLM。专利共 20 项权利要求。
荐读理由
Mistral 把工具调用封装成沙箱内可暂停续跑的代码块,客户端执行后回填结果再续跑,这套模式可直接借鉴到你的 agent 编排设计里
原文
| US 12,670,045 B1 | ||
|---|---|---|
| Code implemented tool calls | ||
| ** Gabriel Vergnaud, Paris (FR)** | ||
| Assigned to Mistral AI, Paris (FR) | ||
| Filed by Mistral AI, Paris (FR) | ||
| Filed on Mar. 4, 2026, as Appl. No. 19/557,103. | ||
| **Int. Cl. **G06F 9/54 (2006.01) |
| **CPC **G06F 9/547 (2013.01) | 20 Claims |
|---|

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.
这条对你有帮助吗?