Agent construction method and computer program product
By constructing a knowledge graph based on tool call sequence data and fine-tuning a large language model, the problems of high cost, long cycle, and knowledge confusion in intelligent agent model fine-tuning in complex enterprise-level business scenarios are solved. This enables a low-cost, fast-adapting intelligent agent system that improves response speed and accuracy.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- CHINA MOBILE ONLINE SERVICES CO LTD
- Filing Date
- 2026-02-13
- Publication Date
- 2026-06-05
AI Technical Summary
In existing technologies, intelligent agents based on large language models suffer from high model fine-tuning costs and long cycles in complex enterprise-level business scenarios, making it difficult to cope with business changes. The prompt word engineering is unstable and difficult to maintain complex business processes. RAG is prone to knowledge confusion and insufficient accuracy in complex enterprise-level scenarios.
By acquiring tool call sequence data from historical behavior data, tool entity vectors are constructed, and a knowledge graph is built based on preset business processes. The target business process entity is found in the knowledge graph using a preset large language model, realizing the visualization and structuring of business knowledge. The large language model is fine-tuned using tool call sequence data to shorten the model adjustment cycle.
It has achieved a low-cost, rapidly adaptable intelligent agent system that simplifies task processing, reduces computational and resource overhead, improves response speed and efficiency, and ensures the accuracy and flexibility of intelligent agents in reasoning in complex scenarios.
Smart Images

