Artificial intelligence multi-agent control methods, systems and computing devices

CN122578593APending Publication Date: 2026-08-14BEIJING PARATERA TECH +1
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-06-12
Publication Date
2026-08-14

AI Technical Summary

Technical Problem

[0004]为此,本发明提供一种人工智能多智能体控制方法及人工智能多智能体控制系统,以解决或至少缓解上面存在的问题

Benefits of technology

[0024]根据本发明的技术方案,提供了一种人工智能多智能体控制方法,控制端根据用户登录信息确定用户对应的租户、智能体名称以及用户角色,并与租户对应的人工智能网关建立 WebSocket 连接,基于智能体名称生成会话键,并基于会话键向所述人工智能网关发送聊天请求,人工智能网关可以将聊天请求转发至智能体名称对应的目标智能体进行处理并返回处理数据,进而,控制端将处理数据分流为多个事件流(助手流式正文、思考流、工具调用流、上下文压缩事件、模型回退事件)并分别进行解析后展示在会话窗口,并且,根据用户角色和智能体名称来向用户展示有权限访问的会话列表。这样,基于租户、用户、智能体和会话键之间的绑定关系,能够实现在多租户、多用户、多智能体环境下进行会话隔离,防止多智能体混淆;通过事件分流处理和展示,能实现流式回复、推理思考、工具调用、上下文压缩、模型回退的过程可观测,提高用户对智能体运行过程的感知;根据用户角色和智能体名称来限制会话访问范围,能够避免多智能体、多会话共存场景下跨智能体越权访问会话。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122578593A_ABST
    Figure CN122578593A_ABST
Patent Text Reader

Abstract

This invention discloses an artificial intelligence multi-agent control method, system, and computing device. The method includes: receiving user login information, determining the user's corresponding tenant, agent name, and user role; establishing a WebSocket connection with the AI ​​gateway corresponding to the tenant; generating a session key based on the agent name, and sending a chat request to the AI ​​gateway based on the session key, so that the AI ​​gateway forwards the chat request to the target agent corresponding to the agent name for processing; receiving the processing data of the target agent on the chat request returned by the AI ​​gateway, splitting the processing data into multiple event streams, parsing the multiple event streams respectively, and displaying them in the corresponding session windows; and displaying the session windows that the user has permission to access according to the user role and agent name. This invention can achieve session isolation in a multi-tenant, multi-user, and multi-agent environment, and can make the processes of streaming replies, reasoning, tool calls, context compression, and model rollback observable.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of artificial intelligence technology, and in particular to an artificial intelligence multi-agent control method, an artificial intelligence multi-agent control system, and a computing device. Background Technology

[0002] With the development of large language models and intelligent agent technology, an artificial intelligence system typically involves multiple intelligent agents, multiple workspaces, multi-turn conversations, tool invocation, context compression, and model rollback control processes. Existing chat control interfaces usually only focus on message input and model response display, lacking in areas such as multi-agent conversation identification, user permission isolation, streaming events and historical fallback coordination, observability of tool invocation processes, disconnection reconnection, and event gap detection. Therefore, how to achieve conversation isolation, event routing, streaming responses and fallback coordination, tool invocation process display, and permission control in multi-tenant, multi-user, and multi-agent environments urgently needs to be addressed.

[0003] Therefore, an artificial intelligence multi-agent control method is needed to solve the problems existing in the above-mentioned technical solutions. Summary of the Invention

[0004] Therefore, the present invention provides an artificial intelligence multi-agent control method and an artificial intelligence multi-agent control system to solve or at least alleviate the problems mentioned above.

[0005] According to one aspect of the present invention, an artificial intelligence multi-agent control method is provided, executed at a control terminal, the method comprising: Receive user login information, and determine the tenant, agent name, and user role corresponding to the user based on the user login information; A WebSocket connection is established with the AI ​​gateway corresponding to the tenant, and the AI ​​gateway communicates with multiple intelligent agents respectively; A conversation key is generated based on the agent name, and a chat request is sent to the AI ​​gateway based on the conversation key, so that the AI ​​gateway forwards the chat request to the target agent corresponding to the agent name in the conversation key for processing; The system receives the processing data of the target intelligent agent on the chat request returned by the artificial intelligence gateway, splits the processing data into multiple event streams, parses the multiple event streams and displays them in the corresponding conversation windows. The multiple event streams include multiple of the following: assistant streaming text, thought stream, tool call stream, context compression event, and model rollback event. Based on the user's corresponding user role and agent name, display one or more session windows that the user has permission to access.

[0006] Optionally, in the AI ​​multi-agent control method according to the present invention, the chat request has a corresponding run identifier and request number; the AI ​​gateway is adapted to receive the response result and processing data of the chat request returned by the target agent, and encapsulate the response result and processing data into response frames and event frames respectively; receiving the processing data of the target agent on the chat request returned by the AI ​​gateway includes: receiving the response frame and event frame returned by the AI ​​gateway; splitting the processing data into multiple event streams, parsing the multiple event streams respectively and displaying them in the corresponding session windows, including: filtering the event frames based on the session key and run identifier corresponding to the chat request to retain valid event frames consistent with the session key and run identifier; splitting the valid event frames into multiple event streams, parsing the multiple event streams respectively and displaying them in the corresponding session windows.

[0007] Optionally, the AI ​​multi-agent control method according to the present invention further includes: writing the chat request and the corresponding request number into a pending request table; when a response frame returned by the AI ​​gateway is received, searching for the corresponding chat request in the pending request table based on the request number carried in the response frame; if the response frame indicates that the chat request was successfully responded to, obtaining the response result from the response frame and displaying it in the corresponding session window; if the response frame indicates that the chat request failed to respond, obtaining the error code and error message from the response frame, generating an exception prompt message based on the error code and error message, and displaying it in the corresponding session window; if the response frame indicates that the chat request timed out, removing the chat request from the pending request table.

[0008] Optionally, the artificial intelligence multi-agent control method according to the present invention further includes: when an event frame returned by the artificial intelligence gateway is received, obtaining the event sequence number in the event frame; if the event sequence number is not continuous with the previous event sequence number in the previous event frame, generating an event missing prompt message and displaying it in the corresponding session window.

[0009] Optionally, in the AI ​​multi-agent control method according to the present invention, displaying one or more session windows that the user has permission to access based on the user role and agent name corresponding to the user includes: if the user role is an administrator, then displaying multiple session windows corresponding to the multiple agents to the user; if the user role is a regular user, then displaying a session window corresponding to a session key containing the agent name corresponding to the user to the user.

[0010] Optionally, in the AI ​​multi-agent control method according to the present invention, the processed data is split into multiple event streams, and the multiple event streams are parsed and displayed in corresponding session windows, including: if the multiple event streams include assistant streaming text, then the reply content in the assistant streaming text is incrementally rendered to generate assistant reply messages in real time and display them in the corresponding session window; if no processed data including the assistant streaming text is received within a preset time, then the historical interface is called to poll and obtain historical assistant reply messages and display them in the session window.

[0011] Optionally, in the AI ​​multi-agent control method according to the present invention, calling the history interface to poll and obtain historical assistant reply messages and display them in the session window includes: determining the maximum timestamp of the assistant reply messages already displayed in the session window; calling the history interface to obtain session history data, filtering out historical assistant reply messages with timestamps later than the maximum timestamp from the session history data; determining whether the historical assistant reply messages are equivalent to the displayed assistant reply messages, and if they are not equivalent, displaying the historical assistant reply messages in the session window.

