Structured tool gateway invocation method and system for an ai agent
Patent Information
- Application Number
- CN202610914062.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-06-24
- Publication Date
- 2026-10-27
AI Technical Summary
[0007]有益效果:工具注册标准化——新工具只需按统一Schema注册即可接入,无需修改核心系统代码;用户体验友好——工具调用失败时不会暴露技术错误信息,而是以自然语言降级,用户几乎无感知;成本透明化——用户在工具调用前自然获知资源消耗;调用策略智能化——根据工具成本和依赖关系自动选择最优调用路径。
Abstract
Description
Technical Field
[0001] This invention relates to the field of artificial intelligence interaction technology, specifically to a gateway system method in a large language model-driven AI agent that uses structured tools to describe function calls, failure degradation, and cost awareness. Background Technology
[0002] Existing large language model agents typically use methods such as hard-coded tool calls, direct API calls, or cost-insensitive calls when invoking external tools. These methods have the following drawbacks: inconsistent tool description formats, requiring large-scale modifications to system code when adding new tools; poor user experience when tool calls fail, directly exposing technical error information; users are unaware of resource consumption, easily leading to the negative experience of being secretly charged; and a lack of prioritization strategies for tool calls, resulting in identical calling strategies for expensive and free tools.
[0003] A search revealed that existing technologies primarily focus on the following areas: function call mechanisms in open-source frameworks such as LangChain and AutoGPT provide tool calls at the code level, lacking unified schema management, cost level labeling, and failure degradation chain mechanisms; the OpenAI Function Calling API provides model-side function call interfaces, without addressing unified management, failure degradation, and cost awareness at the tool gateway level. The innovation of this application lies in its three-pronged tool gateway approach: unified schema registration, multi-level degradation chains, and cost awareness, demonstrating novelty and inventiveness. Summary of the Invention
[0004] This invention aims to provide a structured tool gateway invocation method and system for AI intelligent agents. Through a unified tool schema description, a multi-level degradation invocation strategy, and an embedded cost-aware mechanism, it achieves standardization, user-friendliness, and transparency in tool invocation.
[0005] A structured tool gateway invocation method for an AI intelligent agent includes the following steps: Step S1—Structured Tool Registration: The system receives external tool access requests and registers the tool's functional description, input parameter schema, output format schema, invocation cost level, and dependency conditions to the tool gateway according to a preset unified data format. The unified data format includes the following fields: unique tool identifier, tool name, functional description, input parameter definition, output format definition, invocation cost level, dependency conditions, failure fallback chain, and activation status. Step S2—Tool Intent Recognition: The system receives natural language text input by the user, parses it using a large language model to obtain the user's intent, and semantically matches the user intent with the functional descriptions of the registered tools to determine candidate tools and their invocation priorities. Step S3—Cost Estimation and Prompt: The system queries the invocation cost level of each tool based on the candidate tool list. If the total cost exceeds a preset threshold, a prompt is embedded in the dialogue context using natural language expression before the tool is invoked. Step S4—Tool Invocation Execution: The system invokes candidate tools sequentially according to priority. If a tool invocation fails, the system automatically queries the failure fallback chain of that tool and tries alternative solutions sequentially according to a preset priority. Step S5 – Result Processing and Return: The system receives the raw data returned by the tool and converts it into a natural language response that conforms to the current human-like style of the AI agent through a large language model.
[0006] Further technical solutions: The cost estimation and prompting strategy is as follows: free tools do not prompt, low-cost tools embed the statement "I used XX to check" in the reply, and medium-to-high-cost tools add a consumption prompt at the beginning of the reply. The failure degradation chain includes at least four levels: retrying the original tool, calling an equivalent tool, using the system's preset fallback knowledge base, and having a large language model answer based on its own training knowledge with a degradation explanation. Tool intent recognition also includes: generating a list of follow-up questions to guide user confirmation for ambiguous intents, and breaking down complex intents into multiple sub-intents and executing them in order of dependency.
[0007] Beneficial effects: Standardized tool registration – New tools can be integrated simply by registering according to a unified schema, without modifying the core system code; User-friendly experience – Technical error information is not exposed when a tool fails to be called, but rather the error is downgraded in natural language, making it almost imperceptible to the user; Transparent costs – Users are naturally aware of resource consumption before calling a tool; Intelligent calling strategy – The optimal calling path is automatically selected based on tool costs and dependencies.
Claims
1. A structured tool gateway invocation method for AI intelligent agents, characterized in that, Includes the following steps: The system receives tool access requests and registers the tool's function description, input parameter schema, output format schema, call cost level, and failure fallback chain with the tool gateway in a preset unified data format. It also receives natural language text input from users, parses the user's intent using a large language model, and performs semantic matching with the function descriptions of registered tools to determine a candidate tool list. Based on the candidate tool list, it queries the call cost level of each tool. If the total cost exceeds a preset threshold, it provides a prompt in natural language embedded in the dialogue context before the tool is invoked. Candidate tools are invoked in order of priority. If a tool fails to be invoked, the failure fallback chain of that tool is automatically queried, and alternative solutions are tried in order of preset priority. The raw data returned by the tool invocation is received and converted into natural language responses that conform to the current human style of the AI agent through a large language model.
2. The method according to claim 1, characterized in that, The unified data format includes the following fields: tool unique identifier, tool name, function description, input parameter definition, output format definition, call cost level, dependency conditions, failure degradation chain, and activation status.
3. The method according to claim 1, characterized in that, The failure degradation chain includes at least the following degradation levels: retrying the original tool, calling an equivalent tool, using the system's preset fallback knowledge base, and having the large language model answer based on its own training knowledge and provide degradation instructions.
4. The method according to claim 1, characterized in that, The strategy for cost estimation and notification is as follows: free tools will not provide notifications, low-cost tools will have their usage instructions embedded in the response, and medium- to high-cost tools will have a cost notification appended at the beginning of the response.
5. The method according to claim 1, characterized in that, The tool intent recognition also includes: generating a list of follow-up questions to guide user confirmation for ambiguous intents, and breaking down complex intents into multiple sub-intents and executing them in order of dependency.
6. A structured tool gateway invocation system for AI intelligent agents, characterized in that, include: The tool registration module is used to receive and manage tool registration information in a unified data format; The intent parsing module is used to parse the natural language text input by the user through a large language model, identify the user's intent, and match candidate tools; the cost awareness module is used to query the cost level of candidate tools and generate prompt information before invocation. The execution module is used to invoke tools in priority order and automatically execute the degradation strategy according to the failure degradation chain when the invocation fails; the result processing module is used to convert the raw data returned by the tool invocation into natural language responses that conform to the AI agent's human-like style.