Intelligent agent service calling method and related equipment
By establishing a long connection between the business module and the smart service module in the business system, and deploying the data interface in the business module, the business processing efficiency is Efficient two -way communication and improvement of overall business processing efficiency.
Patent Information
- Application Number
- CN202411498868.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-24
- Publication Date
- 2025-01-28
AI Technical Summary
In the business system, when the agent service module frequently interacts with the business module, the service processing efficiency is reduced and the user experience is poor.
By establishing a long connection between the business module and the smart service module, it achieves high -efficiency two -way communication, and the data interface of the smart service module sent data to the business module directly in the business module to reduce coupling.
The communication efficiency between the business module and the smart service module has been improved, the communication delay is reduced, the resource consumption is reduced, and the overall business processing efficiency is improved.
Smart Images

Figure CN119383053A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of artificial intelligence technology, and in particular to an intelligent agent service calling method and related equipment. Background Art
[0002] AI Agent (artificial intelligence agent), or agent, is an artificial intelligence entity that can perceive the environment and take actions autonomously. Unlike large language models that only generate language, agents can not only understand and generate language, but also perform specific tasks and make dynamic decisions.
[0003] A large business system usually deploys multiple business modules to implement different business functions. In order to expand the capabilities of these business modules, in addition to the aforementioned business system, the prior art also configures an agent service module for each business module to call the agent therein.
[0004] During the operation of the agent, it is necessary to interact with the business module in the business system for multiple times to ensure more accurate business decisions. However, this application found that when the agent service module needs to frequently interact with the business module during the call process, the overall business processing efficiency will be significantly reduced, resulting in a poor user experience. Summary of the invention
[0005] The embodiments of the present application provide an intelligent agent service calling method and related devices for improving the overall business processing efficiency in a scenario where a business module calls an intelligent agent service.
[0006] The first aspect of the embodiment of the present application provides an agent service calling method, which is applied to a business module, including:
[0007] If an agent service request is obtained, a handshake request is sent to the agent service module;
[0008] Based on the handshake response sent by the agent service module, determine to establish a long connection between the business module and the agent service module;
[0009] Sending the agent service request to the agent service module under the long connection, the agent service module is used to process the agent service request to obtain processing information;
[0010] The processing information sent by the intelligent agent service module under the long connection is received, and the processing information is returned through the data interface of the business module.
[0011] In a specific implementation, the agent service module includes at least one agent framework, and before obtaining the agent service request, the method further includes:
[0012] Obtaining session information requesting to call an agent service and agent operation information associated with the session information;
[0013] Generate the agent service request, the agent service request includes the agent operation information and the session information, the agent service module is specifically used to process the session information to obtain the processing information according to any agent framework and the agent operation information.
[0014] In a specific implementation, the agent service module includes multiple agent frameworks, the agent service request also includes framework indication information, and the agent service module is further used to determine any one of the agent frameworks from the multiple agent frameworks based on the framework indication information.
[0015] In a specific implementation, the agent service request includes plug-in information, and the receiving the processing information sent by the agent service module under the long connection includes:
[0016] Receiving a data acquisition request sent by the agent service module under the long connection, wherein the data acquisition request includes the plug-in information and a request data item;
[0017] The method further comprises:
[0018] Searching locally for an authentication key corresponding to the plug-in information;
[0019] Sending the request data item and the authentication key to the plug-in indicated by the plug-in information;
[0020] Receiving the value of the request data item returned by the plug-in after obtaining the authentication key;
[0021] The value of the requested data item is sent to the agent service module under the long connection.
[0022] A second aspect of an embodiment of the present application provides an agent service calling method, which is applied to an agent service module, comprising:
[0023] Sending a handshake response to the business module according to the handshake request sent by the business module, and determining to establish a long connection between the agent service module and the business module;
[0024] receiving an agent service request sent by the business module under the long connection, and processing the agent service request to obtain processing information;
[0025] The processing information is sent to the service module under the long connection, and the processing information is sent through the data interface of the service module.
[0026] In a specific implementation, the agent service module includes at least one agent framework, the agent service request includes session information requesting to call the agent service and agent operation information associated with the session information, and the processing of the agent service request to obtain processing information includes:
[0027] Constructing an intelligent agent according to any of the intelligent agent frameworks and the intelligent agent operation information;
[0028] The processing information is obtained based on the agent processing the session information.
[0029] In a specific implementation, the agent service module includes a plurality of agent frameworks, and before forming an agent according to any of the agent frameworks and the agent operation information, the method further includes:
[0030] Obtaining framework indication information from the agent service request;
[0031] Based on the framework indication information, any one of the agent frameworks is determined from the multiple agent frameworks.
[0032] In a specific implementation, the processing of the agent service request to obtain processing information includes:
[0033] If the agent service request includes plug-in information, determining the request data item to be obtained;
[0034] Generate a data acquisition request and use the data acquisition request as the processing information, wherein the data acquisition request includes the plug-in information and the request data item;
[0035] Sending the processing information to the service module under the long connection includes:
[0036] Sending the data acquisition request to the business module under the long connection, the business module is used to locally search for the authentication key corresponding to the plug-in information, and send the request data item and the authentication key to the plug-in indicated by the plug-in information, and receive the value of the request data item returned by the plug-in after obtaining the authentication key;
[0037] The method further comprises:
[0038] The value of the request data item sent by the business module is received under the long connection.
[0039] A third aspect of the embodiment of the present application provides a service module, including:
[0040] An acquisition unit, configured to send a handshake request to the agent service module if an agent service request is acquired;
[0041] A determination unit, configured to determine, based on the handshake response sent by the agent service module, to establish a long connection between the business module and the agent service module;
[0042] A sending unit, used for sending the agent service request to the agent service module under the long connection, and the agent service module is used for processing the agent service request to obtain processing information;
[0043] A receiving unit is used to receive the processing information sent by the intelligent agent service module under the long connection, and the processing information is returned through the data interface of the business module.
[0044] In a specific implementation, the agent service module includes at least one agent framework, and before obtaining the agent service request, the obtaining unit is further used to obtain session information requesting to call the agent service and agent operation information associated with the session information;
[0045] The business module also includes: a generating unit;
[0046] The generation unit is used to generate the agent service request, which includes the agent operation information and the session information. The agent service module is specifically used to process the session information to obtain the processing information based on the agent constructed according to any one of the agent frameworks and the agent operation information.
[0047] In a specific implementation, the agent service module includes multiple agent frameworks, the agent service request also includes framework indication information, and the agent service module is further used to determine any one of the agent frameworks from the multiple agent frameworks based on the framework indication information.
[0048] In a specific implementation, the agent service request includes plug-in information, and the receiving unit is specifically used to receive a data acquisition request sent by the agent service module under the long connection, wherein the data acquisition request includes the plug-in information and a request data item;
[0049] The business module also includes: a search unit;
[0050] The search unit is used to search locally for an authentication key corresponding to the plug-in information;
[0051] The sending unit is further configured to send the request data item and the authentication key to the plug-in indicated by the plug-in information;
[0052] The receiving unit is further used to receive the value of the request data item returned by the plug-in after obtaining the authentication key;
[0053] The sending unit is also used to send the value of the requested data item to the intelligent agent service module under the long connection.
[0054] A fourth aspect of the present application embodiment provides an intelligent agent service module, including:
[0055] A sending unit, configured to send a handshake response to the business module according to the handshake request sent by the business module, and determine to establish a long connection between the agent service module and the business module;
[0056] A receiving unit, used to receive an agent service request sent by the business module under the long connection;
[0057] A processing unit, used for processing the agent service request to obtain processing information;
[0058] The sending unit is further used to send the processing information to the service module under the long connection, and the processing information is sent through the data interface of the service module.
[0059] In a specific implementation, the agent service module includes at least one agent framework, the agent service request includes session information requesting to call the agent service and agent operation information associated with the session information, and the processing unit is specifically used to form an agent according to any of the agent frameworks and the agent operation information;
[0060] The processing information is obtained based on the agent processing the session information.
[0061] In a specific implementation, the agent service module includes a plurality of agent frameworks, and before forming an agent according to any of the agent frameworks and the agent operation information, the service module further includes: an acquisition unit and a determination unit;
[0062] The acquisition unit is used to acquire framework indication information from the agent service request;
[0063] The determining unit is used to determine any one of the intelligent agent frameworks from the multiple intelligent agent frameworks based on the framework indication information.
[0064] In a specific implementation, the processing unit is specifically configured to determine the request data item to be obtained if the agent service request includes the plug-in information; generate a data acquisition request and use the data acquisition request as the processing information, wherein the data acquisition request includes the plug-in information and the request data item;
[0065] The sending unit is specifically used to send the plug-in interface specification to the business module under the long connection, the business module is used to send the data acquisition request to the business module under the long connection, the business module is used to locally search for the authentication key corresponding to the plug-in information, and send the request data item and the authentication key to the plug-in indicated by the plug-in information, and receive the value of the request data item returned by the plug-in after obtaining the authentication key;
[0066] The sending unit is also used to receive the value of the request data item sent by the business module under the long connection.
[0067] A fifth aspect of an embodiment of the present application provides a computer device, including:
[0068] CPU, memory and input / output interface;
[0069] The memory is a short-term storage memory or a persistent storage memory;
[0070] The central processing unit is configured to communicate with the memory and execute instructions in the memory to perform the method described in the first aspect or the second aspect.
[0071] A sixth aspect of the embodiments of the present application provides a computer program product comprising instructions, which, when executed on a computer, enables the computer to execute the method described in the first aspect or the second aspect.
[0072] A seventh aspect of an embodiment of the present application provides a computer storage medium, wherein the computer storage medium stores instructions, and when the instructions are executed on a computer, the computer executes the method described in the first aspect or the second aspect.
[0073] It can be seen from the above technical solutions that the embodiments of the present application have the following advantages: The embodiments of the present application establish a long connection between the business module and the intelligent body service module, so that the conversation between the business module and the intelligent body service module can continue, with lower communication delay. At the same time, the embodiments of the present application also directly deploys the data interface for the intelligent body service module to send data to the business module in the business module, avoiding coupling between business modules and helping to improve data interaction efficiency. In summary, the embodiments of the present application achieve efficient two-way communication between the business module and the intelligent body service module by introducing a long connection communication method and a data interface deployed in the business module, which helps to improve the overall business processing efficiency in the scenario where the business module calls the intelligent body service. BRIEF DESCRIPTION OF THE DRAWINGS
[0074] Figure 1 A system architecture diagram of the intelligent agent calling method disclosed in the embodiment of the present application;
[0075] Figure 2 A schematic diagram of a flow chart of the agent calling method disclosed in the embodiment of the present application;
[0076] Figure 3 Another system architecture diagram of the intelligent agent calling method disclosed in the embodiment of the present application;
[0077] Figure 4 An example diagram of the agent list interface disclosed in the embodiment of the present application;
[0078] Figure 5 An example diagram of the registration interface of the intelligent agent framework disclosed in the embodiment of the present application;
[0079] Figure 6 A schematic diagram of the structure of the business module disclosed in the embodiment of the present application;
[0080] Figure 7 A schematic diagram of the structure of the intelligent agent service module disclosed in the embodiment of the present application;
[0081] Figure 8 A schematic diagram of the structure of a computer device disclosed in an embodiment of the present application. DETAILED DESCRIPTION
[0082] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0083] Based on the analysis of the data interaction mode between the existing business module and the intelligent agent service module, the inventor of the present application discovered the following reasons that lead to low business processing efficiency.
[0084] First, the inventor found that the communication delay between the existing business module and the intelligent service module is relatively large. By analyzing the communication messages and communication protocols between the business module and the intelligent service module, it is found that the existing business module and the intelligent service module communicate through the hypertext transfer protocol (HTTP) protocol for short connection. Secondly, the intelligent service module accesses each business module in the business system, all of which need to be applied through the open application programming interface (OpenAPI) in the business system.
[0085] Further analysis based on the above content shows that short-connection communication will lead to large communication delays and high resource consumption, and the access to OpenAPI leads to strong coupling between different business modules. The above problems are the reasons why the overall business processing efficiency of the business module decreases after calling the intelligent agent service.
[0086] In order to solve the above-mentioned problems existing in the prior art, an embodiment of the present application provides an intelligent agent service calling method and related equipment for improving the overall business processing efficiency in the scenario where the business module calls the intelligent agent service.
[0087] See also Figure 1 In order to better implement the intelligent agent service calling method of the embodiment of the present application, the embodiment of the present application provides a system framework for intelligent agent service calling, and the system framework includes: at least one business module 101 and an intelligent agent service module 102, each business module 101 can establish a long connection with the intelligent agent service module 102 to achieve two-way communication, and the intelligent agent service module 102 can return corresponding processing information to the business module through the communication interface deployed in each business module 101. The introduction of the long connection communication method of the present application solves the problems of large communication delay between the business module 101 and the intelligent agent service module 102, and large resource consumption of the intelligent agent service module 102. By establishing a long connection, the business module 101 and the intelligent agent service module 102 can actively send data to each other, thereby decoupling the dependence of the intelligent agent service module 102 on the OpenAPI application.
[0088] Among them, the business module 101 of the present application can be a module that implements a certain business function in a business system and / or an application in the business system. If the business system referred to in the embodiment of the present application is a large enterprise cloud service platform implemented by platform as a service (PAAS), then the business modules 101 included in the business system can be, but are not limited to: artificial intelligence (AI) capability center or generative pre-trained transformer model (GPT) development platform and other applications.
[0089] The agent service module of the present application is used to provide agent services. The agent service module of the present application can provide services through at least one agent. Moreover, each agent providing services can be deployed as a whole in the agent service module, or as Figure 1 Only the agent framework of each agent is deployed in the agent module shown, while the agent operation information of each agent is deployed in the business system, as detailed in the embodiments described below. In addition, each agent providing services in the embodiments of the present application can correspond to the business identifier of at least one business module or the user identifier of at least one user, that is, it can only be called through the business indication information of the corresponding business module or the user indication information of the user. Among them, the business indication information may include but is not limited to the business identifier and / or the business name, and the user indication information may include but is not limited to the user identifier and / or the user name.
[0090] In addition, it should be noted that the business module 101 and the intelligent service module 102 can be deployed on the same physical device or different physical devices respectively. The physical devices may include but are not limited to independent servers, server clusters consisting of multiple servers, various personal computers, laptops, smart phones, tablet computers and portable wearable devices, etc.
[0091] Based on the above system architecture, please refer to Figure 2 The embodiment of the present application provides an intelligent agent service calling method, which is applied to a business module and / or an intelligent agent service module, and includes the following steps:
[0092] 201. If an intelligent agent service request is obtained, the business module sends a handshake request to the intelligent agent service module.
[0093] When the business module obtains the agent service request, it means that the current business module has the need to call the agent service. The premise of implementing the agent service call is to establish a communication connection with the agent service module. Therefore, if the agent service request is obtained, the business module needs to send a handshake request to the agent service module, which is used to request to establish a communication connection between the business module and the agent service module.
[0094] Among them, the intelligent agent service request may be triggered by the user operation when the user accesses the session function of the business module (that is, the business module passively calls the intelligent agent service), or it may be automatically triggered when the business module performs related operations (that is, the business module actively calls the intelligent agent service). Specifically, the intelligent agent service request may be a request obtained when the business module actively or passively calls the intelligent agent service in any scenario. The request may be generated by the user end and sent to the business module, or generated by the business module itself, and this embodiment does not make specific limitations.
[0095] 202. The intelligent agent service module sends a handshake response to the business module according to the handshake request sent by the business module, and determines to establish a long connection between the intelligent agent service module and the business module.
[0096] The establishment of a communication connection requires confirmation from both communicating parties. Therefore, after receiving a handshake request sent by the business module, the intelligent body service module also needs to send a handshake response to the business module to indicate that it agrees to establish a communication connection with the business module. It is understandable that the establishment of a communication connection requires the knowledge of both parties. For the intelligent body service module, the establishment of a communication connection with the business module is determined based on the handshake response. This can be after generating a handshake response, or at a time point such as sending a handshake response to the business module to determine the establishment of a long connection. Similarly, the business module also needs to determine that the intelligent body service module agrees to establish a communication connection with itself based on the handshake response sent by the intelligent body service module, that is, to determine the establishment of a communication connection between the intelligent body service module and the business module. This will not be repeated here.
[0097] In the embodiment of the present application, in order to ensure the overall business processing efficiency, it is necessary to establish a long connection between the business module and the intelligent body service module. A long connection means that multiple data packets can be sent continuously on a connection. During the period when the connection is maintained, if no data packet is sent, both parties need to send link detection packets (such as heartbeat packets) to maintain the connection state. In the field of communications, long connection is an important communication method, which refers to a persistent connection established between a client and a server. Once this connection is established, it can remain active for a long time, allowing both parties to send and receive data at any time without re-establishing the connection each time. In the long connection of the present application, the business module is equivalent to the client, and the intelligent body service module is equivalent to the server.
[0098] 203. The business module sends an intelligent agent service request to the intelligent agent service module under a long connection.
[0099] According to the above embodiments, after a long connection is established between the business module and the intelligent body service module, the intelligent body service module can actively send data to the business module at any time. Compared with the communication method of the prior art short connection, in which a connection is established only when data needs to be sent and the connection is disconnected after the data is sent, the communication method adopted in the embodiment of the present application has better communication efficiency for the intelligent body service module that needs to interact with the business module for data multiple times, thereby contributing to the improvement of overall business efficiency.
[0100] Generally speaking, the conditions for achieving long connection communication include at least: 1. Both parties involved in the communication connection support long connection; 2. The management method of the communication connection meets the requirements of long connection; 3. A protocol that supports long connection is used for data interaction. Therefore, on the basis of meeting the first two conditions, each data packet sent by the business module and the intelligent service module under the long connection in this application needs to be implemented using a protocol that supports long connection, such as the WebSocket protocol, the transmission control protocol (TCP) protocol, and the server-sent events (SSE) protocol.
[0101] Among them, the WebSocket protocol and the TCP protocol support full-duplex communication, that is, the communicating parties (the business module and the intelligent agent service module in this application) can send and receive data at any time and simultaneously. The SSE protocol does not support full-duplex communication. The SSE protocol is used for the server to actively push data to the client. After the client establishes a connection with the server, the server can continuously send event streams to the client, and the client automatically receives these events. In other words, the SSE protocol supports a data interaction method in which the client initiates a request and the server continuously pushes data. The specific long connection protocol used in the long connection scenario can be configured as needed, and the embodiments of this application are not limited.
[0102] 204. The intelligent agent service module processes the intelligent agent service request to obtain processing information.
[0103] After the intelligent agent service module receives the intelligent agent service request from the business module, the intelligent agent service module will parse the intelligent agent service request and perform corresponding operations based on the information obtained from the analysis. These operations may involve perception, decision-making and execution functions within the intelligent agent, and even data interaction with other plug-ins, other business modules and other business systems. During and / or after the intelligent agent service module performs the aforementioned corresponding operations, the intelligent agent service module will generate and return processing information of the corresponding operations. The processing information may include processing results or processing status updates, etc. The specific content varies according to the functions of the intelligent agent in the intelligent agent service module and the actual application scenarios, and is not specifically limited here.
[0104] 205. The business module receives the processing information sent by the intelligent agent service module under the long connection, and the processing information is returned through the data interface of the business module.
[0105] According to the aforementioned embodiments, the intelligent agent service module will perform some operations in the process of processing the intelligent agent service request to obtain processing information, and during and / or after performing the aforementioned corresponding operations, the intelligent agent service module will generate and return processing information of the corresponding operations.
[0106] That is, after the business module sends the agent service request to the agent service module, it will receive at least one processing information sent from the agent service module under the long connection. And each returned processing information will be returned through the data interface of the business module.
[0107] In the prior art, the business system provides a standardized interface for external modules that need to access the business module by deploying OpenAPI applications in the system. Specifically, if an external module needs to send data to any business module in the business system, it must be done through the OpenAPI application. As a unified interface processing layer, the OpenAPI application layer is responsible for receiving requests from external modules and forwarding them to the corresponding business modules, thereby achieving access and operation of the business system. Although this method provides a unified access portal, it may also lead to implicit coupling between business modules. At the same time, each data sent by the external module needs to be processed and forwarded by the OpenAPI application, which may add additional delays, which further increases the complexity and time consumption of business processing, thereby affecting the response speed of the business module, and then leading to a decrease in business processing efficiency. In addition, the use of OpenAPI requires third-party application registration, access key generation, authentication strategy selection and other processes, which will further lead to insufficient processing performance.
[0108] Therefore, in order to further improve the efficiency of business processing, the embodiment of the present application directly deploys the data interface of the intelligent service module and other external modules to access the business module in the business module. In this way, after receiving any data sent by the intelligent service module, it will be directly routed to the corresponding business module, rather than uniformly routed to the OpenAPI application, which can effectively solve the problem of reduced business processing efficiency caused by strong coupling between business modules in the prior art. In addition, after removing the OpenAPI application, there is no need to pay for the service, which reduces the deployment and implementation costs of the intelligent service module. Among them, the external module refers to a functional module or application that is not deployed in the business system.
[0109] Based on the above content, it can be known that the embodiment of the present application adopts a long connection protocol to establish a long connection between the business module and the intelligent body service module, so that the business module and the intelligent body service module do not need to be disconnected frequently, and have stronger real-time communication. At the same time, the embodiment of the present application also directly deploys the data interface for the intelligent body service module to access the business module in the business module, which reduces the coupling between business modules and helps to improve the efficiency of data interaction. In summary, the embodiment of the present application realizes efficient two-way communication between the business module and the intelligent body service module by introducing a long connection protocol and a data interface deployed in the business module, which helps to improve the overall business processing efficiency.
[0110] It is understandable that different agents have different processing methods, and thus different processing information can be output based on the same agent service request. As described in the above embodiments, in order to provide more diverse agent call services, the agent service module of the present application can deploy multiple agents, and the multiple agents are not exactly the same.
[0111] In some specific embodiments, the deployment method of the agent in the embodiment of the present application is to deploy the agent framework and the agent operation information separately. Before obtaining the agent service request, the method of the embodiment of the present application also includes: the business module obtains the session information requesting to call the agent service and the agent operation information associated with the session information; the business module generates the agent service request; the agent service module constructs the agent according to any agent framework and the agent operation information; the agent service module obtains processing information based on the agent processing session information.
[0112] First, the difference between different agent frameworks lies in their different strategies or processes for processing requests. Therefore, the selection of agent frameworks needs to be evaluated and determined based on specific needs and application scenarios. Secondly, the implementation of the agent does not only rely on the agent framework. The agent framework in the agent service module also needs to be combined with multiple parameters (i.e., agent operation information) to form a complete and usable agent. The parameters in the agent operation information include but are not limited to: at least one of the following: guide words, number of historical messages, scope of use, knowledge base, prompt words, decision strategy, environment configuration, called plug-ins and external modules, large language models used, training and reasoning settings, and feedback mechanisms. The agent operation information of different agent frameworks may contain the same or different parameters. Among them, the introductory language refers to the message sent to the user before the agent service request is processed after the user sends a session to call the agent service in the session interface. For example, if the user sends a session about weather query, the introductory language can be: "I am a weather query assistant, you can ask me about the weather conditions anywhere"; the number of historical messages included means: the total number of historical messages that the agent obtains in each agent service call request to interact with the business module; the scope of use includes: effective business, the specific function of this parameter is to limit the business that can call the agent. For example, only when the user initiates a session in any preset effective business in the business system, the agent service module will use the agent to process the message sent by the user, otherwise the agent service module will hand over the message sent by the user to the regular intelligent question and answer customer service for processing.
[0113] In a specific embodiment, the content required to be included in the intelligent agent operation information can be configured by the user as needed or set by the developer by default during the development stage, and the embodiment of the present application is not limited thereto.
[0114] Finally, the session information in the agent service request of the embodiment of the present application can be any session message indicating the content to be processed by the agent service module, such as the operation to be executed or the question to be processed. For example, when the agent service request is triggered by the user operation when the user accesses the session function of the business module, the session information can be the message entered or sent by the user in the session interface.
[0115] In summary, based on the agent operation information in the agent service request and any agent framework deployed in the agent service module, an available agent can be constructed, and the agent can be used to process the aforementioned session information and obtain corresponding processing information.
[0116] In the embodiment of the present application, the agent service module is implemented as a stateless service, and all agent operation information is deployed in the business system or business module, which is convenient for implementing multi-agent framework deployment in the agent service module, and is convenient for the agent service module to utilize the existing business functions or tools in the business system. The existing business functions or tools in the general business system include but are not limited to databases, file services, log services, and Kubernetes clusters, etc., which are deployed in the business system and required by the agent service module.
[0117] It should be noted that the above embodiments only describe the technical solution of the agent service module using the agent to process the agent service request when the agent framework and the agent operation information are deployed separately. However, the above embodiments also mention the technical solution of each agent being deployed as a whole in the agent service module. In this case, the agent service module is deployed with a complete agent, that is, the agent service request does not need to include the agent operation information, because the agent operation information already exists in the agent of the agent service module.
[0118] It is also possible that the fixed operation information in the agent operation information and the agent framework are deployed in the agent service module, and the non-fixed operation information in the agent operation information can be deployed in the business module, that is, the agent service request needs to include non-fixed operation information. The embodiment of the present application does not impose any restrictions on the deployment method of the agent. In a session scenario, the agent service request is usually triggered by a user. In this way, the non-fixed operation information deployed in the business module can be selected or configured by the user to enhance the flexibility of the solution. Among them, fixed operation information refers to operation information that remains consistent or changes less in different business modules and / or different requests, such as prompts, decision strategies, and environmental configurations; non-fixed operation information refers to different or more variable operation information in different business modules and / or different requests, such as called plug-ins and external modules and large language models used.
[0119] In practical applications, the agent service module of this application can be implemented by any technical means that can implement the aforementioned technical solutions and achieve the aforementioned corresponding technical effects. For example, the deployment of the agent in the embodiment of this application can be implemented using Kubernetes technology. For details, please refer to Figure 3, the agent service module deploys n Services (i.e. services, which can be considered as service submodules). Multiple identical Pod instances can be redundantly deployed under each Servic. Each Pod instance is deployed with all the data required for the deployment of the corresponding agent in the agent service module. Each Pod instance can include 1. Agent; 2. Agent framework; 3. Agent framework and fixed operation information, which are not specifically limited here. Among them, each Service is used to manage and coordinate the access and communication of all internal Pods. Pod is the smallest deployable unit in Kubernetes, consisting of one or more containers that share network and storage resources. When receiving external requests (including but not limited to data sent by business modules, such as agent service requests and data acquisition services), Ingress in Kubernetes routes the external request to the internal Service through path (i.e. path), so that different external requests are processed by Pods deployed under different Services. Among them, Ingress (i.e. interface or entry) can be considered as an API object in Kubernetes, located at the outermost layer of the entire architecture.
[0120] It should be noted that the routing of external requests to specific internal services by Ingress can depend on the path in the request, such as recording the path of the data deployed by the corresponding agent in the agent service module in the indication information of the agent service request. The indication information includes but is not limited to the framework indication information and the agent indication information.
[0121] Through this architectural design, the intelligent service module can ensure the stability and high availability of each service sub-module, and each Pod instance in the service sub-module can independently bear the corresponding workload, thereby realizing the efficient operation and scalability of the intelligent service module to ensure the overall business processing efficiency.
[0122] Furthermore, considering that different agents are suitable for processing different operations to be executed or questions to be processed, in order to adapt to different needs, the agent service module of this embodiment provides multiple agents. The following takes the independent deployment scenario of the agent framework and the agent operation information as an example to illustrate how to accurately call a specific agent framework in the agent service module. In some specific implementations, the agent service request of this embodiment also includes framework indication information, so that the agent service module can accurately obtain the framework indication information from the agent service request, and determine any agent framework that matches the framework indication information from multiple agent frameworks based on the framework indication information in the agent service request. For example, each agent framework in the agent service module can expose an access path to the outside, and route the agent service request to the specified agent service framework through the access path. The framework indication information is the access path of the corresponding agent framework.
[0123] It can be understood that if other deployment schemes of the intelligent agents mentioned in the above embodiments are adopted, the intelligent agent service request should also include intelligent agent indication information to instruct the intelligent agent service module to accurately determine any intelligent agent that matches the intelligent agent indication information from multiple intelligent agents and process the intelligent call request based on it.
[0124] In summary, no matter what method is used to deploy the intelligent agent, the intelligent agent service module needs to determine an intelligent agent that can be run based on the indication information and the data in the intelligent agent service module before processing the intelligent agent service request. In particular, if the data in the intelligent agent service module only includes fixed operation information and the intelligent agent framework, it is also necessary to call the non-fixed operation information from the intelligent agent service request to obtain an intelligent agent that can be run. Specifically, corresponding indication information can be configured for each business module, so that the indication information in the intelligent agent service request can be determined based on the business module that sends the intelligent agent service request; or, it can also be done by Figure 4 The agent list interface shown displays the instruction information and / or operation information of different agents, and after the user selects any agent from the agent list interface, the instruction information of the agent is recorded in the agent service request so that the agent service module can accurately call the corresponding agent.
[0125] It can be understood that in order to realize the process and steps based on the agent service request in the above-mentioned embodiment, the agent service request in the embodiment of the present application contains a business parameter field and a public parameter field, wherein the business parameter field contains the parameter value of at least one business parameter, and the public parameter field contains the parameter value of at least one public parameter. Public parameters refer to parameters contained in each agent service request, such as operation type parameters, request identification parameters, and agent version parameters, etc. Business parameters refer to different parameters contained in different agent service requests, such as specific business parameters in different business modules or specific business parameters required for the operation of different agents (or agent frameworks). In other words, an agent service request usually contains parameter values of multiple parameters, and each parameter can be judged whether it belongs to a public parameter based on whether its corresponding parameter value needs to exist in all agent service requests. Generally, if the parameter value corresponding to a parameter needs to appear in all agent service requests, it means that the parameter belongs to a public parameter; otherwise, it means that the parameter does not belong to a public parameter.
[0126] Among them, the above-mentioned business parameters and public parameters can be any data type that can be parsed by the business module and the intelligent agent service module, including but not limited to JSONObject, Object, and String.
[0127] Based on the above embodiments, in practical applications, the business module can also provide users or developers with Figure 5 The agent framework registration interface shown in the figure can be used to register an agent framework after a new agent framework is deployed in the agent service module. Figure 5 In the interface shown in the figure, the corresponding agent framework is registered in the business module. Figure 5 In the framework registration interface shown, the registration information of the agent service module can also be recorded or stored in the business module in other ways, which can be configured as needed. Among them, the registration information at least includes framework indication information (such as framework name and / or framework identifier) and the framework path information of the agent framework in the agent service module. In addition to the aforementioned information, the registration information can also include the default language model of the agent framework, the default model style of the default language model, etc., which can be configured as needed. It should be noted that the fixed parameters of a certain agent framework in the agent operation information can be pre-configured as the registration information of the agent framework.
[0128] In some other implementations, the intelligent agent service request of the embodiment of the present application includes plug-in information, that is, the intelligent agent needs to call the corresponding plug-in for data-assisted decision-making during operation. Specifically, the intelligent agent service module processes the intelligent agent service request to obtain processing information, including: if the intelligent agent service request contains plug-in information, the intelligent agent service module determines the request data item to be obtained, and the intelligent agent service module generates a data acquisition request and uses the data acquisition request as processing information, the data acquisition request includes plug-in information and request data items; the intelligent agent service module sends processing information to the business module under a long connection, including: the intelligent agent service module sends a data acquisition request to the business module under a long connection; the business module locally searches for the authentication key corresponding to the plug-in information, and the business module also sends the request data item and the authentication key to the plug-in indicated by the plug-in information, and receives the value of the request data item returned after the plug-in obtains the authentication key; finally, the intelligent agent service module receives the value of the request data item sent by the business module under the long connection.
[0129] In the existing technical solution, users can access different external plug-ins (or external tools) through the authentication keys deployed in the business system to meet the diverse needs of users. At the same time, in order to meet the needs of calling the aforementioned external plug-ins in the process of intelligent agent operation decision-making, the business system will pass the authentication key of the corresponding plug-in to the intelligent agent service module, and the intelligent agent service module will first obtain the required data from the external plug-in. This way of calling an external plug-in requires the transmission of the authentication key between the intelligent agent service module and the business module, which may lead to the leakage of the authentication key, and the cumbersome calling process will reduce the overall business processing efficiency after calling the plug-in.
[0130] In order to solve the above technical problems, the embodiment of the present application migrates the step of calling the intelligent agent to the business system or business module to reduce the concurrency pressure of the intelligent agent service module. Specifically, when the intelligent agent service module recognizes that the intelligent agent service request contains plug-in information, it means that the processing process of the intelligent agent service request needs to use the plug-in. At the same time, considering that the data interaction with the plug-in is completed by the business module, the intelligent agent service module will determine the request data item that needs the plug-in to obtain the specific value according to the intelligent agent service request, and package the request data item and the plug-in information into a data acquisition request and send it to the business module (which can also be a business system). Subsequently, the business module can find the corresponding authentication key from the local according to the plug-in information, and send the authentication key and the request data item to the plug-in indicated by the plug-in information. After receiving the required authentication key, the plug-in will think that the business module has the authority to obtain the value of the request data item, so it will return the value of the request data item to the business module. Finally, the business module will send the value of each request data item in the aforementioned data acquisition request to the intelligent agent service module under a long connection to ensure the smooth operation of the subsequent process of the intelligent agent.
[0131] Among them, packaging the request data items and plug-in information into a data acquisition request can be directly splicing the request data items and plug-in information together as a data acquisition request; or, processing the request data items and plug-in information according to a preset format, and then assembling the processed request data items and the processed plug-in information into a data acquisition request that can be parsed by the business module.
[0132] In addition, in addition to the request data items, the data acquisition request may also include the plug-in interface specification of the plug-in to help the business module (or business system) send authentication keys and request data items based on the corresponding plug-in interface specification to ensure that the plug-in can effectively parse the data sent by the business module.
[0133] In the embodiment of the present application, the transmission of the authentication key in the network during the plug-in calling process is avoided, thereby improving the security of the plug-in calling.
[0134] It should be noted that in some specific implementations, when the agent service request of the business module is triggered by a session sent by the user in the conversation interface, the business module in the embodiment of the present application can create a long connection when the user initiates a round of conversation, and send a handshake request including at least a session identifier and a business identifier to the agent service module. In addition, after the agent service module returns all the processing information of the agent service request corresponding to this round of conversation, the business module or the agent service module destroys the long connection supporting this round of conversation, thereby reducing the delay caused by frequent establishment and closing of connections in the operation process of the agent service module (including communication processes such as execution, execution steps, and thinking processes). Alternatively, in the case of sufficient communication resources, the long connection between the business module and the agent service module does not need to be bound to each round of conversation, but is continuously established until the destruction condition is met. Among them, the destruction condition includes: the user exits the conversation interface, or after no data transmission is sent in the long connection for a period of time, etc., it can be determined that the business module will not call the agent service at a preset time and / or the communication resources of either party (the business module and the agent service module) meet the insufficient condition, which is not limited in this embodiment.
[0135] In addition, the handshake request may also include the port number of the business module and the aforementioned indication information (including agent indication information and framework indication information), which are not specifically limited here.
[0136] See also Figure 6 The third aspect of the embodiment of the present application provides a service module, including:
[0137] The acquisition unit 601 is used to send a handshake request to the agent service module if an agent service request is acquired;
[0138] A determination unit 602, configured to determine, based on a handshake response sent by the agent service module, to establish a long connection between the business module and the agent service module;
[0139] The sending unit 603 is used to send an agent service request to the agent service module under the long connection, and the agent service module is used to process the agent service request to obtain processing information;
[0140] The receiving unit 604 is used to receive the processing information sent by the intelligent agent service module under the long connection, and the processing information is returned through the data interface of the business module.
[0141] In a specific implementation, the agent service module includes at least one agent framework. Before obtaining the agent service request, the obtaining unit 601 is further used to obtain the session information of the request to call the agent service and the agent operation information associated with the session information;
[0142] The business module also includes: a generation unit;
[0143] The generation unit is used to generate an agent service request, which includes agent operation information and session information. The agent service module is specifically used to process the session information to obtain processing information based on an agent constructed according to any agent framework and agent operation information.
[0144] In a specific implementation, the agent service module includes multiple agent frameworks, the agent service request also includes framework indication information, and the agent service module is further used to determine any agent framework from the multiple agent frameworks according to the framework indication information.
[0145] In a specific implementation, the agent service request includes plug-in information, and the receiving unit 604 is specifically used to receive a data acquisition request sent by the agent service module under a long connection, and the data acquisition request includes the plug-in information and the request data item;
[0146] The business module also includes: a search unit;
[0147] A search unit, used to search locally for an authentication key corresponding to the plug-in information;
[0148] The sending unit 603 is further used to send the request data item and the authentication key to the plug-in indicated by the plug-in information;
[0149] The receiving unit 604 is further used to receive the value of the request data item returned by the plug-in after obtaining the authentication key;
[0150] The sending unit 603 is also used to send the value of the requested data item to the intelligent agent service module under the long connection.
[0151] See also Figure 7 According to a fourth aspect of the present application, an intelligent agent service module is provided, including:
[0152] The sending unit 701 is used to send a handshake response to the business module according to the handshake request sent by the business module, and determine to establish a long connection between the agent service module and the business module;
[0153] The receiving unit 702 is used to receive the agent service request sent by the business module under the long connection;
[0154] Processing unit 703, used for processing agent service request to obtain processing information;
[0155] The sending unit 701 is also used to send processing information to the business module under the long connection, and the processing information is sent through the data interface of the business module.
[0156] In a specific implementation, the agent service module includes at least one agent framework, the agent service request includes session information requesting to call the agent service and agent operation information associated with the session information, and the processing unit 703 is specifically used to form an agent according to any agent framework and agent operation information;
[0157] Processing information is obtained based on the agent processing session information.
[0158] In a specific implementation, the agent service module includes a plurality of agent frameworks, and before forming an agent according to any agent framework and agent operation information, the service module further includes: an acquisition unit and a determination unit;
[0159] An acquisition unit, used for acquiring framework indication information from an agent service request;
[0160] The determination unit is used to determine any agent framework from multiple agent frameworks based on the framework indication information.
[0161] In a specific implementation, the processing unit 703 is specifically configured to determine the request data item to be obtained if the agent service request includes the plug-in information; generate a data acquisition request and use the data acquisition request as the processing information, wherein the data acquisition request includes the plug-in information and the request data item;
[0162] The sending unit 701 is specifically used to send the plug-in interface specification to the business module under the long connection, the business module is used to send the data acquisition request to the business module under the long connection, the business module is used to search the authentication key corresponding to the plug-in information locally, and send the request data item and the authentication key to the plug-in indicated by the plug-in information, and receive the value of the request data item returned after the plug-in obtains the authentication key;
[0163] The sending unit 701 is also used to receive the value of the request data item sent by the business module under the long connection.
[0164] Figure 8 800 is a schematic diagram of a computer device structure provided in an embodiment of the present application. The computer device 800 may include one or more central processing units (CPU) 801 and a memory 805. The memory 805 stores one or more application programs or data.
[0165] The memory 805 may be a volatile storage or a persistent storage. The program stored in the memory 805 may include one or more modules, each of which may include a series of instruction operations in the computer device. Furthermore, the central processing unit 801 may be configured to communicate with the memory 805 and execute a series of instruction operations in the memory 805 on the computer device 800.
[0166] The computer device 800 may also include one or more power supplies 802, one or more wired or wireless network interfaces 803, one or more input and output interfaces 804, and / or one or more operating systems, such as Windows Server 2000 or Windows Server 2003. TM , Mac OS X TM , Unix TM ,Linux TM , FreeBSD TM wait.
[0167] The CPU 801 can execute the aforementioned Figures 1 to 7 The operations performed by the business module or the intelligent agent service module in the illustrated embodiment will not be described in detail here.
[0168] It should be noted that, although the steps in the flowcharts involved in the embodiments are drawn in sequence according to the instructions of the arrows, unless otherwise clearly stated in this document, there is no strict order restriction on the execution of these steps, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the embodiments may include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily sequential, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0169] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0170] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.
[0171] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0172] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0173] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, read-only memory), random access memory (RAM, random access memory), disk or optical disk and other media that can store program code.
[0174] An embodiment of the present application also provides a computer program product comprising instructions, which, when executed on a computer, enables the computer to execute the agent calling method as described above.
Claims
1. A method for calling an intelligent agent service, characterized in that: Applied to business modules, including: If an agent service request is obtained, a handshake request is sent to the agent service module; Based on the handshake response sent by the agent service module, determine to establish a long connection between the business module and the agent service module; Sending the agent service request to the agent service module under the long connection, the agent service module is used to process the agent service request to obtain processing information; The processing information sent by the intelligent agent service module under the long connection is received, and the processing information is returned through the data interface of the business module.
2. The agent service calling method according to claim 1, characterized in that: The agent service module includes at least one agent framework. Before obtaining the agent service request, the method further includes: Obtaining session information requesting to call an agent service and agent operation information associated with the session information; Generate the agent service request, the agent service request includes the agent operation information and the session information, the agent service module is specifically used to process the session information to obtain the processing information according to any agent framework and the agent operation information.
3. The agent service calling method according to claim 2, characterized in that: The agent service module includes multiple agent frameworks, the agent service request also includes framework indication information, and the agent service module is further used to determine any one of the agent frameworks from the multiple agent frameworks according to the framework indication information.
4. The agent service calling method according to any one of claims 1 to 3, characterized in that: The agent service request includes plug-in information, and the receiving of the processing information sent by the agent service module under the long connection includes: Receiving a data acquisition request sent by the agent service module under the long connection, wherein the data acquisition request includes the plug-in information and a request data item; The method further comprises: Searching locally for an authentication key corresponding to the plug-in information; Sending the request data item and the authentication key to the plug-in indicated by the plug-in information; Receiving the value of the request data item returned by the plug-in after obtaining the authentication key; The value of the requested data item is sent to the agent service module under the long connection.
5. A method for calling an intelligent agent service, characterized in that: Applied to the agent service module, including: Sending a handshake response to the business module according to the handshake request sent by the business module, and determining to establish a long connection between the agent service module and the business module; receiving an agent service request sent by the business module under the long connection, and processing the agent service request to obtain processing information; The processing information is sent to the service module under the long connection, and the processing information is sent through the data interface of the service module.
6. The agent service calling method according to claim 5, characterized in that: The agent service module includes at least one agent framework, the agent service request includes session information for requesting to call the agent service and agent operation information associated with the session information, and the processing of the agent service request to obtain processing information includes: Constructing an intelligent agent according to any of the intelligent agent frameworks and the intelligent agent operation information; The processing information is obtained based on the agent processing the session information.
7. The agent service calling method according to claim 6, characterized in that: The agent service module includes a plurality of agent frameworks. Before forming an agent according to any of the agent frameworks and the agent operation information, the method further includes: Obtaining framework indication information from the agent service request; Based on the framework indication information, any one of the agent frameworks is determined from the multiple agent frameworks.
8. The agent service calling method according to any one of claims 5 to 7, characterized in that: The step of processing the agent service request to obtain processing information includes: If the agent service request includes plug-in information, determining the request data item to be obtained; Generate a data acquisition request and use the data acquisition request as the processing information, wherein the data acquisition request includes the plug-in information and the request data item; Sending the processing information to the service module under the long connection includes: Sending the data acquisition request to the business module under the long connection, the business module is used to locally search for the authentication key corresponding to the plug-in information, and send the request data item and the authentication key to the plug-in indicated by the plug-in information, and receive the value of the request data item returned by the plug-in after obtaining the authentication key; The method further comprises: The value of the request data item sent by the business module is received under the long connection.
9. A business module, characterized in that: include: An acquisition unit, configured to send a handshake request to the agent service module if an agent service request is acquired; A determination unit, configured to determine, based on the handshake response sent by the agent service module, to establish a long connection between the business module and the agent service module; A sending unit, used for sending the agent service request to the agent service module under the long connection, and the agent service module is used for processing the agent service request to obtain processing information; A receiving unit is used to receive the processing information sent by the intelligent agent service module under the long connection, and the processing information is returned through the data interface of the business module.
10. An intelligent agent service module, characterized in that: include: A sending unit, configured to send a handshake response to the business module according to the handshake request sent by the business module, and determine to establish a long connection between the agent service module and the business module; A receiving unit, used to receive an agent service request sent by the business module under the long connection; A processing unit, used for processing the agent service request to obtain processing information; The sending unit is further used to send the processing information to the service module under the long connection, and the processing information is sent through the data interface of the service module.
11. A computer device, characterized in that: include: CPU, memory and input / output interface; The memory is a short-term storage memory or a persistent storage memory; The central processing unit is configured to communicate with the memory and execute instruction operations in the memory to perform the intelligent agent service calling method described in any one of claims 1 to 4 or 5 to 8.
12. A computer program product comprising instructions, characterized in that When the computer program product runs on a computer, the computer is enabled to execute the intelligent agent service calling method according to any one of claims 1 to 4 or 5 to 8.
13. A computer storage medium, characterized in that: The computer storage medium stores instructions, and when the instructions are executed on a computer, the computer executes the intelligent agent service calling method as described in any one of claims 1 to 4 or 5 to 8.
Citation Information
Cited By
Intelligent agent platform plug-in debugging method and equipment based on cloud native and medium
CN120909668A