[0012] Optionally, in the AI ​​multi-agent control method according to the present invention, parsing and displaying multiple event streams in corresponding session windows includes: for the tool call stream, generating tool call stream entries based on tool call identifiers in the tool call stream; when the tool call event in the tool call stream is in the start stage, recording the tool name and parameters in the tool call stream entry; when the tool call event is in the update stage, recording the update result of the tool call event in the tool call stream entry; when the tool call event is in the result stage, recording the final result of the tool call event in the tool call stream entry; converting the tool call stream entries into collapsible tool call messages and displaying them in the corresponding session windows; for the thought stream, extracting reasoning and thinking content from the thought stream, and displaying the reasoning and thinking content... The front-end state data corresponding to the assistant's streaming text is separated; whether to render the reasoning content is determined based on the thinking content display switch; if so, the reasoning content is rendered and displayed in the corresponding session window; for the context compression event, when the context compression event is in the start state, the compression in progress state is displayed in the corresponding session window; when the context compression event is in the end state, the compression completed state is displayed in the corresponding session window, and the compression completed state is cleared after a predetermined duration; for the model rollback event, the selected model, the effective model, the previous effective model, the rollback reason, and the rollback attempt summary are parsed from the model rollback event and displayed as the model rollback status in the corresponding session window; when a model rollback clearing event is detected, the model rollback cleared status is displayed in the session window.

[0013] Optionally, in the AI ​​multi-agent control method according to the present invention, the session key includes a main session key or a new session key, wherein the main session key includes the agent name and main session identifier corresponding to the user, and the new session key includes the agent name, timestamp and random suffix corresponding to the user.

[0014] Optionally, in the AI ​​multi-agent control method according to the present invention, sending a chat request to the AI ​​gateway based on the session key includes: sending the session key to the AI ​​gateway so that the AI ​​gateway establishes a session between the user and the target agent based on the session key; and sending a chat request to the AI ​​gateway based on the session corresponding to the session key.

[0015] Optionally, in the AI ​​multi-agent control method according to the present invention, the control terminal is communicatively connected to a storage device, the storage device including a tenant table and a user table; determining the tenant, agent name, and user role corresponding to the user based on the user login information includes: after verifying the user login information, obtaining the tenant identifier, agent name, and user role corresponding to the user from the user table based on the user login information; and obtaining the corresponding AI gateway address from the tenant table based on the tenant identifier.

[0016] Optionally, in the AI ​​multi-agent control method according to the present invention, establishing a WebSocket connection with the AI ​​gateway corresponding to the tenant includes: sending a WebSocket connection request carrying request parameters to the AI ​​gateway corresponding to the tenant based on the address of the AI ​​gateway corresponding to the tenant, wherein the request parameters include the instance identifier of the control terminal, the protocol version range, the user role, the permission range, and the authentication information; and establishing a WebSocket connection with the AI ​​gateway when the connection confirmation information returned by the AI ​​gateway after verifying the request parameters is received.

[0017] Optionally, in the AI ​​multi-agent control method according to the present invention, when an abnormality or disconnection of the WebSocket connection with the AI ​​gateway is detected, a WebSocket connection request carrying request parameters is resent to the AI ​​gateway corresponding to the tenant in order to re-establish the WebSocket connection with the AI ​​gateway.

[0018] Optionally, in the AI ​​multi-agent control method according to the present invention, the event frame includes chat events and agent events; the chat events include assistant reply incremental status, assistant reply completed status, chat request terminated status, or chat request processing failed status; the agent events include multiple of the following: assistant streaming text, thought stream, tool call stream, context compression event, agent lifecycle event, and model rollback event.

[0019] Optionally, in the AI ​​multi-agent control method according to the present invention, sending a chat request to the AI ​​gateway based on the session key includes: receiving a question input by a user, wherein if the question information contains an image file, the binary data in the image file is converted into a base64 string and an image content block is constructed; constructing a chat request based on the question text in the question information and / or the image content block corresponding to the image file, and sending the chat request to the AI ​​gateway based on the session key.

[0020] According to one aspect of the present invention, an artificial intelligence multi-agent control system is provided, comprising: An AI gateway that communicates and connects with multiple intelligent agents; The control terminal is equipped with a control device adapted to perform the method described above, the control device comprising: The tenant user management module is adapted to receive user login information and determine the tenant, agent name and user role corresponding to the user based on the user login information. The gateway connection module is adapted to establish a WebSocket connection with the artificial intelligence gateway corresponding to the tenant, and the artificial intelligence gateway communicates with multiple intelligent agents respectively; The session control module is adapted to generate a session key based on the agent name, and send a chat request to the artificial intelligence gateway based on the session key, so that the artificial intelligence gateway forwards the chat request to the target agent corresponding to the agent name in the session key for processing; The event splitting and display module is adapted to receive the processing data of the target intelligent agent on the chat request returned by the artificial intelligence gateway, split the processing data into multiple event streams, parse the multiple event streams respectively and display them in the corresponding conversation window, wherein the multiple event streams include multiple of the following: assistant streaming text, thought stream, tool call stream, context compression event, and model rollback event; The access control module is adapted to display one or more session windows that the user has permission to access, based on the user role and agent name corresponding to the user.

[0021] According to one aspect of the present invention, a computing device is provided, comprising: at least one processor; and a memory storing program instructions, wherein the program instructions are configured to be executed by the at least one processor, the program instructions including instructions for performing the artificial intelligence multi-agent control method as described above.

[0022] According to one aspect of the present invention, a computer program product is provided, comprising computer program instructions, wherein the computer program instructions, when executed by a processor, implement the method as described above.

[0023] According to one aspect of the present invention, a readable storage medium storing program instructions is provided, which, when read and executed by a computing device, causes the computing device to perform the artificial intelligence multi-agent control method as described above.

[0024] According to the technical solution of the present invention, an artificial intelligence multi-agent control method is provided. The control terminal determines the user's corresponding tenant, agent name, and user role based on the user's login information, and establishes a WebSocket connection with the artificial intelligence gateway corresponding to the tenant. A session key is generated based on the agent name, and a chat request is sent to the artificial intelligence gateway based on the session key. The artificial intelligence gateway can forward the chat request to the target agent corresponding to the agent name for processing and return the processed data. Then, the control terminal splits the processed data into multiple event streams (assistant streaming text, thought stream, tool call stream, context compression event, and model rollback event), parses them respectively, and displays them in the session window. Furthermore, the control terminal displays a list of sessions that the user has permission to access based on the user role and agent name. In this way, based on the binding relationship between tenants, users, agents, and session keys, session isolation can be achieved in multi-tenant, multi-user, and multi-agent environments to prevent confusion among multiple agents; through event diversion processing and display, the processes of streaming response, reasoning, tool invocation, context compression, and model rollback can be made observable, improving users' perception of the agent's operation process; restricting the session access scope based on user roles and agent names can avoid unauthorized access to sessions across agents in scenarios where multiple agents and sessions coexist.

[0025] Furthermore, by polling historical assistant replies through the historical interface for compensation, missing assistant streaming messages can be completed, ensuring that the final assistant reply is displayed completely. Moreover, filtering based on timestamps and text equivalence checks can prevent duplicate assistant reply messages from being displayed. Thus, by achieving collaboration between streaming events and historical fallback, the reliability of replies during user-agent conversations can be improved.

[0026] In addition, filtering event frames based on session keys and running identifiers before event routing can prevent event confusion and mutual interference between different sessions.

[0027] Furthermore, since the session key generated based on the agent name includes either a main session key or a new session key, the main session key includes the agent name corresponding to the user and the main session identifier, while the new session key includes the agent name corresponding to the user, a timestamp, and a random suffix. Therefore, when a new session needs to be created, simply switching to the new session key is sufficient to create a new session, eliminating the need to send a session reset command to the AI ​​gateway. This avoids clearing the main session history and allows different topics to be retrieved by date.

[0028] Furthermore, based on event gap detection and disconnection reconnection mechanisms, the stability of the control link can be enhanced.