Figure CN122154735A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of artificial intelligence, and in particular to a method for constructing an intelligent agent and a computer program product. Background Technology
[0002] With the development of Large Language Model (LLM) intelligent reasoning capabilities, unlike the traditional approach of encoding business process logic in complex scenarios, LLMs exhibit human-like reasoning and planning abilities, thus demonstrating more intelligent and clear logical capabilities in complex scenarios. An intelligent agent refers to an intelligent entity built upon a large language model. It integrates powerful language understanding and processing capabilities, and through mechanisms such as task planning, decision-making, and execution, it achieves autonomous completion of complex tasks, automating various complex tasks.
[0003] Among related technologies, LLM-based agent technology mainly relies on three technical paths when dealing with complex enterprise-level business scenarios: model fine-tuning, prompt word engineering, and retrieval-augmented generation (RAG). However, model fine-tuning is costly and time-consuming, making it difficult to cope with business changes. Prompt word engineering is unstable and difficult to maintain complex business processes. RAG is prone to knowledge confusion and lacks accuracy in complex enterprise-level scenarios. These defects restrict the large-scale and agile deployment of intelligent agents. Summary of the Invention
[0004] This application provides an agent construction method and computer program product to at least solve the problems of high cost and long cycle of agent model fine-tuning in related technologies, which makes it difficult to cope with business changes.
[0005] In a first aspect, embodiments of this application provide a method for constructing an intelligent agent, including: Retrieve tool call sequence data from historical behavior data; The tool call sequence data is fused to obtain the tool entity vector; Based on the preset business process and the tool entity vector, a knowledge graph is constructed, and the nodes in the knowledge graph represent business process entities. In response to the target business process, the system uses a preset large language model to find the target business process entity corresponding to the target business process in the knowledge graph, and outputs the target business process corresponding to the target business process. The preset large language model is a model obtained by fine-tuning based on the tool call sequence data.
[0006] In a second aspect, embodiments of this application provide an electronic device, including a processor, a memory, and a program or instructions stored in the memory and executable on the processor, wherein the program or instructions, when executed by the processor, implement the steps of the method described in the first aspect.
[0007] Thirdly, embodiments of this application provide a computer program product, the computer program product including a computer program stored on a non-transitory computer-readable storage medium, the computer program including program instructions, which, when executed by a computer, implement the steps of the method described in the first aspect.
[0008] In this embodiment, tool call sequence data is first acquired from historical behavior data. Then, the tool call sequence data is fused to obtain tool entity vectors. Next, a knowledge graph is constructed based on a preset business process and the tool entity vectors. Nodes in the knowledge graph represent business process entities. Finally, in response to the target business process, a preset large language model is used to search for the target business process entity corresponding to the target business process in the knowledge graph, and the corresponding target business process is output. The preset large language model is a model fine-tuned based on the tool call sequence data. This embodiment utilizes tool call sequence data from user historical behavior data to construct a knowledge graph, achieving visualized and structured business knowledge. Business changes can be addressed by modifying the knowledge graph, and the large language model can be fine-tuned using the tool call sequence data, enabling it to accurately identify user intent and obtain prompts (i.e., target business process entities) with fewer parameter adjustments, greatly shortening the model adjustment cycle. Attached Figure Description
[0009] The accompanying drawings, which are included to provide a further understanding of this application and form part of this application, illustrate exemplary embodiments and are used to explain this application, but do not constitute an undue limitation of this application. In the drawings: Figure 1 This is a flowchart of the intelligent agent construction method provided in the embodiments of this application; Figure 2 This is a schematic diagram of the intelligent agent construction device provided in the embodiments of this application; Figure 3 This is a schematic diagram of the structure of the electronic device provided in the embodiments of this application. Detailed Implementation
[0010] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0011] The terms "first," "second," etc., used in the specification and claims of this application are used to distinguish similar objects and not to describe a specific order or sequence. It should be understood that such use of data can be interchanged where appropriate so that embodiments of this application can be implemented in orders other than those illustrated or described herein. Furthermore, in the specification and claims, "and / or" indicates at least one of the connected objects, and the character " / " generally indicates that the preceding and following objects are in an "or" relationship.
[0012] With the development of LLM intelligent reasoning capabilities, unlike the traditional approach of encoding business process logic in complex scenarios, large-scale models exhibit human-like reasoning and planning abilities, thus demonstrating more intelligent and clear logical capabilities in complex scenarios. Typically, the reasoning ability of large-scale models relies primarily on the reasoning skills accumulated during model training. Model pre-training and fine-tuning require a large amount of high-quality and diverse data to enable the large-scale model to possess relevant knowledge for reasoning. For example, regarding the generalization ability of L0-layer models, if subsequent vertical domain data is provided for L1 or L2 layer optimization and fine-tuning, the large-scale model's knowledge scope will be updated and adjusted according to the vertical domain data. During the reasoning process, it demonstrates knowledge accumulation in that domain and can provide logical planning and reasoning capabilities for corresponding problems.
[0013] An Agent is an intelligent entity built upon a large-scale language model. It integrates powerful language understanding and processing capabilities, and through mechanisms such as task planning, decision-making, and execution, it autonomously completes complex tasks, automating various intricate processes. When handling relatively complex tasks, the Agent primarily relies on the knowledge reasoning capabilities of the large model. The large model analyzes and reasons about the task, breaking it down into corresponding planning steps. Then, the large model invokes tools according to these planning steps, ultimately aggregating the output data from all steps. Finally, the large model analyzes and processes all the acquired data to obtain a comprehensive output result for the complex task. If the model exhibits unsatisfactory reasoning and planning, or if business processes are adjusted, the model typically needs to undergo data cleaning and preparation, as well as subsequent training and optimization. After optimization and training, the model is deployed and reasoned, and finally, the online effect is verified. If the effect is unsatisfactory, data supplementation is required before starting a new cycle.
[0014] Currently, when dealing with complex enterprise-level business scenarios, intelligent agent technology based on large language models mainly relies on three technical paths: model fine-tuning, prompt word engineering, and RAG. However, these methods all have significant limitations, which restrict the large-scale and agile deployment of intelligent agents.
[0015] Among these challenges, model fine-tuning is costly and time-consuming, making it difficult to respond quickly to business changes. This approach requires preparing large amounts of high-quality training data for each vertical domain and investing significant computing resources in model training and iteration, resulting in a cumbersome and time-consuming process. When business rules or processes undergo minor changes, a new round of data preparation, training, and deployment often needs to be initiated, failing to respond quickly to business needs.
[0016] The tooltip engineering approach is unstable and fragile, making it difficult to maintain complex business processes. This method heavily relies on the capabilities of the underlying model and cannot inject new knowledge into it. For complex, long-flow business processes, extremely lengthy and detailed tooltips are required to constrain the model's planning path. Tooltip writing is labor-intensive and resembles "software programming," demanding high skill from designers. Any minor adjustment to the business logic can cause the entire tooltip to fail, requiring extensive re-debugging and resulting in poor maintainability.
[0017] In complex enterprise-level scenarios, Relational Acyclic Graphs (RAGs) are prone to knowledge confusion and insufficient accuracy. While RAGs enhance model reasoning by retrieving external knowledge fragments, in real-world enterprise environments, business knowledge boundaries overlap, is highly specialized, and has complex relationships. Simple semantic similarity retrieval can easily return irrelevant or conflicting knowledge fragments, misleading the model's judgment and leading to planning and reasoning errors. This application aims to address how to ensure that the knowledge injected into the agent is accurate, structurally clear, and consistent with business logic, avoiding confusion between knowledge fragments and improving the agent's reasoning accuracy in specialized domains.
[0018] Therefore, this application provides a method for constructing intelligent agents to solve the problems of high development costs, slow response speed, difficulty in maintaining business processes, and inaccurate knowledge injection in related technologies, and ultimately realize an intelligent agent system with programmable and scene-aware capabilities that can adapt to business changes at low cost and quickly.
[0019] The following is in conjunction with the appendix Figures 1 to 3 The present application provides a detailed description of an intelligent agent construction method and computer program product through specific embodiments and application scenarios.
[0020] Figure 1 This is a flowchart illustrating a method for constructing an intelligent agent, as provided in an embodiment of this application. Figure 1 As shown, the intelligent agent construction method may include the contents shown in S101 to S104.
[0021] In S101, tool call sequence data is retrieved from historical behavior data.
[0022] Among them, historical behavior data can be users' historical behavior data. For the data involving personal information, the informed consent procedure has been strictly followed. Personally identifiable information has been removed through de-identification processing (including but not limited to field masking, feature anonymization, and differential privacy technology application). For data in sensitive fields (such as medical, financial, etc.), a privacy computing module (including federated learning and secure multi-party computation technology) is used to make the data "usable but not visible" to avoid compliance risks in the original data transmission process and ensure that the data application scenarios and uses comply with public order and good morals and industry regulatory requirements.
[0023] In user history behavior data, the original tool call sequence refers to the sequence of calls to specific functions, application programming interfaces (APIs), or system components recorded in chronological order when a user uses digital products or services.
[0024] In one instance, the source of raw tool call sequence data in user history behavior can be divided into two parts: natural behavior tool call sequence and artificial intelligence (AI) assistant tool call sequence.
[0025] Among them, the natural behavior tool call sequence refers to the sequence of tool calls generated by the user's actions when the user accesses the application and conducts business according to their natural will. This sequence data is recorded by the system through standard tools encapsulated in the backend, forming the sequence data of the tool entity in the natural interaction scenario. The AI assistant tool call sequence refers to the sequence of tool calls involved in completing a specific need after the user accesses the AI intelligent assistant. This sequence data is also recorded by the system to form the sequence data of the tool entity.
[0026] The two data sets mentioned above are not distinguished during data preprocessing and are fully integrated. The core purpose of this data integration is to provide more comprehensive tool entity sequence data support for the tool entity network: First, the natural behavior tool call sequence can supplement the coverage of tool entities, fill the gaps in business scenario associations that may exist in the AI intelligent assistant call data, and improve the scenario adaptability of the tool entity network; Second, introducing natural behavior call sequence data when training tool entity vectors can enrich the diversity of tool entity associations, optimize the semantic representation effect of tool entity vectors, improve the adaptability of the tool entity network to diverse business scenarios, and lay a data foundation for subsequent similarity calculation and entity association reasoning for each tool entity.
[0027] In S102, the tool call sequence data is fused to obtain the tool entity vector.
[0028] Fusion refers to the process of combining tool call sequence data obtained in different ways to construct tool entity vectors.
[0029] In S103, a knowledge graph is constructed based on preset business process and tool entity vectors, and the nodes in the knowledge graph represent business process entities.
[0030] The business process entity can include attribute information such as key steps of the process, bound tool entities, and business adaptation scenarios.
[0031] In this embodiment, by combining the predefined business processes and tool call relationships defined by business personnel, and integrating the structural features of the business processes with the tool entity vector information, vector representations of each business process entity are generated. Based on the obtained vector representations of the business process entities and the business process sequence relationships planned according to user requirements, a business process entity knowledge graph is constructed. In this knowledge graph, each node represents a business process entity.
[0032] In S104, in response to the target business process, the target business process entity corresponding to the target business process is found in the knowledge graph using a preset large language model, and the target business process corresponding to the target business process is output. The preset large language model is a model obtained by fine-tuning based on tool call sequence data.
[0033] The target business process is extracted from user input using a pre-defined large language model and can consist of multiple prompt words. Fine-tuning can employ efficient parameter tuning techniques, such as LoRa. The large language model can be any model commonly used in related technologies, depending on the actual application; this embodiment does not impose any limitations.
[0034] In this embodiment, tool call sequence data is first acquired from historical behavior data. Then, the tool call sequence data is fused to obtain tool entity vectors. Next, a knowledge graph is constructed based on a preset business process and the tool entity vectors. Nodes in the knowledge graph represent business process entities. Finally, in response to the target business process, a preset large language model is used to search for the target business process entity corresponding to the target business process in the knowledge graph, and the corresponding target business process is output. The preset large language model is a model fine-tuned based on the tool call sequence data. This embodiment utilizes tool call sequence data from user historical behavior data to construct a knowledge graph, achieving visualized and structured business knowledge. Business changes can be addressed by modifying the knowledge graph, and the large language model can be fine-tuned using the tool call sequence data, enabling it to accurately identify user intent and obtain prompts (i.e., target business process entities) with fewer parameter adjustments, greatly shortening the model adjustment cycle.
[0035] In this embodiment, the tool entity and the business process entity, and the relationship between them, are as follows.
[0036] A business process entity is an operational concept, while a tool entity is a technical concept. All business processes rely on tool entities for implementation. A business process entity consists of multiple tool entities and can be viewed as an aggregation of tool entity sequences. A user requirement is usually fulfilled through at least one business process entity. A business process entity is the finest-grained service unit perceived by the user, while a tool entity is the basic building block of a business process entity.
[0037] In one possible implementation of this application, fusing tool call sequence data to obtain tool entity vectors may include: fusing tool call sequence data to obtain multiple tool call sequences; converting multiple tool call sequences into a tool entity network, where nodes in the tool entity network are tool entities and edges in the tool entity network are call associations between tool entities; and generating a tool entity vector corresponding to each node in the tool entity network based on the semantic features of the tool entities.
[0038] In this embodiment, tool call sequence data is fused to obtain multiple tool call sequences, which are then transformed into a tool entity network. Nodes in the network represent tool entities, and edges between nodes correspond to call relationships between tool entities. The weight of each edge, as a core attribute of this relationship, is determined by the call frequency and business association strength between tool entities, quantifying the tightness of the association between them. To train the vector representations of the tool entities, this application can employ various methods to obtain the node vector representations, such as random walks (e.g., the Node2vec algorithm) and Word2Vec models (e.g., the Skip-Gram model) to train tool entity vectors. These methods allow the learning of semantic features of tool entities in the network, generating a vector representation for each tool entity.
[0039] In one possible implementation of this application, generating a tool entity vector corresponding to each node in the tool entity network based on the semantic features of the tool entity may include: determining the transition probability of a node based on the similarity and preference factors between nodes, where the preference factors characterize the breadth-first search preference and depth-first search preference of the node transition, and the transition probability is the probability of transitioning from the first node to the second node; and using the transition probability to learn the semantic features of each node in the tool entity network to generate a tool entity vector corresponding to each node.
[0040] This application employs a node representation learning method based on random walks with transition probabilities. These transition probabilities incorporate global and local frequencies as well as temporal information, enabling the network to balance the learning of both local and global features.
[0041] The transition probability formula is calculated based on the similarity and preference factors between nodes. It considers the frequency and temporal order of neighboring nodes, as well as the preferences for breadth-first search (BFS) and depth-first search (DFS). The transition probabilities are shown below:
[0042]
[0043]
[0044]
[0045] in, For the node Transfer to node The probability of; The preference factor for the shift combines behavior frequency, time series information, and preference for BFS or DFS; For nodes The neighbor set; q is the Breadth-First Search (BFS) preference parameter, which controls the preference for BFS; q is the Depth-First Search (DFS) preference parameter, which controls the preference for DFS. The time interval is taken into account for time decay; For nodes The degree of the node. The number of neighbors; express Is it BFS neighbors (i.e., neighbors with a distance of 1). for The value is 0 when the BFS neighbor is zero. Not for BFS neighbor 1; express Is it The DFS neighbors (i.e., neighbors with a distance of 2). for The value is 0 when the DFS neighbor is zero. Not for The value is 1 when using DFS neighbors; The edge weights combine global and local frequency information; The frequency is the weighted average. For global frequency; For local frequencies; As a balancing factor, it controls the weights of global and local frequencies. ; This is a time decay parameter that controls the effect of time on edge weights. From arrive The time interval.
[0046] The above is an introduction to the entire transition probability, which enables deep semantic modeling of tool entity networks from multiple levels and dimensions; at the same time, parameters can be adjusted according to actual business needs. By reasonably configuring key parameters such as preference factors and time decay coefficients in the transition probability, it can effectively adapt to the semantic learning and association reasoning needs of tool entity networks in various business scenarios, ensure the accuracy of tool entity vector representation, and demonstrate excellent performance in various application scenarios.
[0047] In one possible implementation of this application, generating a tool entity vector corresponding to each node in the tool entity network based on the semantic features of the tool entity may include: initializing an initial tool entity vector for each node in the tool entity network; determining the context node corresponding to the target node to obtain multiple target node and context node pairs; and updating the initial tool entity vector for each target node and context node pair based on an objective function to obtain a tool entity vector corresponding to each node in the tool entity network.
[0048] This application employs the Skip-Gram model to train tool entity vectors. The Skip-Gram model is a semantic representation learning model for sequence data. Its core principle is to learn the vector representation of tool entities by maximizing the semantic similarity between the target tool entity and its context tool entities in the network. The ultimate goal is to make tool entities with similar contextual relationships as close as possible in the vector space, accurately reflecting the semantic relationships between these entities in the network. The core idea of this model is: using the current tool entity in the network as input, predicting its context tool entities in the graph tool call associated sequence, thereby capturing the potential semantic relationships between entities.
[0049] Skip-Gram objective function To predict its context node ,in window size Within the specified scope, the specific objective is to maximize the following objective function, as shown below:
[0050] The Skip-Gram model assumes that context nodes are predicted using vector representations of the target node. Specifically, given a target node... and context nodes Its conditional probability can be calculated using the dot product of the target node and the context nodes. Normalization can be performed using the softmax function, with the following formula:
[0051] in, The length of the node sequence; The size of the context window represents the range of context nodes surrounding the target node; For the target node; The context node of the target node; To be at a given target node Predicting context nodes in the case of The conditional probability; For the target node Vector representation of; For context nodes Vector representation of; This represents the total number of nodes in the tool entity network.
[0052] The training process of Skip-Gram is as follows: Initialize the vector representation of each node, usually using random initialization; slide a node of size from the node sequence. The window generates a context node pair for each target node; for each target node and context node pair, its conditional probability is calculated. The node vector representation is updated by optimizing the objective function (minimizing the negative log-likelihood). The node vector representation captures the similarity between nodes; nodes with similar contexts will be placed closer together in the vector space.
[0053] The Skip-Gram model learns the vector representation of a node by maximizing the similarity between the target node and its context nodes. By optimizing the objective function, nodes with similar contexts are made closer in the vector space, enabling this method to more effectively capture the relationships between nodes in the graph.
[0054] After obtaining the vector representation of the tool entity, and combining the business experience of operations and product personnel, the vector of the business process entity is calculated through the mapping relationship between tool entities and business process entities. The mapping relationship means that a business process consists of a sequence of tools. For example, if a user asks, "I want to check my phone bill," this statement belongs to the "check phone bill" business process. This business process calls two tools: first, it calls the tool to open the interface, which opens the phone bill query interface; then, it calls the phone bill query tool to query the user's phone bill information; finally, it calls the large model polishing interface to describe this information in fluent language. Therefore, in summary, this is the mapping relationship between tool entities and business process entities.
[0055] In one possible implementation of this application, constructing a knowledge graph based on preset business processes and tool entity vectors may include: determining the structural features of the business processes based on preset business processes; fusing the structural features of the business processes with the tool entity vectors to obtain business process entity vectors; determining the correlation between business process entities based on the similarity between business process entity vectors; associating business process entities with a correlation greater than a correlation threshold to construct a knowledge graph based on business process entities.
[0056] This embodiment designs a weighted synthesis model based on the relationship between the current tool entity and the business process entity, and taking into account the correlation between tool entities, the order of tool entities, and the weight of tool entities in the business process entity. This model enables the vector of each tool entity to be weighted according to its importance and position in the business process, and can capture the combination patterns between tools.
[0057] The vector formula for calculating the business process is as follows:
[0058] in, It is the first Vector representation of each tool; For tools and The similarity between the two tools measures their dependency or combination pattern, and this coefficient reflects the local sequence information between the tools. In this embodiment, the similarity between the two tools can be represented by cosine similarity, but other methods can also be used to determine the similarity, depending on the actual application. This embodiment does not limit the method. The global tool entity importance weight, calculated using the attention mechanism, measures the degree of association between the i-th tool entity and all tool entities in the current business process entity. The detailed formula is as follows:
[0059] Using the weighted synthesis formula above, the final vector of business process entities is obtained. Cosine similarity matching is performed pairwise on each business process entity vector. Based on a threshold of 0.8, the most similar business process entities are selected for association. In the business context, these two business processes have similar business connections, and so on, thus constructing a business process entity knowledge graph. In this graph, nodes are business process entities, and node attributes include information such as key process steps, bound tool entities, and business adaptation scenarios. Edges are only associated between similar business processes.
[0060] After constructing the knowledge graph, fine-tuning of the large language model (i.e., the large model) is performed.
[0061] In one possible implementation of this application, the agent construction method may further include: constructing a fine-tuning dataset based on tool call sequence data; and fine-tuning a large language model using the fine-tuning dataset to obtain a preset large language model.
[0062] Before fine-tuning the large model's instructions, it's necessary to construct a corresponding instruction fine-tuning dataset based on the user's historical tool call sequences. The steps for constructing this dataset are as follows: First, select several user-initialized business processes based on the instruction fine-tuning sequence. Starting with these processes, simulate querying the business process knowledge graph for search results. If no results are found, return the output to the user and wait for their next feedback. If results are found in the knowledge graph, continue executing the business process until no more business process entity nodes can be retrieved. Regardless of whether a business process node is initialized or retrieved through the business process knowledge graph, its attribute information is added to the prompt words. These prompt words mainly include the following: Key steps in the process: This section mainly describes the main function of the process, enabling the large model to fully understand the process information.
[0063] Binding Tool Entity: This section mainly describes the tool entity contained within the business process entity. It primarily introduces the output and input parameters of the tool entity, as well as the description of the corresponding tool. This tool entity is the actual execution side of the business process. The technology for executing the tool by calling it through the large model can be similar to the Model Context Protocol (MCP), or other methods can be used, depending on the actual application. This embodiment does not impose any limitations.
[0064] Information such as business adaptation scenarios: An application (APP) may have many business scenarios. Different business processes will be divided into different business scenarios for adaptation. This attribute mainly describes the specific business scenario information, so that the large model can be located in many business scenarios.
[0065] In one example, when a user asks "I want to subscribe to broadband," the "subscribe to broadband" intent is triggered. First, the "User Information Verification Process" business process entity is executed, with the following prompt: # Character Setting You are a business expert for an app, responsible for assisting users with various business inquiries and processes, ensuring efficiency and accuracy.
[0066] # Historical Information none # Current business process to be executed Now, you need to execute the "User Information Verification Process".
[0067] The following is a detailed description of the attributes of this business process: ## Key Steps in the Process The main purpose of this process is to allow users to complete a new broadband installation application. The core steps include: 1. User Identity Verification: Verify whether the user's basic information matches the database of this APP.
[0068] 2. Address resource verification: Confirm whether the user's address has broadband coverage.
[0069] ## Binding Tool Entities • Tool Entity 1: User Information Verification Tool • Description: Used to verify the validity of user identity information, based on the APP Customer Relationship Management (CRM) system.
[0070] • Input parameters: User ID, name, and ID number.
[0071] • Output parameters: Verification status (success / failure), error code (if any).
[0072] Tool Entity 2: Address Coverage Query Tool • Description: Checks if the user's address is within the broadband network coverage area.
[0073] • Input parameter: User address (detailed address).
[0074] • Output parameters: Coverage status (yes / no), recommended bandwidth options.
[0075] ## Business Adaptation Scenarios Primarily targeting the new installation needs of individual or family users. Typical scenarios include: • Broadband application for new residents: Applicable to users who have just moved to a new address.
[0076] Package upgrade conversion: Users upgrade from the original package to high bandwidth service.
[0077] • During promotional events: such as broadband discounts during holidays, a large number of applications need to be processed quickly.
[0078] Scenario characteristics: high concurrency, real-time response required, in line with the APP's "smart home" strategy.
[0079] # Knowledge Graph Operations If the knowledge graph retrieval is successful, the process will continue; if no results are found, the output will be returned and user feedback will be awaited.
[0080] # Output Limitations 1. The final output is formatted as JSON. The JSON has two fields: output, which is the output of the large model, and next_process_entity, which is the next business process entity retrieved through the knowledge graph.
[0081] The prompt word was generated by calling tools and searching the knowledge graph through a large model, as shown below: "output": "No problems detected, broadband service can proceed". "next_process_entity": "Package recommendation process".
[0082] The above are examples of fine-tuning prompts and output. After completing the "User Information Verification Process" business process, the user can proceed with the process. After searching the graph, the next step is "Package Recommendation Process".
[0083] Based on the above approach, we exhaustively enumerate all possible business scenarios to ensure the generalization ability of the large model after fine-tuning. Finally, we construct a corpus of approximately 10,000 fine-tuning instructions. After obtaining the fine-tuning corpus, this application selects Qwen3-14B as the base model for fine-tuning. This model has strong instruction compliance capabilities, and the number of parameters in 14B is relatively moderate, achieving a balance between cost and effectiveness. This application uses LoRa for fine-tuning. This technique significantly improves training efficiency while maintaining performance by training only a small number of parameters in the model, achieving efficient parameter utilization. Detailed implementation of LoRa is not described in this application.
[0084] After fine-tuning, the trained model is deployed to the inference service module to provide real-time decision support for the upper-layer system. This process enables the constructed intelligent agent model to more accurately understand business needs, flexibly respond to diverse business scenarios, and provide strong support for enterprise intelligent transformation.
[0085] After the model fine-tuning is completed, the fine-tuned large language model can be applied to the large model's perseverance level. That is, when the user uses the AI intelligent assistant, the system dynamically responds to the user's needs through the following process and completes the task step by step in a highly intelligent manner.
[0086] First, when a user enters their user question, an intent model performs intent recognition and then distributes it to different initialization business process entities. After the large model receives the business process entity, it constructs prompt words based on the attributes of the business entity (as described in the large model fine-tuning training layer). The large model then executes the tool entities contained in the business process entity through MCP.
[0087] After execution, a final search is performed in the knowledge graph to check for the next business process entity node. If no node is found, it means the user has completed the business process for this requirement, and the output result is returned directly. This design not only simplifies the task processing flow but also significantly reduces the system's computational and resource overhead, improving response speed and efficiency. For most users, a single business process is often sufficient to meet their needs, thus maximizing system resource utilization while satisfying user experience.
[0088] If a subsequent business process node appears after the knowledge graph retrieval, it indicates that the user's overall business requirements are incomplete and will need to be invoked through the larger model in the next round. For business processes that have already been executed in the previous round, a summary of the prompt information will be added to the prompt words, as shown in the example below: # Character Setting You are a business expert for an app, responsible for assisting users with various business inquiries and processes, ensuring efficiency and accuracy.
[0089] # Historical Information • Executed business process: User information verification process • Result returned: Verification successful, user identity valid, can continue subsequent business.
[0090] The following prompts are omitted; the structure and description of the large model fine-tuning training layers are consistent.
[0091] Based on the assembled prompts, the system invokes a finely tuned and trained model to gradually satisfy user needs through multiple rounds of reasoning. Once the business process entity can no longer be retrieved from the knowledge graph, it indicates that the user's needs have been met. The system then outputs the result back to the user and records new user behavior data. This data is stored and used in training a new tool entity network for subsequent optimization of the knowledge graph's performance.
[0092] To address potential scenarios at the inference layer, particularly where updates to business experience and knowledge in certain regions are not reflected in the large model in real time, the operations layer needs to provide a manual intervention mechanism to ensure the model can flexibly adapt to the specific needs of different regions or scenarios. This manual intervention mechanism not only helps optimize business processes but also improves the system's response efficiency and accuracy, ensuring that the final level of intelligence in the business process aligns with local requirements. The specific intervention mechanism can be implemented through the following steps: Operations personnel in different regions may have region-specific business rules and regulations, and the business process sequences generated by algorithms may not necessarily conform to the standards of that region. However, this knowledge, experience, or specific standards are difficult to update and transfer to the large model in real time. To compensate for this timeliness difference, operations personnel can be allowed to manually adjust the structure of the business process entity graph, thereby directly influencing the inference decisions of the large model. Specifically, this can be modified into two parts: Modify business process entity attributes: In some regions, business processes may be the same, but their descriptions may differ from those in other regions, and even the standard tools used for execution may differ. In such cases, it is necessary to modify the attribute information of the business process entity, including key steps, information on standard tool entities, and the applicable business scenarios.
[0093] Modify the business process entity knowledge graph structure: If modifying the attributes of business process entities still cannot meet the needs of operations personnel in the region, then it is necessary to adjust the structure of the business process knowledge graph. For example, when the business needs of a certain region change suddenly and a timely response is required, operations personnel can adjust the structure of the relevant business process entity knowledge graph in a timely manner to ensure that the large model can reflect these changes in real time or near real time.
[0094] By adding, deleting, and modifying the business process entity knowledge graph using the methods described above, we can achieve a level of rapid response to the needs of operations personnel.
[0095] In one instance, this application may include four layers: a business process knowledge graph construction layer, a large model fine-tuning training layer, a large model inference layer, and an operations layer.
[0096] The core task of the business process knowledge graph construction layer is to build a business process entity knowledge graph based on the original tool call sequence data from users' historical behavior. Specifically, this includes: using the original tool call sequence data from users' historical behavior, learning the semantic features of tool entities in the network based on the node2vec network walk algorithm, and generating a vector representation for each tool entity; combining the predefined business processes and tool call associations by business personnel, and generating vector representations for each business process entity by fusing the structural features of the business process with the tool entity vector information; and constructing the business process entity knowledge graph based on the obtained vector representations of the business process entities and the business process sequence relationships planned according to user requirements. In this knowledge graph, each node represents a business process entity; each entity contains attribute information such as key process steps, bound tool entities, and business adaptation scenarios; a business process entity node is selected by calculating the cosine similarity of each business process entity, and the most similar entity nodes within the range exceeding the cosine similarity threshold are selected. Edges connecting nodes represent similar business logic, and this process is repeated for each business process entity node to construct a business process knowledge graph. The knowledge graph is then stored in a graph database for easy retrieval by upper layers.
[0097] Large Model Fine-Tuning Training Layer: Based on tool call sequence data from user historical behavior and the mapping relationship between standard business processes and tools, a set of original business process sequence datasets is constructed. On this dataset, the effect of currently triggerable knowledge graph retrieval is simulated, constructing a set of instruction fine-tuning datasets suitable for agent orchestration. The purpose of this fine-tuning data is to train an agent model that can make decisions guided by the business process knowledge graph index. After fine-tuning training is completed, the model is deployed to provide large model inference services for upper-layer modules.
[0098] Large Model Inference Layer: When a user uses the AI assistant, the system initializes a business process based on the user's input intent. After this business process is completed, the system searches the previously accumulated knowledge graph in the graph database to see if a new business process entity can be returned. If no next business process entity is found, the system directly returns the output result to the user. If the next business process entity can be found in the knowledge graph, the system adds the attribute information of that business process entity (including key steps, bound tool entities, business adaptation scenarios, etc.) to the current prompt word, allowing the large model to continue executing according to the current business process. After execution, the system continues to search for the next node in the knowledge graph and continues the above process until no next business process entity node can be found in the knowledge graph. Finally, the system directly returns the result to the user.
[0099] Operations Layer: Addressing potential scenarios in the inference layer, such as the failure to provide real-time feedback on business experience and knowledge updates from certain regions to the large model for training, or the need for operations personnel to intervene in current business processes based on regional experience, this proposal provides a manual intervention mechanism at the operations layer. Operations personnel can manually adjust the node relationships in the knowledge graph according to regional operational strategies, constructing a regionally operable business process. Once adjusted, this effect automatically takes effect at the large model's inference layer, guiding the large model to make decisions based on the operations layer's objectives, thereby achieving dynamic operational optimization of the business process.
[0100] Unlike related technologies that rely on model fine-tuning for vertical domain adaptation, which is resource-intensive, this application introduces a business process knowledge graph as the core knowledge foundation, achieving a technical path for updating agent knowledge without large-scale retraining. The fine-tuning process of related technologies involves multiple stages, including data preparation, model training, and deployment verification, which is time-consuming, labor-intensive, and difficult to respond quickly to business changes. This application, however, by embedding business logic into an editable knowledge graph structure, allows operations personnel to modify the corresponding node attributes or relationships in the graph database only when business rules or processes change. The modification results can then influence the agent's decision-making logic almost in real time through prompt word engineering. This approach shifts the core of model optimization from "data-driven retraining" to "knowledge-driven lightweight orchestration," effectively reducing training resources and time costs. This enables enterprises to iterate and deploy agents at an agile pace, even on a weekly or daily basis, greatly improving the responsiveness to business needs.
[0101] Furthermore, addressing the shortcomings of related technologies, such as unstable prompt word engineering effects, heavy reliance on model capabilities, and difficulty in handling complex and long-process tasks, this application utilizes knowledge graphs to provide structured business logic guidance for each step of the agent's planning. Traditional prompt word modification methods require writing extremely detailed and complex prompt texts when facing complex scenarios, and even minor business adjustments can cause the prompt words to become ineffective. This application, through the dynamic retrieval and assembly mechanism of knowledge graphs, decomposes complex business logic into a series of coherent business process entity nodes. During the reasoning process, each decision of the agent is based on node content retrieved from the knowledge graph, which contains specific tool bindings and scenario adaptation information. This ensures that its planned path is always constrained within the preset business framework, significantly reducing the probability of model "illusions." At the same time, since the core logic is carried by the knowledge graph, the prompt words only need to serve the function of transmitting node information, avoiding the writing of lengthy and fragile business rule descriptions, making the overall system more robust and maintainable.
[0102] Compared to the limitations of related technologies such as RAG (Related Aspect-Oriented Grammar) in complex enterprise-level business scenarios, which are prone to information confusion due to overlapping knowledge fragments, the business process knowledge graph constructed in this application possesses stronger semantic differentiation and logical association capabilities. RAG typically retrieves isolated text fragments based on semantic similarity. In situations where enterprise professional knowledge contains numerous synonyms, polysemous words, and complex process relationships, it is prone to retrieving irrelevant or conflicting information. The knowledge graph in this application not only stores entities but also clearly depicts the semantic similarity and logical sequence relationships between business process entities through vectorized representation and cosine similarity calculation. This graph-based associative reasoning can better understand the overall business context, ensuring that the agent is injected with "knowledge blocks" with clear boundaries and logical coherence, rather than scattered "knowledge fragments." This improves reasoning accuracy while supporting deeper business understanding and more complex task planning, meeting the high requirements of professionalism and accuracy for enterprise-level applications.
[0103] Compared to related technologies that treat models as static entities and lack effective human intervention and continuous learning mechanisms, this application designs an operations layer, forming a complete closed loop of "reasoning-recording-intervention-optimization." When the agent runs in the inference layer, new user behavior data is recorded and fed back to the knowledge graph construction layer to update tool entity vectors and optimize graph associations, achieving continuous data accumulation and self-learning. More importantly, operations personnel can directly intervene in the knowledge graph through the operations layer, such as adjusting the attributes of business process entities or the graph structure according to the business characteristics of a region, achieving rapid personalized adaptation to specific areas or scenarios. This design combines human business experience with the automation capabilities of large models, ensuring the system's intelligent autonomy in core logic while giving it the ability to flexibly adjust to differentiated needs such as regionality and timeliness.
[0104] Figure 2 This is a schematic diagram of an intelligent agent construction device provided in an embodiment of this application. Figure 2 As shown, the intelligent agent construction device is applied to a terminal. The intelligent agent construction device may include: an acquisition module 201, a fusion module 202, a construction module 203, and a search module 204.
[0105] The system comprises the following modules: an acquisition module 201, which acquires tool call sequence data from historical behavior data; a fusion module 202, which fuses the tool call sequence data to obtain tool entity vectors; a construction module 203, which constructs a knowledge graph based on preset business processes and tool entity vectors, where nodes in the knowledge graph represent business process entities; and a search module 204, which responds to the target business process, uses a preset large language model to search for the target business process entity corresponding to the target business process in the knowledge graph, and outputs the target business process corresponding to the target business process. The preset large language model is a model fine-tuned based on the tool call sequence data.
[0106] In this embodiment, the acquisition module 201 first acquires tool call sequence data from historical behavior data. Then, the fusion module 202 fuses the tool call sequence data to obtain tool entity vectors. Next, the construction module 203 constructs a knowledge graph based on preset business processes and tool entity vectors. Nodes in the knowledge graph represent business process entities. Finally, the search module 204 responds to the target business process, uses a preset large language model to search for the target business process entity corresponding to the target business process in the knowledge graph, and outputs the target business process corresponding to the target business process. The preset large language model is a model fine-tuned based on the tool call sequence data. This embodiment utilizes tool call sequence data from user historical behavior data to construct a knowledge graph, realizing the visualization and structuring of business knowledge. It allows for adaptation to business changes by modifying the knowledge graph, and the large language model is fine-tuned using tool call sequence data, enabling accurate identification of user intent and the generation of prompts (i.e., target business process entities) with minimal parameter adjustments, significantly shortening the model adjustment cycle.
[0107] In one possible implementation of this application, the fusion module 202 is used to: fuse tool call sequence data to obtain multiple tool call sequences; convert the multiple tool call sequences into a tool entity network, where nodes in the tool entity network are tool entities and edges in the tool entity network are call associations between tool entities; and generate a tool entity vector corresponding to each node in the tool entity network based on the semantic features of the tool entities.
[0108] In one possible implementation of this application, the fusion module 202 is used to: determine the transition probability of a node based on the similarity and preference factors between nodes, wherein the preference factors characterize the breadth-first search preference and depth-first search preference of the node transition, and the transition probability is the probability of transitioning from the first node to the second node; and generate a tool entity vector corresponding to each node by using the semantic features of each node in the tool entity network to learn the transition probability.
[0109] In one possible implementation of this application, the transition probability is as follows:
[0110]
[0111]
[0112]
[0113] in, For the node Transfer to node The probability of; For the shift in preference factors; For nodes The neighbor set; q represents the parameters for breadth-first search (BFS) preference; q represents the parameters for depth-first search (DFS) preference. For time intervals; For nodes The number of neighbors; express Is it BFS neighbors, for The value is 0 when the BFS neighbor is zero. Not for BFS neighbor 1; express Is it DFS neighbors, for The value is 0 when the DFS neighbor is zero. Not for The value is 1 when using DFS neighbors; The edge weight; The frequency is the weighted average. For global frequency; For local frequencies; As a balance factor, ; This is the time decay parameter; From arrive The time interval.
[0114] In one possible implementation of this application, the fusion module 202 is used to: initialize the initial tool entity vector of each node in the tool entity network; determine the context node corresponding to the target node to obtain multiple target node and context node pairs; and update the initial tool entity vector for each target node and context node pair based on the objective function to obtain the tool entity vector corresponding to each node in the tool entity network.
[0115] In one possible implementation of this application, the objective function is as follows:
[0116]
[0117] in, The length of the node sequence; Size of the context window; For the target node; The context node of the target node; To be at a given target node Predicting context nodes in the case of The conditional probability; For the target node Vector representation of; For context nodes Vector representation of; This represents the total number of nodes in the tool entity network.
[0118] In one possible implementation of this application, the construction module 203 is used to: determine the structural features of the business process based on a preset business process; fuse the structural features of the business process with the tool entity vector to obtain the business process entity vector; determine the correlation between business process entities based on the similarity between the business process entity vectors; and associate business process entities with a correlation greater than the correlation threshold to construct a knowledge graph based on the business process entities.
[0119] In one possible implementation of this application, the intelligent agent construction device may further include a second construction module and a fine-tuning module.
[0120] The second construction module is used to build a fine-tuning dataset based on the sequence data called by the tool; the fine-tuning module is used to fine-tune the large language model using the fine-tuning dataset to obtain the preset large language model.
[0121] The functionality of the intelligent agent construction device in this application has already been demonstrated. Figure 1 The method embodiments shown are described in detail. Therefore, for any parts not covered in detail in this embodiment, please refer to the relevant descriptions in the foregoing embodiments, which will not be repeated here.
[0122] like Figure 3 As shown, this application embodiment also provides an electronic device 300, including a processor 301, a memory 302, and a program or instructions stored in the memory 302 and executable on the processor 301. When the program or instructions are executed by the processor 301, they implement the various processes of the above-described intelligent agent construction processing method embodiment and achieve the same technical effect. To avoid repetition, they will not be described again here.
[0123] Optionally, embodiments of this application also provide a computer-readable storage medium storing a computer program. When executed by a processor, this computer program implements the various processes of the above-described intelligent agent construction method embodiments and achieves the same technical effects. To avoid repetition, it will not be described again here. The computer-readable storage medium may be a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk, etc.
[0124] Optionally, this application embodiment also provides a computer program product, which includes a computer program stored on a non-transitory computer-readable storage medium. The computer program includes program instructions, which, when executed by a computer, implement the various processes of the above-described intelligent agent construction method embodiment and achieve the same technical effect. To avoid repetition, they will not be described again here.
[0125] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or system that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or system. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or system that includes that element.
[0126] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal (which may be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in the various embodiments of this application.
[0127] The embodiments of this application have been described above with reference to the accompanying drawings. However, this application is not limited to the specific embodiments described above. The specific embodiments described above are merely illustrative and not restrictive. Those skilled in the art can make many other forms under the guidance of this application without departing from the spirit and scope of the claims, and all of these forms are within the protection scope of this application.
Claims
1. A method for constructing an intelligent agent, characterized in that, include: Retrieve tool call sequence data from historical behavior data; The tool call sequence data is fused to obtain the tool entity vector; Based on the preset business process and the tool entity vector, a knowledge graph is constructed, and the nodes in the knowledge graph represent business process entities. In response to the target business process, the system uses a preset large language model to find the target business process entity corresponding to the target business process in the knowledge graph, and outputs the target business process corresponding to the target business process. The preset large language model is a model obtained by fine-tuning based on the tool call sequence data.
2. The method according to claim 1, characterized in that, The step of fusing the tool call sequence data to obtain the tool entity vector includes: The tool call sequence data are fused to obtain multiple tool call sequences; The multiple tool call sequences are transformed into a tool entity network, where the nodes in the tool entity network are tool entities, and the edges in the tool entity network are the call association relationships between tool entities; Based on the semantic features of the tool entities, a tool entity vector corresponding to each node in the tool entity network is generated.
3. The method according to claim 2, characterized in that, The generation of the tool entity vector corresponding to each node in the tool entity network based on the semantic features of the tool entity includes: Based on the similarity and preference factors between nodes, the transition probability of a node is determined. The preference factors represent the breadth-first search preference and depth-first search preference for node transition. The transition probability is the probability of moving from the first node to the second node. The semantic features of each node in the tool entity network are learned using the transition probabilities to generate a tool entity vector corresponding to each node.
4. The method according to claim 3, characterized in that, The transition probabilities are as follows: in, For the node Transfer to node The probability of; For the shift in preference factors; For nodes The neighbor set; q represents the parameters for breadth-first search (BFS) preference; q represents the parameters for depth-first search (DFS) preference. For time intervals; For nodes The number of neighbors; express Is it BFS neighbors, for The value is 0 when the BFS neighbor is zero. Not for BFS neighbor 1; express Is it DFS neighbors, for The value is 0 when the DFS neighbor is zero. Not for The value is 1 when using DFS neighbors; The edge weight; The frequency is the weighted average. For global frequency; For local frequencies; As a balance factor, ; This is the time decay parameter; From arrive The time interval.
5. The method according to claim 2, characterized in that, The generation of the tool entity vector corresponding to each node in the tool entity network based on the semantic features of the tool entity includes: Initialize the initial tool entity vector for each node in the tool entity network; Determine the context node corresponding to the target node to obtain multiple target node-context node pairs; For each target node and context node pair, the initial tool entity vector is updated based on the objective function to obtain the tool entity vector corresponding to each node in the tool entity network.
6. The method according to claim 5, characterized in that, The objective function is as follows: in, The length of the node sequence; Size of the context window; For the target node; The context node of the target node; To be at a given target node Predicting context nodes in the case of The conditional probability; For the target node Vector representation of; For context nodes Vector representation of; This represents the total number of nodes in the tool entity network.
7. The method according to claim 1, characterized in that, The construction of a knowledge graph based on the preset business process and the tool entity vectors includes: Based on the pre-defined business process, determine the structural characteristics of the business process; The business process structure features are fused with the tool entity vector to obtain the business process entity vector; The degree of association between business process entities is determined based on the similarity between their entity vectors. Associate business process entities with a correlation degree greater than the correlation degree threshold to construct a knowledge graph based on the business process entities.
8. The method according to claim 1, characterized in that, The method further includes: Based on the tool, call sequence data to construct a fine-tuning dataset; The large language model is fine-tuned using the fine-tuning dataset to obtain a preset large language model.
9. An electronic device, characterized in that, It includes a processor, a memory, a program or instructions stored in the memory and executable on the processor, wherein the program or instructions, when executed by the processor, implement the steps of the method as described in any one of claims 1 to 8.
10. A computer program product, characterized in that, The computer program product includes a computer program stored on a non-transitory computer-readable storage medium, the computer program including program instructions that, when executed by a computer, implement the steps of the method as described in any one of claims 1 to 8.