[0029] The above description is merely an overview of the technical solution of the present invention. In order to better understand the technical means of the present invention and to implement it in accordance with the contents of the specification, and in order to make the above and other objects, features and advantages of the present invention more apparent and understandable, specific embodiments of the present invention are described below. Attached Figure Description

[0030] To achieve the foregoing and related objectives, certain illustrative aspects are described herein in conjunction with the following description and accompanying drawings. These aspects indicate various ways in which the principles disclosed herein may be practiced, and all aspects and their equivalents are intended to fall within the scope of the claimed subject matter. The foregoing and other objectives, features, and advantages of this disclosure will become more apparent from the following detailed description, taken in conjunction with the accompanying drawings. Throughout this disclosure, the same reference numerals generally refer to the same parts or elements.

[0031] Figure 1 A schematic diagram of an artificial intelligence multi-agent control system 100 according to an embodiment of the present invention is shown; Figure 2 A schematic diagram of a computing device 200 provided according to an embodiment of the present invention is shown; Figure 3 A flowchart illustrating an artificial intelligence multi-agent control method 300 provided according to an embodiment of the present invention is shown. Figure 4 A timing diagram of an artificial intelligence multi-agent control method provided according to an embodiment of the present invention is shown. Detailed Implementation

[0032] Exemplary embodiments of the present disclosure will now be described in more detail with reference to the accompanying drawings. While exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be implemented in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.

[0033] For ease of understanding, the terms used in the embodiments of this invention are explained below.

[0034] Intelligent agent: refers to a proxy entity that can perform dialogue, tool invocation, context management, or task processing at the backend of an artificial intelligence gateway.

[0035] Session key: A string identifier used to locate a specific session context for a particular agent.

[0036] Tool call flow: refers to the sequence of start, update, and result events generated when an agent executes external tools or internal capabilities.

[0037] Historical backup: refers to a compensation mechanism that polls the historical interface to obtain the assistant's response when a streaming event does not arrive in time.

[0038] To address the problems existing in current AI control schemes, this invention provides an AI multi-agent control method. First, based on the binding relationship between tenants, users, agents, and session keys, session isolation can be achieved in multi-tenant, multi-user, and multi-agent environments. Second, through event diversion processing and display, the processes of streaming responses, reasoning, tool invocation, context compression, and model rollback can be made observable. Furthermore, session access permissions can be controlled based on user roles and agent names.

[0039] The artificial intelligence multi-agent control method provided by the embodiments of the present invention can be implemented in an artificial intelligence multi-agent control system. The artificial intelligence multi-agent control system of the present invention is described below.

[0040] Figure 1 A schematic diagram of an artificial intelligence multi-agent control system 100 provided according to an embodiment of the present invention is shown.

[0041] like Figure 1 As shown, the AI ​​multi-agent control system 100 includes a control terminal 110, an AI gateway 120, and multiple agents. The AI ​​gateway 120 can communicate and connect with the multiple agents respectively, for example, through a wired or wireless network connection.

[0042] The control terminal 110 can be a user-used terminal device, which can be a personal computer such as a desktop computer or laptop, or a mobile terminal such as a mobile phone, tablet computer, multimedia device, or smart wearable device, but is not limited to these. The control terminal 110 can also be an application program residing in the terminal device.

[0043] In some embodiments, the control terminal 110 can be implemented as a .NET / Blazor Server.

[0044] According to an embodiment of the present invention, the control terminal 110 can receive user login information, determine the user's corresponding tenant, agent name, and user role based on the user login information, and then establish a WebSocket connection with the AI ​​gateway 120 corresponding to the user's tenant. Furthermore, the control terminal 110 can generate a session key based on the user's corresponding agent name and send a chat request to the AI ​​gateway 120 based on the session key. The AI ​​gateway 120 can parse the agent name from the session key and forward the chat request to the target agent corresponding to the agent name for processing. Afterwards, the control terminal 110 can receive the processing data of the target agent on the chat request returned by the AI ​​gateway 120, and can split the processing data into multiple event streams (e.g., assistant streaming text, thought stream, tool call stream, context compression event, model rollback event), parse each event stream, and display them in the corresponding session windows. Moreover, the control terminal 110 can display one or more session windows that the user has permission to access based on the user's corresponding user role and agent name.

[0045] In some embodiments, the control terminal 110 can be communicatively connected to a storage device, which stores a tenant table and a user table. The tenant table can store the AI ​​gateway address, token, and source domain information corresponding to each tenant identifier. The user table can store the tenant identifier, username, email address, password hash, agent name, user role, and activation status corresponding to each user. It can be understood that based on the tenant table and user table, a mapping relationship can be established between multiple tenants, multiple users, and multiple agents, enabling each tenant to be bound to an independent gateway address, token, and source domain, and allowing the determination of the tenant to which each user belongs and the associated agent name.

[0046] In some embodiments, after receiving user login information, the control terminal 110 first verifies the user login information, for example, based on the email address, password hash, and activation status in the user table. After the user login information is successfully verified (login successful), the control terminal 110 can retrieve the user's corresponding tenant identifier (to determine the user's tenant), agent name, and user role from the user table based on the user login information. The range of currently controllable agents can be determined based on the user's corresponding agent name. It can be understood that the user's corresponding tenant identifier is used to identify the user's tenant. The control terminal 110 can also retrieve the corresponding AI gateway address (i.e., the AI ​​gateway address corresponding to the tenant) from the tenant table based on the tenant identifier.

[0047] In some embodiments, the storage device may be implemented as a lightweight SQLite database.

[0048] In some embodiments, OpenClaw Gateway WebSocket can be used as the protocol of AI Gateway 120 to establish a WebSocket connection between Control Terminal 110 and AI Gateway 120.

[0049] In an embodiment of the present invention, the control terminal 110 in the artificial intelligence multi-agent control system 100 is adapted to execute the artificial intelligence multi-agent control method 300. The artificial intelligence multi-agent control method 300 of the present invention will be described in detail below.

[0050] In an embodiment of the present invention, a control device 150 is deployed on the control terminal 110, and the control device 150 can be configured to execute the artificial intelligence multi-agent control method 300 of the present invention.

[0051] like Figure 1 As shown, the control device 150 includes a tenant user management module 151, a gateway connection module 152, a session control module 153, an event routing and display module 154, and an access control module 155, which are coupled in sequence.

[0052] The tenant user management module 151 is used to receive user login information and determine the tenant, agent name and user role corresponding to the user based on the user login information.

[0053] The gateway connection module 152 is used to establish a WebSocket connection with the AI ​​gateway 120 corresponding to the tenant. The AI ​​gateway 120 communicates with multiple smart agents respectively.

[0054] The session control module 153 is used to generate a session key based on the agent name, and send a chat request to the artificial intelligence gateway 120 based on the session key, so that the artificial intelligence gateway 120 forwards the chat request to the target agent corresponding to the agent name in the session key for processing.

[0055] The event splitting and display module 154 is used to receive the processing data of the target intelligent agent for the chat request returned by the artificial intelligence gateway 120, split the processing data into multiple event streams, parse the multiple event streams respectively, and display them in the corresponding conversation window. The multiple event streams include multiple of the following: assistant streaming text, thought stream, tool call stream, context compression event, and model rollback event.

[0056] The access control module 155 is used to display one or more session windows that the user has permission to access, based on the user's corresponding user role and agent name.

[0057] It should be noted that the specific execution logic of the tenant user management module 151, gateway connection module 152, session control module 153, event diversion and display module 154, and permission control module 155 in the control device 150 can be found in the description of steps 310 to 350 in the Artificial Intelligence Multi-Agent Control Method 300 below.

[0058] In some embodiments, the control terminal 110 of the present invention can be implemented as a computing device, so that the artificial intelligence multi-agent control method 300 of the present invention can be executed in the computing device.

[0059] Figure 2 A schematic diagram of a computing device 200 according to an embodiment of the present invention is shown. Figure 2 As shown, in a basic configuration, computing device 200 includes at least one processing unit 202 and system memory 204. According to one aspect, depending on the configuration and type of the computing device, the processing unit 202 may be implemented as a processor. System memory 204 includes, but is not limited to, volatile memory (e.g., random access memory), non-volatile memory (e.g., read-only memory), flash memory, or any combination of such memories. According to one aspect, system memory 204 includes an operating system 205.

[0060] According to one aspect, operating system 205 is, for example, suitable for controlling the operation of computing device 200. Furthermore, examples are practiced in conjunction with graphics libraries, other operating systems, or any other applications, and are not limited to any particular application or system. Figure 2 The basic configuration is illustrated by the components within the dashed lines. According to one aspect, the computing device 200 has additional features or functions. For example, according to one aspect, the computing device 200 includes additional data storage devices (removable and / or non-removable), such as disks, optical discs, or magnetic tapes. This additional storage... Figure 2 The middle part is shown by removable storage device 209 and non-removable storage device 210.

[0061] As stated above, according to one aspect, program module 203 is stored in system memory 204. According to one aspect, program module 203 may include one or more applications. The present invention does not limit the type of application; for example, applications may include: email and contact applications, word processing applications, spreadsheet applications, database applications, slideshow applications, drawing or computer-aided applications, web browser applications, etc.

[0062] In an embodiment of the present invention, program module 203 includes multiple program instructions for executing the artificial intelligence multi-agent control method 300 of the present invention.

[0063] According to one aspect, examples can be practiced on circuits including discrete electronic components, packaged or integrated electronic chips containing logic gates, circuits utilizing microprocessors, or on a single chip containing electronic components or a microprocessor. For example, it can be practiced via wherein... Figure 2 Each or many of the components shown can be implemented as an example by integrating a System-on-a-Chip (SOC) on a single integrated circuit. According to one aspect, such an SOC device may include one or more processing units, graphics units, communication units, system virtualization units, and various application functions, all integrated (or “burned in”) as a single integrated circuit onto a chip substrate. When operating via the SOC, the functions described herein can be operated via dedicated logic integrated on a single integrated circuit (chip) with other components of the computing device 200. Embodiments of the invention can also be implemented using other techniques capable of performing logical operations (e.g., AND, OR, and NOT), including but not limited to mechanical, optical, fluid, and quantum technologies. Additionally, embodiments of the invention can be implemented within a general-purpose computer or in any other circuit or system.

[0064] According to one aspect, computing device 200 may also have one or more input devices 212, such as a keyboard, mouse, pen, voice input device, touch input device, etc. It may also include output devices 214, such as a display, speaker, printer, etc. The foregoing devices are examples and other devices may also be used. Computing device 200 may include one or more communication connections 216 that allow communication with other computing devices 218. Examples of suitable communication connections 216 include, but are not limited to: RF transmitter, receiver and / or transceiver circuitry; Universal Serial Bus (USB), parallel and / or serial ports.

[0065] As used herein, the term computer-readable medium includes computer storage medium. Computer storage medium can include volatile and non-volatile, removable and non-removable media implemented using any method or technology for storing information (e.g., computer-readable instructions, data structures, or program modules). System memory 204, removable storage device 209, and non-removable storage device 210 are examples of computer storage media (i.e., memory storage). Computer storage media can include random access memory (RAM), read-only memory (ROM), electrically erasable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital universal disc (DVD) or other optical storage, magnetic tape, magnetic tape, disk storage or other magnetic storage devices, or any other article of manufacture that can be used to store information and is accessible by computing device 200. According to one aspect, any such computer storage medium can be part of computing device 200. Computer storage media does not include carrier waves or other transmitted data signals.

[0066] According to one aspect, a communication medium is implemented by computer-readable instructions, data structures, program modules, or other data in a modulated data signal (e.g., a carrier wave or other transmission mechanism), and includes any information transmission medium. According to one aspect, the term "modulated data signal" describes a signal having one or more sets of characteristics or altered in a manner that encodes information in the signal. By way of example and not limitation, a communication medium includes wired media such as wired networks or direct wired connections, and wireless media such as acoustic, radio frequency (RF), infrared, and other wireless media.

[0067] In an embodiment of the present invention, a computing device 200 is configured to execute an artificial intelligence multi-agent control method 300. The computing device 200 includes one or more processors and one or more readable storage media storing program instructions that, when configured to be executed by the one or more processors, cause the computing device to execute the artificial intelligence multi-agent control method 300 of the present invention.

[0068] In some embodiments, the computing device that executes the artificial intelligence multi-agent control method 300 in the present invention can be a control terminal 110, that is, the artificial intelligence multi-agent control method 300 can be executed at the control terminal 110.

[0069] Figure 3 A flowchart illustrating an artificial intelligence multi-agent control method 300 provided according to an embodiment of the present invention is shown. Figure 4 A timing diagram of an artificial intelligence multi-agent control method according to an embodiment of the present invention is shown. The following will be combined with... Figure 3 and Figure 4 The artificial intelligence multi-agent control method 300 in the embodiments of the present invention will be described in detail below.

[0070] like Figure 3 As shown, the artificial intelligence multi-agent control method 300 includes the following steps 310-350.

[0071] Step 310: The control terminal 110 can receive user login information and determine the tenant, agent name and user role corresponding to the user based on the user login information.

[0072] It should be noted that the name of the intelligent agent corresponding to the user is the name of the intelligent agent that the user can operate. In some embodiments, user login information may include an account and password, and the account may include, for example, a username or email address.

[0073] In some embodiments, the control terminal 110 can be communicatively connected to a storage device, which stores pre-established tenant and user tables. The tenant table can store the AI ​​gateway address, token, and source domain information corresponding to each tenant identifier. The user table can store the tenant identifier, username, email, password hash, agent name, user role, and activation status corresponding to each user. It is understood that based on the tenant and user tables, mapping relationships between multiple tenants, multiple users, and multiple agents can be established, enabling each tenant to be bound to an independent gateway address, token, and source domain, and allowing the determination of the tenant and associated agent name of each user.

[0074] In some embodiments, in step 310, after receiving the user login information, the control terminal 110 first verifies the user login information, for example, based on the email address, password hash, and activation status in the user table. After the user login information is successfully verified (login successful), the control terminal 110 can retrieve the user's corresponding tenant identifier (to determine the user's tenant), agent name, and user role from the user table based on the user login information. The range of currently controllable agents can be determined based on the user's corresponding agent name. It can be understood that the user's corresponding tenant identifier is used to identify the user's tenant. The control terminal 110 can also retrieve the corresponding AI gateway address (i.e., the AI ​​gateway address corresponding to the tenant) from the tenant table based on the tenant identifier.

[0075] In some embodiments, user roles include administrators or users (regular users). When an administrator initializes a tenant, they can write the tenant's tenant identifier, corresponding AI gateway address, token, and source domain information into the tenant table, and create an administrator account. User (regular user) accounts can be created by invitation from the administrator, and the username can be synchronously used as the name of the corresponding AI agent. An AI agent creation command can be generated based on the AI ​​agent name corresponding to the user.

[0076] Step 320: The control terminal 110 can establish a WebSocket connection with the AI ​​gateway 120 corresponding to the user's tenant. In this embodiment of the invention, the AI ​​gateway 120 can communicate with multiple intelligent agents respectively.

[0077] In some embodiments, the control terminal 110 can obtain the AI ​​gateway address corresponding to the tenant. Specifically, it can obtain the corresponding AI gateway address from the tenant table based on the tenant identifier. Then, it can establish a WebSocket connection with the AI ​​gateway 120 corresponding to the tenant based on the tenant's corresponding AI gateway address.

[0078] In some embodiments, in step 320, the control terminal 110 first sends a WebSocket connection request carrying request parameters to the AI ​​gateway 120 corresponding to the tenant, based on the AI ​​gateway address corresponding to the tenant. The request parameters may include the instance identifier of the control terminal 110, protocol version range, user role, permission range, and authentication information. After receiving the WebSocket connection request from the control terminal 110, the AI ​​gateway 120 verifies the request parameters in the WebSocket connection request and returns connection confirmation information to the control terminal 110 after successful verification. When the control terminal 110 receives the connection confirmation information returned by the AI ​​gateway 120 after successful verification of the request parameters, it can establish a WebSocket connection with the AI ​​gateway 120 and update its local connection status (marked as "connected"). Alternatively, if the AI ​​gateway 120 fails to verify the request parameters, it can return connection error information to the control terminal 110, and the control terminal 110 can attempt to re-initiate the WebSocket connection request.

[0079] Step 330: The control terminal 110 can generate a session key based on the user's corresponding agent name. Subsequently, based on the WebSocket connection established between the control terminal 110 and the AI ​​gateway 120 corresponding to the user's tenant, the control terminal 110 can send a chat request to the AI ​​gateway 120 based on the aforementioned session key. The AI ​​gateway 120 can parse the agent name from the session key and forward the chat request to the target agent corresponding to the agent name for processing.

[0080] Here, the user can input a question (including question text and / or image files) on the control terminal 110 to trigger the control terminal 110 to send a chat request to the AI ​​gateway 120 based on a session key. The control terminal 110 can obtain the question input by the user, construct a chat request based on the question information, and send the chat request to the AI ​​gateway 120 based on the session key. In some embodiments, after obtaining the question input by the user, if the question information contains an image file, the control terminal 110 can first read the binary data in the image file, convert the binary data in the image file into a base64 string using a base64 encoding algorithm, and construct an image content block based on the base64 string. When constructing a chat request based on the question information, the chat request can be constructed based on the question text and / or the image content block corresponding to the image file in the question information, and then sent to the AI ​​gateway 120 based on the session key. This facilitates the recognition and transmission of content in the image file between the control terminal 110, the AI ​​gateway 120, and the intelligent agent. It should be noted that base64 strings are text strings that can be directly transmitted and stored. By converting image files to base64 strings, they can be directly packaged and transmitted along with the parameters in the chat request, eliminating the need to transmit image files separately, thus simplifying the transmission process.

[0081] It should be noted that the session key is used to identify a session (a session between a user and an agent) in order to distinguish sessions between multiple agents.

[0082] In some embodiments, after generating a session key based on the user's corresponding agent name, the control terminal 110 can send the session key to the artificial intelligence gateway 120, so that the artificial intelligence gateway 120 can establish a session between the user and the target agent based on the session key. Furthermore, the control terminal 110 can send a chat request to the artificial intelligence gateway 120 via the corresponding session based on the session key.

[0083] In some embodiments, a session key may include a main session key (used for the default main session scenario, valid for a long time) or a new session key (used to create a new session). The main session key includes the agent name corresponding to the user and the main session identifier. The new session key includes the agent name corresponding to the user, a timestamp, and a random suffix. In one implementation, the main session key can be implemented as: agent:{AgentName}:main. The new session key can be implemented as: agent:{AgentName}:yyyyMMdd-HHmmss-random. AgentName represents the agent name corresponding to the user. Based on this, when the control terminal 110 receives a request from the user to create a new session, it can respond to the request by simply sending the new session key to the AI ​​gateway 120, so that the AI ​​gateway 120 can establish a new session between the user and the target agent based on the new session key. In this way, when a new session needs to be created, it is only necessary to switch to the new session key to create a new session, without sending a session reset command to the AI ​​gateway 120, thereby avoiding clearing the main session history. Furthermore, based on the information contained in the above session key, different topics can be retrieved by date.

[0084] In some embodiments, the chat request also has a corresponding run identifier and a request number. Specifically, when sending a chat request, the control terminal 110 can generate a run identifier (or idempotent identifier) ​​corresponding to the chat request, and can assign a request number (an incrementing request number) to the chat request. Then, based on the session key (via the corresponding session), the chat request, the run identifier (or idempotent identifier) ​​corresponding to the chat request, and the request number can be sent together to the AI ​​gateway 120. In other words, the chat request carries the corresponding session key, run identifier, and request number.

[0085] Step 340: The control terminal 110 can receive the processing data of the target intelligent agent in response to the chat request returned by the artificial intelligence gateway 120. Specifically, the control terminal 110 can receive the processing data of the target intelligent agent in response to the chat request returned by the artificial intelligence gateway 120 based on the aforementioned WebSocket connection and session key. Subsequently, the control terminal 110 can split the processing data into multiple event streams, parse each event stream, and display them in the corresponding session window (i.e., the session window corresponding to the user's conversation with the target intelligent agent). These multiple event streams may include, but are not limited to, several of the following: assistant streaming text, thought stream, tool call stream, context compression event, and model rollback event.

[0086] According to an embodiment of the present invention, in step 340, the control terminal 110 can parse each event stream into corresponding front-end state data (state data that the front-end can directly render, display, and interact with), and render and display the front-end state data corresponding to each event stream in the corresponding session window (the front-end state data corresponding to each event stream is rendered and then uniformly displayed in the session window). In some embodiments, the control terminal 110 can use the Markdig component and Markdown format to render the front-end state data corresponding to the event stream and display it in the corresponding session window.

[0087] According to an embodiment of the present invention, the control terminal 110 includes a chat control interface, on which one or more session windows can be displayed. After rendering the front-end state data corresponding to each event stream, the control terminal 110 can uniformly display the corresponding session windows on the chat control interface, thereby enabling the user to be shown the processes of streaming replies, reasoning, tool calls, context compression, and model rollback through the same chat control interface.

[0088] In this embodiment of the invention, after receiving a chat request from the AI ​​gateway 120, the target intelligent agent can parse the user's question information in the chat request, and can invoke tools to perform actions such as queries, calculations, and interface requests, maintain the session context and trigger context compression events as needed, and can invoke one or more large models to generate the thought process and response content for the user's question information, and trigger model rollback events when the model is abnormal. Furthermore, the target intelligent agent can send the entire processing data of the chat request (including various event data) and the response results back to the AI ​​gateway 120 as the processing data of the chat request, so that it can be returned to the control terminal 110 via the AI ​​gateway 120.

[0089] In some embodiments, the processing data of the target agent in response to the chat request includes processing data and a response result. After forwarding the chat request to the target agent corresponding to the agent name for processing, the AI ​​gateway 120 can receive the response result and processing data returned by the target agent, and encapsulate the response result and processing data into a response frame and an event frame, respectively. Then, the AI ​​gateway 120 can return the response frame and event frame to the control terminal 110. That is, the control terminal 110 can receive the response frame and event frame returned by the AI ​​gateway 120. The response frame contains the target agent's response result to the chat request (indicating whether the chat request was successfully responded to), and the event frame contains the target agent's processing data for the chat request.

[0090] In some embodiments, before splitting the processed data (response frames and event frames) into multiple event streams, the control terminal 110 can pre-filter the event frames based on the session key and run identifier corresponding to the chat request to retain valid event frames that match the session key and run identifier. It should be noted that when the AI ​​gateway 120 sends event frames to the control terminal 110, it carries the session key and the run identifier of the corresponding chat request. When filtering event frames, it can first determine whether the session key carried by the event frame matches the session key corresponding to the chat request. If the session key matches, it then determines whether the run identifier carried by the event frame matches the run identifier corresponding to the chat request. If the run identifier also matches, then the event frame is determined to be a valid event frame.

[0091] Furthermore, the valid event frames retained after filtering can be split into multiple event streams, and each event stream can be parsed and displayed in its corresponding session window.

[0092] It should be noted that, since this invention supports parallel operation of multiple tenants, multiple users, multiple agents, and multiple sessions, the event frames issued by the AI ​​gateway 120 may contain invalid events from other tenants, other users, other agents, and other sessions. Filtering event frames based on session keys and running identifiers ensures that the control terminal 110 only processes valid events corresponding to the current user, current session, and current chat request, achieving isolated processing of multiple sessions and requests, and avoiding event confusion and mutual interference between different sessions.

[0093] Step 350: Control terminal 110 can display one or more session windows that the user has permission to access, based on the user's corresponding user role and intelligent agent name.

[0094] In other words, the control terminal 110 can restrict the scope of session access based on the user's corresponding user role and agent name, and only show the user a list of sessions that the user has permission to access (containing one or more session windows that the user has permission to access). According to an embodiment of the present invention, the control terminal 110 can display a chat control interface containing a list of one or more chat windows that the user has permission to access, so as to present it to the user.

[0095] In some embodiments, in step 350, the method of displaying one or more session windows that the user has permission to access based on the user's corresponding user role and agent name is as follows: If the user's corresponding user role is an administrator, multiple session windows corresponding to multiple agents (all agents) can be displayed to the user. If the user's corresponding user role is a regular user, only the session window corresponding to the session key containing the user's corresponding agent name is displayed to the user. That is, if the user's corresponding user role is a regular user, only when the agent name in the session key matches the user's corresponding agent name is the session window determined to be the session window that the user has permission to access, and the session window corresponding to the session key can be displayed to the user (displayed to the user in the session list). In this way, regular users can be restricted to accessing only sessions with the same agent name as themselves.

[0096] Based on this, it is possible to avoid unauthorized access to sessions across agents in scenarios where multiple agents and multiple sessions (including sessions with different agents) coexist.

[0097] In some embodiments, the control terminal 110 can detect whether the WebSocket connection with the AI ​​gateway 120 is abnormal or disconnected. When the control terminal 110 detects that the WebSocket connection with the AI ​​gateway 120 is abnormal or disconnected, it can automatically re-initiate the WebSocket connection request according to an incremental delay mechanism (i.e., re-send the WebSocket connection request carrying request parameters to the AI ​​gateway corresponding to the tenant) in order to re-establish the WebSocket connection with the AI ​​gateway 120. After successful reconnection, the session list and session history data can be loaded, and the input state can be restored. In this way, disconnection reconnection can be realized, the stability of the control link can be enhanced, and the impact of WebSocket connection instability on the chat control interface can be reduced.

[0098] In some embodiments, after sending a chat request to the AI ​​gateway 120 based on a session key, the control terminal 110 can write the chat request and its corresponding request number into a pending request table (which stores one or more pending chat requests). When the AI ​​gateway 120 sends a response frame to the control terminal 110, it will carry the request number of the corresponding chat request.

[0099] When the control terminal 110 receives a response frame from the AI ​​gateway 120, it can look up the corresponding chat request in the pending request table based on the request number carried in the response frame. If the response frame indicates that the chat request was successfully responded to, the control terminal 110 can obtain the response result from the response frame (the response result includes, for example, a response success identifier and a session key) and display the response result in the corresponding session window. If the response frame indicates that the chat request failed to respond, the control terminal 110 can obtain the error code and error message from the response frame, generate an exception message based on the error code and error message, and display the exception message in the corresponding session window. If the response frame indicates that the chat request timed out, the control terminal 110 can remove the chat request from the pending request table and stop processing the chat request.

[0100] In some embodiments, the AI ​​gateway 120 can continuously and asynchronously send next event frames to the control terminal 110 based on the processing data of the chat request returned by the target intelligent agent. The event frame carries a corresponding event sequence number.

[0101] When the control terminal 110 receives an event frame returned by the AI ​​gateway 120, the control terminal 110 can obtain the event sequence number in the event frame and detect the continuity of the event sequence number. Specifically, it determines whether the event sequence number in the current event frame is continuous with the previous event sequence number in the previous event frame. If the event sequence number in the current event frame is not continuous with the previous event sequence number in the previous event frame (the difference between the event sequence number and the previous event sequence number is greater than 1), an event missing prompt message can be generated and displayed in the corresponding session window. Based on this, event missing detection can be achieved.

[0102] In some embodiments, the event frame includes chat events and agent events. Chat events are used to indicate the assistant's response status and chat request status. Specifically, chat events include an assistant response increment status (delta status), an assistant response completed status (final status), a chat request aborted status (aborted status), or a chat request processing failed status (error status).

[0103] Agent events can include multiple events from the following: assistant stream (including the agent's response content, which is an incremental fragment), thinking stream (including the agent's reasoning and thinking content), tool call stream (including the complete process of the tool call event to enable visualization of the tool call stream), compaction event (including the state change of the context compaction event), and fallback event (including the relevant details of the model fallback).

[0104] In some embodiments, in step 340, the control terminal 110 can split the processed data (event frame) into multiple events, including chat events and assistant streaming text, thought stream, tool call stream, context compression event, and model rollback event.

[0105] In some embodiments, if the control terminal 110 receives the assistant streaming text, that is, the multiple event streams obtained after splitting the processed data (event frames) in step 340 include the assistant streaming text, then when parsing the multiple event streams and displaying them in the corresponding session windows, the reply content (incremental fragment) in the assistant streaming text can be incrementally rendered to generate assistant reply messages in real time and display them in the corresponding session windows.

[0106] If the control terminal 110 does not receive processed data (event frames) including the assistant streaming text within a preset time, or if the multiple event streams obtained after splitting do not contain the assistant streaming text, the control terminal 110 can call the historical interface to poll and obtain historical assistant reply messages, and display the historical assistant reply messages in the session window (the session window corresponding to the session between the user and the target agent). In this way, by obtaining historical assistant reply messages through historical interface polling as a fallback, the missing assistant streaming text can be completed so that the complete assistant reply message can be displayed in the end.

[0107] In one specific embodiment, the control terminal 110 can obtain historical assistant reply messages by polling the history interface in the following way: First, the maximum timestamp of the assistant reply message displayed in the previous round in the session window can be determined. Then, the history interface can be called to obtain session history data (historical data in the session between the user and the target agent), and historical assistant reply messages (complete historical assistant reply messages) with timestamps later than the maximum timestamp can be filtered from the session history data. After that, it can be determined whether the filtered historical assistant reply message is equivalent to the displayed assistant reply message in the session window. If they are not equivalent, the filtered historical assistant reply message can be rendered and displayed in the session window (the session window corresponding to the session between the user and the target agent). Here, filtering historical assistant reply messages based on timestamps and performing text equivalence judgment on historical assistant reply messages and displayed assistant reply messages can avoid the problem of duplicate display of assistant reply messages.

[0108] Additionally, if the control terminal 110 receives the assistant streaming text while polling for historical assistant reply messages via the historical interface, it can stop polling for historical assistant reply messages via the historical interface to avoid the same reply content being rendered repeatedly by the streaming channel and the historical channel.

[0109] In some embodiments, the control terminal 110 has a pre-set whitelist. When rendering historical assistant reply messages, it can identify image information in the historical assistant reply messages. For image information (including base64 strings, image URLs, or image paths), it only allows loading image files corresponding to the image information from the whitelisted directory (does not load external image files) and displays them in the corresponding session window.

[0110] In some embodiments, during step 340, when the control terminal 110 parses and displays multiple event streams in the corresponding session windows, the specific processing methods for different event streams are as follows: For a tool call stream, the control terminal 110 can generate tool call stream entries based on the tool call identifiers in the tool call stream. When a tool call event in the tool call stream is in the start phase, the tool name and parameters are recorded in the tool call stream entry; when the tool call event is in the update phase, the update result of the tool call event is recorded in the tool call stream entry; when the tool call event is in the result phase, the final result of the tool call event is recorded in the tool call stream entry. Finally, the tool call stream entry can be converted into a collapsible tool call message and displayed in the corresponding session window. In some embodiments, a maximum number of tool call stream entries and a maximum character limit can be preset for the tool call stream output (tool call message). When the tool call stream output (tool call message) exceeds the character limit, only the first part of the content can be retained and a truncation prompt mark can be added.

[0111] For the thought stream, the control terminal 110 can extract reasoning content from the thought stream (including the thinking, reasoning, thought fields or the thinking tags in the assistant text) and separate the reasoning content from the front-end status data corresponding to the assistant's streaming text. Then, it can determine whether to render the reasoning content based on the thinking content display switch. If so, the reasoning content is rendered and displayed in the corresponding session window.

[0112] For context compression events, when the context compression event is in the start state, the control terminal 110 can display the compression in progress status in the corresponding session window; when the context compression event is in the end state, it can display the compression completed status in the corresponding session window, and clear the compression completed status in the session window after a predetermined duration (that is, after the compression completed status in the corresponding session window is continuously displayed for a predetermined duration).

[0113] For model rollback events, the control terminal 110 can parse the selected model, the effective model, the previously effective model, the rollback reason, and the rollback attempt summary from the model rollback event, and display the parsing results (selected model, effective model, previously effective model, rollback reason, and rollback attempt summary) as the model rollback status (i.e., the front-end status data corresponding to the model rollback event) in the corresponding session window. Furthermore, when the control terminal 110 detects a model rollback clearing event, it can display the model rollback cleared status in the session window (changing the model rollback status to "model rollback cleared").

[0114] According to the AI ​​multi-agent control method 300 of the present invention, the control terminal determines the user's corresponding tenant, agent name, and user role based on the user login information, establishes a WebSocket connection with the AI ​​gateway corresponding to the tenant, generates a session key based on the agent name, and sends a chat request to the AI ​​gateway based on the session key. The AI ​​gateway can forward the chat request to the target agent corresponding to the agent name for processing and return the processed data. Then, the control terminal splits the processed data into multiple event streams (assistant streaming text, thought stream, tool call stream, context compression event, model rollback event) and parses them respectively, displaying them in the session window. Furthermore, the control terminal displays a list of sessions that the user has permission to access based on the user role and agent name. In this way, based on the binding relationship between tenants, users, agents, and session keys, session isolation can be achieved in multi-tenant, multi-user, and multi-agent environments to prevent confusion among multiple agents; through event diversion processing and display, the processes of streaming response, reasoning, tool invocation, context compression, and model rollback can be made observable, improving users' perception of the agent's operation process; restricting the session access scope based on user roles and agent names can avoid unauthorized access to sessions across agents in scenarios where multiple agents and sessions coexist.

[0115] Furthermore, by polling historical assistant replies through the historical interface for compensation, missing assistant streaming messages can be completed, ensuring that the final assistant reply is displayed completely. Moreover, filtering based on timestamps and text equivalence checks can prevent duplicate assistant reply messages from being displayed. Thus, by achieving collaboration between streaming events and historical fallback, the reliability of replies during user-agent conversations can be improved.

[0116] In addition, filtering event frames based on session keys and running identifiers before event routing can prevent event confusion and mutual interference between different sessions.

[0117] Furthermore, since the session key generated based on the agent name includes either a main session key or a new session key, the main session key includes the agent name corresponding to the user and the main session identifier, while the new session key includes the agent name corresponding to the user, a timestamp, and a random suffix. Therefore, when a new session needs to be created, simply switching to the new session key is sufficient to create a new session, eliminating the need to send a session reset command to the AI ​​gateway. This avoids clearing the main session history and allows different topics to be retrieved by date.

[0118] Furthermore, based on event gap detection and disconnection reconnection mechanisms, the stability of the control link can be enhanced.

[0119] The various techniques described herein can be implemented in combination with hardware or software, or a combination thereof. Thus, the methods and apparatus of the present invention, or certain aspects or portions thereof, can take the form of program code (i.e., instructions) embedded in a tangible medium, such as a removable hard disk, USB flash drive, floppy disk, CD-ROM, or any other machine-readable storage medium, wherein when the program is loaded into and executed by a machine such as a computer, the machine becomes an apparatus for practicing the present invention.

[0120] When the program code is executed on a programmable computer, the mobile terminal generally includes a processor, a processor-readable storage medium (including volatile and non-volatile memory and / or storage elements), at least one input device, and at least one output device. The memory is configured to store program code; the processor is configured to execute the artificial intelligence multi-agent control method of the present invention according to instructions in the program code stored in the memory.

[0121] By way of example, and not limitation, readable media include readable storage media and communication media. Readable storage media stores information such as computer-readable instructions, data structures, program modules, or other data. Communication media generally embodies computer-readable instructions, data structures, program modules, or other data in the form of modulated data signals such as carrier waves or other transmission mechanisms, and includes any information delivery medium. Any combination of the above is also included within the scope of readable media.

[0122] In the specification provided herein, the algorithms and displays are not inherently related to any particular computer, virtual system, or other device. Various general-purpose systems can also be used with the examples of this invention. The required structure for constructing such systems is apparent from the above description. Furthermore, this invention is not directed to any particular programming language. It should be understood that the contents of the invention described herein can be implemented using various programming languages, and the above description of specific languages ​​is for the purpose of disclosing the best mode of implementation of the invention.

[0123] Numerous specific details are set forth in the specification provided herein. However, it will be understood that embodiments of the invention may be practiced without these specific details. In some instances, well-known methods, structures, and techniques have not been shown in detail so as not to obscure the understanding of this specification.

[0124] Similarly, it should be understood that, in order to streamline this disclosure and aid in understanding one or more of the various aspects of the invention, in the description of exemplary embodiments of the invention above, various features of the invention are sometimes grouped together in a single embodiment, figure, or description thereof.

[0125] Those skilled in the art will understand that modules, units, or components of the devices disclosed in the examples herein can be arranged in the devices described in this embodiment, or alternatively, can be located in one or more devices different from the devices in this example. The modules in the foregoing examples can be combined into a single module or, in addition, can be divided into multiple sub-modules.

[0126] Unless otherwise specified, the use of ordinal numbers such as “first,” “second,” “third,” etc., to describe ordinary objects merely indicates different instances of similar objects and is not intended to imply that the objects being described must have a given order in time, space, ordering, or any other manner.

Claims

1. An artificial intelligence multi-agent control method, executed at a control terminal, the method comprising: Receive user login information, and determine the tenant, agent name, and user role corresponding to the user based on the user login information; A WebSocket connection is established with the AI ​​gateway corresponding to the tenant, and the AI ​​gateway communicates with multiple intelligent agents respectively; A conversation key is generated based on the agent name, and a chat request is sent to the AI ​​gateway based on the conversation key, so that the AI ​​gateway forwards the chat request to the target agent corresponding to the agent name in the conversation key for processing; The system receives the processing data of the target intelligent agent on the chat request returned by the artificial intelligence gateway, splits the processing data into multiple event streams, parses the multiple event streams and displays them in the corresponding conversation windows. The multiple event streams include multiple of the following: assistant streaming text, thought stream, tool call stream, context compression event, and model rollback event. Based on the user's corresponding user role and agent name, display one or more session windows that the user has permission to access.

2. The method as described in claim 1, wherein, The chat request has a corresponding runtime identifier and request number; The AI ​​gateway is adapted to receive the response result and processing data of the chat request returned by the target intelligent agent, and encapsulate the response result and processing data into response frames and event frames respectively; Receiving the processing data of the target intelligent agent on the chat request returned by the artificial intelligence gateway includes: receiving response frames and event frames returned by the artificial intelligence gateway; The processed data is split into multiple event streams, and each event stream is parsed and displayed in its corresponding session window, including: Based on the session key and the running identifier corresponding to the chat request, the event frames are filtered to retain valid event frames that are consistent with the session key and the running identifier; The valid event frame is split into multiple event streams, and each event stream is parsed and displayed in its corresponding session window.

3. The method as described in claim 2, wherein, Also includes: Write the chat request and its corresponding request number into the pending request table; When a response frame is received from the AI ​​gateway, the corresponding chat request is searched from the pending request table based on the request number carried in the response frame. If the response frame indicates that the chat request was successfully responded to, the response result is obtained from the response frame and displayed in the corresponding session window; If the response frame indicates that the chat request response failed, then the error code and error message are obtained from the response frame, an exception prompt message is generated based on the error code and error message, and displayed in the corresponding session window; If the response frame indicates that the chat request response timed out, then the chat request is removed from the pending request table.

4. The method as described in claim 2 or 3, wherein, Also includes: When an event frame is received from the AI ​​gateway, the event sequence number in the event frame is obtained. If the event sequence number is not consecutive with the previous event sequence number in the previous event frame, an event missing prompt message is generated and displayed in the corresponding session window.

5. The method according to any one of claims 1-4, wherein, Based on the user's corresponding user role and agent name, display one or more session windows that the user has permission to access, including: If the user role is an administrator, then multiple session windows corresponding to the multiple smart agents are displayed to the user; If the user role is a regular user, then display the user a conversation window containing the name of the agent corresponding to the user.

6. The method according to any one of claims 1-5, wherein, The processed data is split into multiple event streams, and each event stream is parsed and displayed in its corresponding session window, including: If the multiple event streams include assistant streaming text, then the reply content in the assistant streaming text is incrementally rendered to generate assistant reply messages in real time and display them in the corresponding session window; If no processing data including the assistant's streaming text is received within a preset time, the historical interface is invoked to poll for historical assistant reply messages and display them in the session window.

7. The method of claim 6, wherein, Call the history interface to poll and retrieve historical assistant reply messages and display them in the session window, including: Determine the maximum timestamp of the assistant's reply message that has been displayed in the conversation window; Call the history interface to obtain session history data, and filter out historical assistant reply messages with timestamps later than the maximum timestamp from the session history data; Determine whether the historical assistant reply message is equivalent to the displayed assistant reply message. If they are not equivalent, display the historical assistant reply message in the conversation window.

8. The method according to any one of claims 1-7, wherein, Multiple event streams are parsed and displayed in their respective session windows, including: For the tool call flow, a tool call flow entry is generated based on the tool call identifier in the tool call flow; when the tool call event in the tool call flow is in the start stage, the tool name and parameters are recorded in the tool call flow entry; when the tool call event is in the update stage, the update result of the tool call event is recorded in the tool call flow entry; when the tool call event is in the result stage, the final result of the tool call event is recorded in the tool call flow entry; the tool call flow entry is converted into a collapsible tool call message and displayed in the corresponding session window; For the thought stream, the reasoning content is extracted from the thought stream, and the reasoning content is separated from the front-end status data corresponding to the assistant's streaming text; whether to render the reasoning content is determined according to the thought content display switch; if so, the reasoning content is rendered and displayed in the corresponding session window. For the context compression event, when the context compression event is in the start state, the compression in progress state is displayed in the corresponding session window; when the context compression event is in the end state, the compression completed state is displayed in the corresponding session window, and the compression completed state is cleared after a predetermined duration. For the model rollback event, the selected model, the effective model, the previous effective model, the rollback reason, and the rollback attempt summary are parsed from the model rollback event and displayed as the model rollback status in the corresponding session window; when a model rollback clearing event is detected, the model rollback cleared status is displayed in the session window.

9. The method according to any one of claims 1-8, wherein, The session key includes a main session key or a new session key. The main session key includes the agent name and main session identifier corresponding to the user. The new session key includes the agent name, timestamp and random suffix corresponding to the user.

10. The method according to any one of claims 1-9, wherein, Sending a chat request to the AI ​​gateway based on the session key includes: The session key is sent to the AI ​​gateway so that the AI ​​gateway can establish a session between the user and the target AI agent based on the session key; A chat request is sent to the AI ​​gateway based on the session corresponding to the session key.

11. The method according to any one of claims 1-10, wherein, The control terminal is communicatively connected to the storage device, which includes a tenant table and a user table. Based on the user login information, the user's corresponding tenant, agent name, and user role are determined, including: After the user login information is verified, the tenant identifier, agent name and user role corresponding to the user are obtained from the user table based on the user login information; The corresponding AI gateway address is obtained from the tenant table based on the tenant identifier.

12. The method according to any one of claims 1-11, wherein, Establishing a WebSocket connection with the AI ​​gateway corresponding to the tenant includes: Based on the AI ​​gateway address corresponding to the tenant, a WebSocket connection request carrying request parameters is sent to the AI ​​gateway corresponding to the tenant. The request parameters include the instance identifier of the control terminal, the protocol version range, the user role, the permission range, and the authentication information. When the AI ​​gateway returns a connection confirmation message after verifying the request parameters, a WebSocket connection is established with the AI ​​gateway.

13. The method of claim 12, wherein, When an abnormality or disconnection is detected in the WebSocket connection with the AI ​​gateway, a WebSocket connection request carrying request parameters is resent to the AI ​​gateway corresponding to the tenant in order to re-establish the WebSocket connection with the AI ​​gateway.

14. The method according to any one of claims 2-4, wherein, The event frames include chat events and agent events; The chat events include assistant reply incremental status, assistant reply completed status, chat request terminated status, or chat request processing failed status. The agent events include multiple events such as assistant streaming content, thought stream, tool call stream, context compression event, agent lifecycle event, and model rollback event.

15. The method according to any one of claims 1-14, wherein, Sending a chat request to the AI ​​gateway based on the session key includes: Receive user input of a question, wherein if the question contains an image file, convert the binary data in the image file into a base64 string and construct an image content block; A chat request is constructed based on the question text and / or the image content block corresponding to the image file in the question information, and the chat request is sent to the artificial intelligence gateway based on the session key.

16. An artificial intelligence multi-agent control system, comprising: An AI gateway that communicates and connects with multiple intelligent agents; A control terminal is provided with a control device adapted to perform the method as described in any one of claims 1-15, the control device comprising: The tenant user management module is adapted to receive user login information and determine the tenant, agent name and user role corresponding to the user based on the user login information. The gateway connection module is adapted to establish a WebSocket connection with the artificial intelligence gateway corresponding to the tenant, and the artificial intelligence gateway communicates with multiple intelligent agents respectively; The session control module is adapted to generate a session key based on the agent name, and send a chat request to the artificial intelligence gateway based on the session key, so that the artificial intelligence gateway forwards the chat request to the target agent corresponding to the agent name in the session key for processing; The event splitting and display module is adapted to receive the processing data of the target intelligent agent on the chat request returned by the artificial intelligence gateway, split the processing data into multiple event streams, parse the multiple event streams respectively and display them in the corresponding conversation window, wherein the multiple event streams include multiple of the following: assistant streaming text, thought stream, tool call stream, context compression event, and model rollback event; The access control module is adapted to display one or more session windows that the user has permission to access, based on the user role and agent name corresponding to the user.

17. A computing device, comprising: At least one processor; and A memory storing program instructions, wherein the program instructions are configured to be processed by the at least one processor, the program instructions including instructions for processing the method as described in any one of claims 1-15.

18. A computer program product comprising computer program instructions, wherein, When the computer program instructions are executed by the processor, they implement the method as described in any one of claims 1-15.

19. A readable storage medium storing program instructions that, when read and processed by a computing device, cause the computing device to perform the method as described in any one of claims 1-15.