Long-term memory writing method and device of an agent, equipment, storage medium and program product

By extracting and filtering memory units in the intelligent agent, identifying and processing sensitive information according to sensitivity levels, the problem of privacy leakage and error accumulation in the long-term memory writing of the intelligent agent is solved, achieving higher accuracy and security.

CN122432332APending Publication Date: 2026-07-21ALIBABA CLOUD COMPUTING CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
ALIBABA CLOUD COMPUTING CO LTD
Filing Date
2026-06-23
Publication Date
2026-07-21

AI Technical Summary

Technical Problem

Existing methods for writing long-term memories to intelligent agents can easily lead to privacy leaks and the accumulation of erroneous information, especially in the inability to effectively handle sensitive content and implicit information that are not filtered by preset sensitive words.

Method used

By extracting memory units from the agent's conversation information, determining their confidence level and filtering them, identifying sensitive information and desensitizing it according to the sensitivity level, a long-term memory to be written is finally formed.

Benefits of technology

It effectively reduces the risk of privacy leaks, decreases the accumulation of erroneous information, and improves the accuracy and security of long-term memory writing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122432332A_ABST
    Figure CN122432332A_ABST
Patent Text Reader

Abstract

Embodiments of the present application provide an agent long-term memory writing method, device, equipment, storage medium and program product. The method comprises: extracting at least one first memory unit from the conversation information of the agent; determining the confidence of each first memory unit, and screening the at least one first memory unit according to the confidence of the first memory unit to obtain a second memory unit, wherein the confidence is used to represent the accuracy of the first memory unit; identifying whether there is sensitive information in the second memory unit, and in the case that there is sensitive information in the second memory unit, performing desensitization processing on the second memory unit according to the sensitive level of the sensitive information to obtain the long-term memory to be written. In this way, the risk of writing false information into the long-term memory bank can be effectively reduced, the accumulation of false memories can be reduced, and the risk of privacy leakage can also be effectively reduced on the premise of retaining the availability of memory content.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of artificial intelligence, and in particular to a method, apparatus, device, storage medium, and program product for writing long-term memory to an intelligent agent. Background Technology

[0002] With the rapid development of artificial intelligence technology, intelligent agents have been widely used in dialogue scenarios such as enterprise operations, life services, and knowledge management. In order to achieve personalized services and continuous task execution, intelligent agents generally need to have the ability to write to long-term memory.

[0003] Currently, the method of writing long-term memory in intelligent agents usually involves filtering sensitive content in conversation information using preset sensitive words, and then directly writing the filtered conversation information into the long-term memory.

[0004] However, this method of directly writing the filtered session information into the long-term memory is still prone to privacy leaks and can also lead to the accumulation of erroneous information. Summary of the Invention

[0005] This application provides a method, apparatus, device, storage medium, and program product for writing long-term memory to an intelligent agent, which can effectively reduce the risk of privacy leakage and reduce the accumulation of erroneous information.

[0006] In a first aspect, embodiments of this application provide a method for writing long-term memory to an intelligent agent, including:

[0007] Extract at least one first memory unit from the conversation information of the agent;

[0008] The confidence level of each first memory unit is determined, and the at least one first memory unit is filtered according to the confidence level of the first memory unit to obtain a second memory unit, wherein the confidence level is used to characterize the accuracy of the first memory unit;

[0009] The system identifies whether the sensitive information exists in the second memory unit. If the sensitive information exists in the second memory unit, the system performs desensitization processing on the second memory unit according to the sensitivity level of the sensitive information to obtain the long-term memory to be written.

[0010] Optionally, determining the confidence level of each of the first memory cells includes:

[0011] Determine the multi-dimensional score corresponding to the first memory unit, wherein the multi-dimensional score includes at least two of the following: the confidence score of the agent for the first memory unit, the confidence score of the tool invoked by the agent for the first memory unit, the strength score of the retrieval evidence corresponding to the first memory unit, the standardization score of the first memory unit, and the consistency score of multiple information sources of the first memory unit.

[0012] The confidence level of the first memory unit is obtained by weighted summation of the multi-dimensional scores corresponding to the first memory unit.

[0013] Optionally, the step of identifying whether the sensitive information exists in the second memory unit, and if the sensitive information exists in the second memory unit, performing desensitization processing on the second memory unit according to the sensitivity level of the sensitive information to obtain the long-term memory to be written, includes:

[0014] Based on the structured digest of the second memory cell, identify whether the sensitive information exists in the second memory cell;

[0015] If the sensitive information exists in the second memory unit, and the sensitivity level of the sensitive information is the first level, then the sensitive information is deleted from the structured digest, and the structured digest after deleting the sensitive information is determined as the long-term memory to be written.

[0016] If the sensitivity level of the sensitive information is the second level, then the sensitive information in the structured digest is masked, and the masked structured digest is determined as the long-term memory to be written, wherein the sensitivity of the second level is lower than that of the first level.

[0017] If the sensitivity level of the sensitive information is level three, then the sensitive information in the structured digest is generalized, and the generalized structured digest is determined as the long-term memory to be written, wherein the sensitivity level of level three is lower than that of level two.

[0018] Optionally, before determining the confidence level of each of the first memory cells, the method further includes:

[0019] Determine the event type of each sub-segment in the first memory unit;

[0020] If the event type is a preset sensitive type or a temporary information type, the sub-segment will be deleted from the first memory unit.

[0021] Optionally, before identifying whether the sensitive information exists in the second memory unit, the method further includes:

[0022] Based on the historical long-term memories in the long-term memory bank, the second memory unit and the long-term memory bank are deduplicated.

[0023] Optionally, the step of deduplicating the second memory unit and the long-term memory bank based on historical long-term memories in the long-term memory bank includes:

[0024] Retrieve a candidate set of similar memories from the long-term memory bank, the candidate set of similar memories including multiple candidate historical long-term memories;

[0025] Determine the similarity between the structured summary of the second memory unit and the structured summary of the candidate historical long-term memory, and determine the maximum similarity among the similarities corresponding to each candidate historical long-term memory;

[0026] If the maximum similarity is greater than or equal to a first threshold, the candidate historical long-term memory corresponding to the maximum similarity is deleted from the long-term memory bank.

[0027] Optionally, the method further includes:

[0028] If the maximum similarity is less than the first threshold, then conflict detection is performed on the second memory unit and the historical long-term memory in the long-term memory bank to obtain a conflict detection result. The conflict detection result is used to indicate whether there is a historical long-term memory in the long-term memory bank that conflicts with the second memory unit.

[0029] After obtaining the long-term memory to be written, the method includes:

[0030] If the conflict detection result indicates that there is no historical long-term memory in the long-term memory bank that conflicts with the second memory unit, the long-term memory to be written is written into the long-term memory bank.

[0031] If the conflict detection result indicates that there is a historical long-term memory in the long-term memory bank that conflicts with the second memory unit, a first write approval request is generated, and the first write approval request includes the long-term memory to be written.

[0032] In response to the approval instruction of the first write approval request, the long-term memory to be written is written to the long-term memory bank; or, in response to the approval rejection instruction of the first write approval request, the long-term memory to be written is deleted.

[0033] Optionally, the step of performing conflict detection on the second memory unit and the historical long-term memories in the long-term memory bank to obtain conflict detection results includes:

[0034] If the memory subject identifier and attribute key in the structured summary of the second memory unit are different from the memory subject identifier and attribute key in the structured summary of each historical long-term memory, then the conflict detection result is determined to be that there is no historical long-term memory in the long-term memory bank that conflicts with the second memory unit.

[0035] If the memory subject identifier and attribute key in the structured summary of the second memory unit are the same as the memory subject identifier and attribute key in the structured summary of any of the historical long-term memories, then the conflict detection result is determined according to the attribute value and attribute value type corresponding to the same attribute key.

[0036] Optionally, determining the conflict detection result based on the attribute value and type corresponding to the same attribute key includes:

[0037] If the attribute value is of type enumeration or Boolean, and the attribute value in the structured summary of the second memory unit is different from the attribute value in the structured summary of the historical long-term memory, then the conflict detection result is determined to be that there is a historical long-term memory in the long-term memory bank that conflicts with the second memory unit; if the attribute value in the structured summary of the second memory unit is the same as the attribute value in the structured summary of the historical long-term memory, then the conflict detection result is determined to be that there is no historical long-term memory in the long-term memory bank that conflicts with the second memory unit.

[0038] Optionally, determining the conflict detection result based on the attribute value and type corresponding to the same attribute key includes:

[0039] If the attribute value is of type numeric, and the difference between the attribute value in the structured summary of the second memory unit and the attribute value in the structured summary of the historical long-term memory is greater than or equal to the second threshold, then the conflict detection result is determined to be that there is a historical long-term memory in the long-term memory bank that conflicts with the second memory unit; if the difference between the attribute value in the structured summary of the second memory unit and the attribute value in the structured summary of the historical long-term memory is less than the second threshold, then the conflict detection result is determined to be that there is no historical long-term memory in the long-term memory bank that conflicts with the second memory unit.

[0040] Optionally, determining the conflict detection result based on the attribute value and type corresponding to the same attribute key includes:

[0041] If the attribute value is of type text, the agent determines the conflict detection result based on the attribute values ​​in the structured summary of the second memory unit and the attribute values ​​in the structured summary of the historical long-term memory.

[0042] Optionally, after obtaining the long-term memory to be written, the method further includes:

[0043] If the confidence level of the second memory unit is greater than or equal to the first confidence threshold, the long-term memory to be written is written into the long-term memory bank.

[0044] If the confidence level of the second memory cell is greater than or equal to the second confidence threshold and less than the first confidence level, a second write approval request is generated, and the second write approval request includes the long-term memory to be written.

[0045] In response to the approval instruction of the second write approval request, the long-term memory to be written is written to the long-term memory bank; or, in response to the approval rejection instruction of the second write approval request, the long-term memory to be written is deleted.

[0046] Secondly, embodiments of this application provide a long-term memory writing device for an intelligent agent, comprising:

[0047] The acquisition module is used to extract at least one first memory unit from the session information of the agent;

[0048] A filtering module is used to determine the confidence level of each first memory unit and to filter the at least one first memory unit according to the confidence level of the first memory unit to obtain a second memory unit, wherein the confidence level is used to characterize the accuracy of the first memory unit;

[0049] The mapping module is used to identify whether there is sensitive information in the second memory unit. If the sensitive information exists in the second memory unit, the second memory unit is desensitized according to the sensitivity level of the sensitive information to obtain the long-term memory to be written.

[0050] Optionally, the mapping module is used for:

[0051] Determine the multi-dimensional score corresponding to the first memory unit, wherein the multi-dimensional score includes at least two of the following: the confidence score of the agent for the first memory unit, the confidence score of the tool invoked by the agent for the first memory unit, the strength score of the retrieval evidence corresponding to the first memory unit, the standardization score of the first memory unit, and the consistency score of multiple information sources of the first memory unit.

[0052] The confidence level of the first memory unit is obtained by weighted summation of the multi-dimensional scores corresponding to the first memory unit.

[0053] Optionally, the mapping module is used for:

[0054] Based on the structured digest of the second memory cell, identify whether the sensitive information exists in the second memory cell;

[0055] If the sensitive information exists in the second memory unit, and the sensitivity level of the sensitive information is the first level, then the sensitive information is deleted from the structured digest, and the structured digest after deleting the sensitive information is determined as the long-term memory to be written.

[0056] If the sensitivity level of the sensitive information is the second level, then the sensitive information in the structured digest is masked, and the masked structured digest is determined as the long-term memory to be written, wherein the sensitivity of the second level is lower than that of the first level.

[0057] If the sensitivity level of the sensitive information is level three, then the sensitive information in the structured digest is generalized, and the generalized structured digest is determined as the long-term memory to be written, wherein the sensitivity level of level three is lower than that of level two.

[0058] Optionally, the apparatus further includes: a first preprocessing module, used for:

[0059] Determine the event type of each sub-segment in the first memory unit;

[0060] If the event type is a preset sensitive type or a temporary information type, the sub-segment will be deleted from the first memory unit.

[0061] Optionally, the apparatus further includes: a second preprocessing module, used for:

[0062] Based on the historical long-term memories in the long-term memory bank, the second memory unit and the long-term memory bank are deduplicated.

[0063] Optionally, the device further includes: a deletion module, used for:

[0064] Retrieve a candidate set of similar memories from the long-term memory bank, the candidate set of similar memories including multiple candidate historical long-term memories;

[0065] Determine the similarity between the structured summary of the second memory unit and the structured summary of the candidate historical long-term memory, and determine the maximum similarity among the similarities corresponding to each candidate historical long-term memory;

[0066] If the maximum similarity is greater than or equal to a first threshold, the candidate historical long-term memory corresponding to the maximum similarity is deleted from the long-term memory bank.

[0067] Optionally, the apparatus further includes: a third preprocessing module, used for:

[0068] If the maximum similarity is less than the first threshold, then conflict detection is performed on the second memory unit and the historical long-term memory in the long-term memory bank to obtain a conflict detection result. The conflict detection result is used to indicate whether there is a historical long-term memory in the long-term memory bank that conflicts with the second memory unit.

[0069] After obtaining the long-term memory to be written, the method includes:

[0070] If the conflict detection result indicates that there is no historical long-term memory in the long-term memory bank that conflicts with the second memory unit, the long-term memory to be written is written into the long-term memory bank.

[0071] If the conflict detection result indicates that there is a historical long-term memory in the long-term memory bank that conflicts with the second memory unit, a first write approval request is generated, and the first write approval request includes the long-term memory to be written.

[0072] In response to the approval instruction of the first write approval request, the long-term memory to be written is written to the long-term memory bank; or, in response to the approval rejection instruction of the first write approval request, the long-term memory to be written is deleted.

[0073] Optionally, the mapping module is used for:

[0074] If the memory subject identifier and attribute key in the structured summary of the second memory unit are different from the memory subject identifier and attribute key in the structured summary of each historical long-term memory, then the conflict detection result is determined to be that there is no historical long-term memory in the long-term memory bank that conflicts with the second memory unit.

[0075] If the memory subject identifier and attribute key in the structured summary of the second memory unit are the same as the memory subject identifier and attribute key in the structured summary of any of the historical long-term memories, then the conflict detection result is determined according to the attribute value and attribute value type corresponding to the same attribute key.

[0076] Optionally, the mapping module is used for:

[0077] If the attribute value is of type enumeration or Boolean, and the attribute value in the structured summary of the second memory unit is different from the attribute value in the structured summary of the historical long-term memory, then the conflict detection result is determined to be that there is a historical long-term memory in the long-term memory bank that conflicts with the second memory unit.

[0078] If the attribute values ​​in the structured summary of the second memory unit are the same as the attribute values ​​in the structured summary of the historical long-term memory, then the conflict detection result is determined to be that there is no historical long-term memory in the long-term memory bank that conflicts with the second memory unit.

[0079] Optionally, the mapping module is used for:

[0080] If the attribute value is of type numeric, and the difference between the attribute value in the structured summary of the second memory unit and the attribute value in the structured summary of the historical long-term memory is greater than or equal to the second threshold, then the conflict detection result is determined to be that there is a historical long-term memory in the long-term memory bank that conflicts with the second memory unit.

[0081] If the difference between the attribute value in the structured summary of the second memory unit and the attribute value in the structured summary of the historical long-term memory is less than the second threshold, then the conflict detection result is determined to be that there is no historical long-term memory in the long-term memory bank that conflicts with the second memory unit.

[0082] Optionally, the mapping module is used for:

[0083] If the attribute value is of type text, the agent determines the conflict detection result based on the attribute values ​​in the structured summary of the second memory unit and the attribute values ​​in the structured summary of the historical long-term memory.

[0084] Optionally, the apparatus further includes: a fourth preprocessing module, used for:

[0085] If the confidence level of the second memory unit is greater than or equal to the first confidence threshold, the long-term memory to be written is written into the long-term memory bank.

[0086] If the confidence level of the second memory cell is greater than or equal to the second confidence threshold and less than the first confidence level, a second write approval request is generated, and the second write approval request includes the long-term memory to be written.

[0087] In response to the approval instruction of the second write approval request, the long-term memory to be written is written to the long-term memory bank; or, in response to the approval rejection instruction of the second write approval request, the long-term memory to be written is deleted.

[0088] Thirdly, embodiments of this application provide an electronic device, the electronic device comprising:

[0089] At least one processor; and

[0090] A memory that is communicatively connected to the at least one processor;

[0091] The memory stores instructions that can be executed by the at least one processor to cause the electronic device to perform the method described in the first aspect.

[0092] Fourthly, embodiments of this application provide a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, are used to implement the method described in the first aspect.

[0093] Fifthly, embodiments of this application provide a computer program product, the computer program product including a computer program, which, when executed by a processor, implements the method described in the first aspect.

[0094] This application provides a method, apparatus, device, storage medium, and program product for writing long-term memory to an intelligent agent. The method extracts at least one first memory unit from the agent's session information; determines the confidence level of each first memory unit; and filters the first memory units based on their confidence levels to obtain second memory units, where the confidence level characterizes the accuracy of the first memory units. It then identifies whether sensitive information exists in the second memory units. If sensitive information is present, the second memory units are desensitized according to the sensitivity level of the sensitive information to obtain the long-term memory to be written. This method effectively reduces the risk of writing erroneous information into the long-term memory bank by filtering memory units based on their confidence levels, reducing the accumulation of erroneous memories and thus improving the accuracy of long-term memory writing. Furthermore, by identifying sensitive information in the filtered memory units and performing graded desensitization based on the sensitivity level when sensitive information is present, the risk of privacy leakage can be effectively reduced while preserving the usability of the memory content. Attached Figure Description

[0095] The accompanying drawings, which are included to provide a further understanding of this application and form part of this application, illustrate exemplary embodiments and are used to explain this application, but do not constitute an undue limitation of this application. In the drawings:

[0096] Figure 1 A flowchart illustrating a long-term memory writing method for an intelligent agent provided in this application embodiment. Figure 1 ;

[0097] Figure 2 A flowchart illustrating a long-term memory writing method for an intelligent agent provided in this application embodiment. Figure 2 ;

[0098] Figure 3A schematic diagram illustrating the deduplication process for a second memory unit and a long-term memory bank provided in this application embodiment;

[0099] Figure 4 A schematic diagram of a process for determining a collision detection result provided in an embodiment of this application;

[0100] Figure 5 A schematic diagram of a long-term memory writing device for an intelligent agent provided in an embodiment of this application;

[0101] Figure 6 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation

[0102] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties. Furthermore, the collection, use and processing of the relevant data must comply with relevant laws, regulations and standards, and corresponding operation entry points are provided for users to choose to authorize or refuse.

[0103] To make the objectives, technical solutions, and advantages of this application clearer, the technical solutions of this application will be clearly and completely described below in conjunction with specific embodiments and corresponding drawings. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of them. Based on the embodiments in this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0104] The terminology used in the embodiments of this application will be introduced.

[0105] Intelligent agent: refers to an intelligent entity with autonomous perception, decision-making, execution, and interaction capabilities, which can complete specified tasks by receiving user input, calling external tools, and generating output content. The specified task can be issued by the user, generated autonomously by the intelligent agent according to scenario requirements, or determined through preset rules, external triggering events, etc.

[0106] Application Programming Interface (API): is a set of specifications and protocols used to define the communication and interaction methods between different software applications or components, including callable functions, calling methods, input parameter formats, and return result formats.

[0107] Top-K: refers to sorting a set of data or candidate results according to a preset scoring standard, filtering and retaining the top K elements with the highest scores. It is commonly used in scenarios such as search engines returning the top K most relevant results and vector databases recalling the top K similar vectors.

[0108] Natural Language Processing (NLP) enables computers to understand and process human language, extracting useful information to help humans handle various tasks more efficiently.

[0109] Large Language Model (LLM): A deep learning model trained on large amounts of text data, capable of understanding and generating human language. Furthermore, this model can not only parse the meaning of text but also perform various tasks such as question answering, translation, summarizing, and writing.

[0110] With the rapid development of artificial intelligence technology, intelligent agents have been widely used in dialogue scenarios such as enterprise operations, life services, and knowledge management. To achieve personalized services and continuous task execution in conversations, intelligent agents generally need to have the ability to write long-term memory.

[0111] Currently, the method of writing long-term memory in intelligent agents usually involves filtering sensitive content in conversation information using preset sensitive words, and then directly writing the filtered conversation information into the long-term memory.

[0112] However, this method of directly writing filtered conversation information into long-term memory still carries the risk of privacy breaches. Some sensitive content is not within the preset sensitive word range, such as specific ID numbers, bank account information, and medical records. Furthermore, some sensitive content is expressed implicitly, such as home addresses, social relationships, or behavioral patterns inferred from context. Although this information does not trigger the preset sensitive word rules, its inclusion in long-term memory still poses a risk of privacy breaches.

[0113] Furthermore, this direct writing method is prone to accumulating erroneous information. Some information does not come from the user's original statement, but is generated by the agent based on the user's question, or generated by the agent based on the returned result after calling the tool to complete the question and answer. This kind of memory information may have problems such as bias, misjudgment, or inconsistency with the facts. If it is directly written into the long-term memory, it will lead to the continuous accumulation of erroneous information, which will affect the accuracy of the agent's subsequent dialogue understanding and decision-making reasoning.

[0114] To address the aforementioned issues, embodiments of this application provide a method for writing long-term memory to an intelligent agent. This method first extracts at least one raw memory unit from the agent's session information, then determines the confidence level of each raw memory unit, and filters the at least one raw memory unit based on the confidence level to obtain filtered memory units.

[0115] Next, it is determined whether there is sensitive information in the filtered memory units. If there is sensitive information in the filtered memory units, the corresponding desensitization process is performed on the memory units according to the sensitivity level of the sensitive information, and finally the long-term memory to be written is obtained.

[0116] Among them, the original memory unit is the information unit generated by the user during the interaction with the agent. It can extract memory fragments related to user preferences, user profiles, stable facts, long-term task settings, core needs, etc. from the agent's conversation information through methods such as semantic extraction and entity recognition.

[0117] Confidence score is used to quantify the accuracy of the information contained in the original memory unit. The higher the score, the closer the information in the original memory unit is to the truth. Long-term memory refers to memory information that an agent uses to store for a long time and can be repeatedly retrieved in subsequent conversations and task execution.

[0118] This method filters original memory units based on their confidence level, which can effectively reduce the risk of writing erroneous information into the long-term memory bank, reduce the accumulation of erroneous memories, and thus improve the accuracy of long-term memory writing.

[0119] In addition, sensitive information is identified in the screened memory units. If sensitive information is found in the screened memory units, graded desensitization is carried out according to the sensitivity level. This can effectively reduce the risk of sensitive information leakage while preserving the usability of the memory content.

[0120] The technical solutions shown in this application will now be described in detail through specific embodiments. It should be noted that the following embodiments may exist independently or in combination with each other; for identical or similar content, the description will not be repeated in different embodiments.

[0121] The execution subject in this application embodiment can be an electronic device or a long-term memory writing device for an intelligent agent disposed in an electronic device. The electronic device can be a server, etc. The long-term memory writing device for the intelligent agent can be implemented by software or by a combination of software and hardware. For example, the long-term memory writing device for the intelligent agent can be a processor in the electronic device. For ease of understanding, the following description will use an electronic device as the execution subject.

[0122] Figure 1A flowchart illustrating a long-term memory writing method for an intelligent agent provided in this application embodiment. Figure 1 .like Figure 1 As shown, the method includes:

[0123] S101. Extract at least one first memory unit from the agent's conversation information.

[0124] Among them, conversation information refers to the information generated during the interaction between the intelligent agent and the user. It may include text input information and voice input information entered by the user in the conversation window corresponding to the intelligent agent in the electronic device, as well as the response information generated by the intelligent agent in the electronic device based on the above input information and fed back to the user, and the tool call information executed by the intelligent agent in order to complete the user's request in the process of responding to the user's input needs.

[0125] Tool invocation information includes tool invocation commands, interactive data during the tool invocation process, tool execution process information, and the result data returned by the tool. For example, when a user queries the current weather and future weather changes for a certain region, the agent, in response to this request, invokes a weather forecast tool to obtain weather data and meteorological forecast data, processes it, and then provides the corresponding response to the user. As another example, when a user requests specific numerical calculations or formula operations, the agent can invoke a calculator tool, transmitting the user's calculation request to the calculator tool, which then performs the calculation and returns the result, which the agent then returns to the user.

[0126] The first memory unit refers to the original memory unit described above. The specific meaning of the first memory unit can be found in the relevant explanations above, and will not be repeated here.

[0127] In the embodiments of this application, each first memory unit corresponds to a subject, that is, each first memory unit belongs to a user identifier, but one user identifier may correspond to multiple first memory units.

[0128] S102. Determine the confidence level of each first memory unit, and screen at least one first memory unit according to the confidence level of the first memory unit to obtain a second memory unit, wherein the confidence level is used to characterize the accuracy of the first memory unit.

[0129] The second memory unit is obtained by filtering the first memory unit based on its confidence level, and the confidence level of the second memory unit is consistent with the confidence level of the corresponding first memory unit before filtering.

[0130] Optionally, the confidence level of each first memory cell is determined, including:

[0131] Determine the multi-dimensional score corresponding to the first memory unit. The multi-dimensional score includes at least two of the following: the confidence score of the agent for the first memory unit, the confidence score of the tool invoked by the agent for the first memory unit, the strength score of the retrieval evidence corresponding to the first memory unit, the standardization score of the first memory unit, and the consistency score of multiple information sources of the first memory unit.

[0132] The confidence level of the first memory unit is obtained by weighted summation of the multi-dimensional scores corresponding to the first memory unit.

[0133] The confidence score of the agent for the first memory unit is used to represent the quantitative value obtained by the agent after judging the credibility of the content of the first memory unit based on its own understanding, knowledge reserves and logical reasoning.

[0134] The confidence score of an agent for the first memory unit is typically normalized to a value between 0 and 1. A higher value indicates that the agent considers the content of the first memory unit to be more credible. For example, when the content of the first memory unit is highly consistent with the agent's known common sense and domain knowledge, and is logically sound without obvious conflicts, the confidence score approaches 1; if the content contains obvious logical contradictions, violates common sense, or contradicts known knowledge, the confidence score approaches 0.

[0135] The confidence score of the tool invoked by the agent for the first memory unit is used to characterize the degree of verification and credibility of the tool's execution result regarding the content of the first memory unit. This confidence score takes a value in the range [0, 1]. The tool execution result is the output information obtained after the agent invokes the tool, which can be numerical calculation results, data returned from a database query, information from an API call response, etc.

[0136] For example, tools such as calculators, database queries, API interfaces, and external verification services are used to verify the values, factual information, and state results in the first memory unit. If the tool execution result is highly similar to the content of the first memory unit, the tool called by the agent has a high confidence score for the first memory unit; if the tool execution result has a significant deviation or conflict with the content of the first memory unit, the tool called by the agent has a low confidence score for the first memory unit.

[0137] The strength score of the retrieval evidence corresponding to the first memory unit is used to characterize the degree of matching between the retrieved information and the content of the first memory unit, and the value range is usually from 0 to 1. Here, retrieval evidence refers to factual information or original records obtained from specified data sources such as official documents, authoritative databases, academic literature or technical standards libraries, which can be used to verify or supplement the content of the first memory unit.

[0138] The higher the strength score of the retrieval evidence corresponding to the first memory unit, the stronger the relevance between the retrieved information and the content of the first memory unit, and the more sufficient the effective information. For example, when the content of the first memory unit is a certain technical parameter standard, and multiple similar and authoritative information are obtained by searching official documents, authoritative databases, etc., the strength score of the retrieval evidence corresponding to the first memory unit is high; if the retrieved information is unrelated to the content of the first memory unit, the credibility of the information source is low, or there are no effective retrieval results, the strength score of the retrieval evidence corresponding to the first memory unit is low.

[0139] The strength score of the retrieval evidence corresponding to the first memory unit can be denoted as: It can be calculated based on the similarity of the Top-K search results returned by the retrieval, and the calculation formula is as follows:

[0140]

[0141] in, The similarity between the j-th search result and the content of the first memory unit is denoted as K, where K is a preset threshold for the number of search results.

[0142] The standardization score of the first memory unit is used to characterize the degree of standardization of the first memory unit in terms of format, expression logic, and content compliance, and the value is usually 0 or 1. For example, based on format validation, it is judged whether the field completeness, data type, text structure, etc. of the first memory unit conform to the preset template and syntax rules. If all items conform to the standardization, the standardization score of the first memory unit is 1; if there are missing items, errors, or mismatches, the standardization score of the first memory unit is 0. As another example, based on whitelist validation, it is judged whether the keywords, source subject, data range, etc. of the first memory unit are within the preset trust range. If they are within the trust range, the standardization score of the first memory unit is 1; if they are outside the trust range, the standardization score of the first memory unit is 0.

[0143] The consistency score of multiple information sources for the first memory unit is used to characterize the degree of consistency between the content of different information sources corresponding to the first memory unit, and the value is usually 0 or 1. For example, when comparing and verifying the content of different information sources such as tool execution results, search results, and user input, if there is no contradiction and the content is consistent among the information sources, the consistency score of multiple information sources for the first memory unit is 1; if there are information conflicts, contradictions, or obvious inconsistencies among different information sources, the consistency score of multiple information sources for the first memory unit is 0.

[0144] For example, suppose the multi-dimensional scoring includes the agent's confidence score for the first memory unit. The confidence score of the tool invoked by the agent on the first memory unit. Strength score of retrieval evidence corresponding to the first memory unit Standardized scoring of the first memory unit Consistency score of multiple information sources in the first memory unit Then, the multi-dimensional scores corresponding to the first memory unit are weighted and summed to obtain the confidence level of the first memory unit. The calculation formula is:

[0145]

[0146] Among them, clip ( ) is a numerical truncation function used to constrain the calculation results within a preset reasonable range, usually [0, 1].

[0147] , as well as These are the weighting coefficients for the five dimensions mentioned above, and the sum of these weighting coefficients is 1. The weighting coefficients can be dynamically and adaptively adjusted based on the actual application scenario, task type, and the importance of the first memory unit. For example, in scenarios requiring higher reliability of evidence retrieval, the weighting coefficients can be appropriately increased. In scenarios where the consistency of information sources has a more significant impact on the reliability of memory, the weight of this value can be increased accordingly. .

[0148] It is understandable that the confidence level of the first memory unit is determined through multi-dimensional scoring, and then the first memory units are screened based on this confidence level, with those meeting the confidence requirements being used as the second memory units. During the screening process, for example, a confidence level threshold is set; first memory units with a confidence level higher than or equal to the threshold are retained as second memory units, while those with a confidence level lower than the threshold are deleted. Alternatively, several first memory units with high confidence levels can be selected as second memory units. The specific method of selecting first memory units as second memory units can be flexibly set according to the task scenario, and this application embodiment does not limit this.

[0149] S103. Identify whether there is sensitive information in the second memory unit. If there is sensitive information in the second memory unit, perform desensitization processing on the second memory unit according to the sensitivity level of the sensitive information to obtain the long-term memory to be written.

[0150] Sensitive information identification in the second memory unit can be achieved through methods such as rule-based matching, natural language processing in the agent, or large language model recognition. Desensitization can be performed using methods such as information masking, feature generalization, and information deletion to eliminate or weaken the identifiability of sensitive content while retaining the effective information in the second memory unit.

[0151] Sensitive information can be classified into multiple levels, such as high, medium and low, or first level, second level and third level, etc. Different levels correspond to different desensitization methods.

[0152] The purpose of this step is to identify sensitive information in the contents of the second memory unit before using it as long-term memory to be written, and to process the second memory unit using the corresponding desensitization method based on the identification results.

[0153] In this way, sensitive information can be desensitized while preserving the complete content of the second memory unit, thereby forming content that meets security standards and can be safely written into long-term memory. This ensures the security of information when it is subsequently accessed, retrieved, and reused from long-term memory, and avoids the leakage of sensitive information.

[0154] The long-term memory writing method for an intelligent agent provided in this application involves extracting at least one first memory unit from the agent's session information, determining the confidence level of each first memory unit, filtering at least one first memory unit based on the confidence level of the first memory unit to obtain a second memory unit, identifying whether there is sensitive information in the second memory unit, and if there is sensitive information in the second memory unit, desensitizing the second memory unit according to the sensitivity level of the sensitive information to obtain the long-term memory to be written.

[0155] This method filters first memory units based on their confidence level, which can effectively reduce the risk of writing erroneous information into the long-term memory bank, reduce the accumulation of erroneous memories, and thus improve the accuracy of long-term memory writing.

[0156] In addition, sensitive information is identified in the second memory unit obtained after screening. If sensitive information exists in the memory unit, corresponding desensitization processing is carried out according to the sensitivity level. This can effectively reduce the risk of privacy leakage while preserving the usability of the memory content.

[0157] The long-term memory writing method for an intelligent agent provided in the above embodiments may optionally include, before determining the confidence level of each first memory unit:

[0158] Determine the event types of each sub-unit within the first memory unit;

[0159] If the event type is a preset sensitive type or a temporary information type, the sub-unit will be deleted from the first memory unit.

[0160] The sub-unit can be the smallest memory information unit obtained by splitting the first memory unit according to semantic information, information dimension or information category; the event type is used to represent the attribute category of the first memory unit, and can include preset sensitive type, temporary information type and preset writable information type.

[0161] Preset sensitive types can include Personal Sensitive Information, Internal Secret Information, and Credentials. Personal Sensitive Information can include user ID card number, bank card number, etc.; Internal Secret Information can include trade secrets, undisclosed internal data, etc.; Credentials can include login key, encryption key, password, etc.

[0162] Temporary information types can include temporary verification codes, one-time passwords, temporary links, temporary authorization codes, etc.

[0163] Preset writable information types can include user preferences, user profiles, long tasks, stable facts, key decisions, and information suitable for long-term storage such as regular contact information and accounts. Specifically, user preferences can include user likes and dislikes; user profiles can include stable information such as basic user attributes, occupation, and location; long tasks can include continuously executed goals and default execution processes; stable facts can include objective factual statements supported by trusted knowledge bases or reliable data sources; key decisions can include conclusions drawn by the agent after analyzing various issues and important viewpoints confirmed by the user; and regular contact information and frequently used accounts refer to basic contact information that users use long-term, pose no security risks, and need to be retained long-term.

[0164] For example, suppose the first memory unit is "User A logged into the system on December 1, 2024, using the account zhangsan@example.com and the temporary verification code 88688". According to the semantic information splitting rules, the first memory unit can be split into two sub-units, namely the first sub-unit and the second sub-unit.

[0165] The first sub-unit is "User A logs into the system using the account zhangsan@example.com", which belongs to account information and its event type is a preset writable information type; the second sub-unit is "Used temporary verification code 88688", which belongs to temporary verification code information and its event type is temporary information type. It is only valid during this login process and has no long-term storage value, so it needs to be deleted.

[0166] Therefore, the second sub-unit can be deleted from the first memory unit, leaving only the first sub-unit for subsequent confidence verification of the first memory unit.

[0167] Understandably, by identifying the event type of each sub-unit after the first memory unit is broken down and filtering out sensitive and temporary information before conducting a confidence assessment of the first memory unit, it is possible to effectively prevent content that is not suitable for long-term storage or poses a risk of privacy leakage from being written into the long-term memory bank, thereby improving the security and effectiveness of long-term memory.

[0168] Furthermore, in the long-term memory writing method for an intelligent agent provided in the above embodiments, optionally, after obtaining the long-term memory to be written, the method further includes:

[0169] If the confidence level of the second memory cell is greater than or equal to the first confidence level threshold, the long-term memory to be written is written to the long-term memory bank; if the confidence level of the second memory cell is greater than or equal to the second confidence level threshold and less than the first confidence level, a second write approval request is generated; in response to the approval approval instruction of the second write approval request, the long-term memory to be written is written to the long-term memory bank, or, in response to the approval rejection instruction of the second write approval request, the long-term memory to be written is deleted.

[0170] The first confidence level is a preset high confidence threshold, used to define the confidence standard of the second memory unit that can be directly written into the long-term memory bank without approval. When the confidence level of the second memory unit reaches the first confidence threshold, it means that the content of the second memory unit is accurate and reliable, and can be directly written into the long-term memory bank without additional approval process.

[0171] The second confidence level is a preset medium confidence threshold, which is lower than the first confidence threshold but higher than the confidence threshold for screening the second memory unit. When the confidence level of the second memory unit is in this range, it means that the confidence level of the content of the second memory unit meets the basic requirements, but there is still some uncertainty. It is necessary to go through the approval process to make the corresponding judgment before determining whether to write the long-term memory to be written into the long-term memory bank.

[0172] The second write approval request may include, but is not limited to, the following: the long-term memory to be written, the confidence level of the long-term memory to be written, the sensitivity level of the second memory unit, the desensitization method of the second memory unit, the desensitization location of the second memory unit, the desensitization type of the second memory unit, the set of hit rule numbers, and the sensitivity probability of the second memory unit.

[0173] The confidence level of the long-term memory to be written is consistent with the confidence level of the corresponding second memory unit, that is, it is equivalent to the confidence level of the first memory unit retained after screening.

[0174] The sensitivity level of the second memory unit indicates the risk level of the sensitive information contained within it. This risk level is categorized into three levels: high, medium, and low. A second memory unit containing high-risk sensitive information is marked as high; containing medium-risk sensitive information is marked as medium; and containing low-risk sensitive information is marked as low. If the second memory unit does not contain sensitive information, it is marked as having no sensitivity level or no sensitive information.

[0175] The desensitization method of the second memory unit refers to the desensitization processing method adopted when sensitive information exists in the second memory unit, such as masking, generalization, or deletion; the desensitization position of the second memory unit records the specific character start and end index of the desensitization processing in the second memory unit; the desensitization type of the second memory unit records the category of desensitized information, such as mobile phone number, ID card number, or email address.

[0176] The set of hit rule numbers is a list of sensitive rule numbers matched during the identification of sensitive information in the second memory unit; the sensitivity probability of the second memory unit is the confidence level of the sensitive information identified by natural language processing or large language model, which is used to assist approvers in assessing the sensitivity risk of the second memory unit identified this time.

[0177] Understandably, the aforementioned long-term memory writing method based on confidence level control performs direct write operations on long-term memory with high confidence, and adds an approval and verification process for long-term memory with medium confidence. This can effectively reduce the risk of erroneous information or questionable content being written into the long-term memory and prevent the memory from becoming contaminated.

[0178] The following is combined Figure 2 The process of obtaining the long-term memory to be written will be further explained. Figure 2 A flowchart illustrating a long-term memory writing method for an intelligent agent provided in this application embodiment. Figure 2 .like Figure 2 As shown, the method includes:

[0179] S201. Based on the structured summary of the second memory unit, identify whether there is sensitive information in the second memory unit.

[0180] Structured summaries are concise representations of the content of the second memory unit, generated by extracting key information and reorganizing the format, and possessing a unified field structure. Structured summaries typically include fields such as entities, attributes, and relationships, facilitating the location and identification of sensitive information.

[0181] To identify whether sensitive information exists in the second memory unit, one implementation can combine rule-based recognition and model-based recognition simultaneously to achieve comprehensive and accurate identification of sensitive information, overcoming the limitations of a single recognition method. Rule-based recognition can use pre-defined regular expression matching and pre-defined sensitive dictionary matching to identify sensitive information, while model-based recognition can use natural language processing or large language models within the intelligent agent to recognize semantic understanding within the second memory unit and identify sensitive information.

[0182] Sensitive information can be identified based on pre-defined regular expressions. Regular expression rules can be pre-written to incorporate the format characteristics of sensitive information, such as 18-digit combinations of ID card numbers, 11-digit combinations of mobile phone numbers, and email addresses in the format of "username@domain," all of which possess clear format characteristics. The structured summary of the second memory unit is then matched against these regular expressions to identify content that conforms to the format rules, thus completing the identification of sensitive information with a fixed format.

[0183] Sensitive information is identified based on a pre-set sensitive dictionary. The sensitive dictionary can pre-acquire various explicit sensitive keywords and phrases, such as ID card numbers and bank card numbers related to privacy information, as well as prohibited expressions related to illegal content. The entity and attribute fields in the structured summary of the second memory unit are matched with the entries in the sensitive dictionary. If there is a complete match or highly relevant content, the sensitive information is identified.

[0184] Based on natural language processing or large language models in intelligent agents to identify sensitive information, the content of the second memory unit can be used as input to the large language model. The large language model can identify the implicit sensitive information in the text by understanding the semantics of the text.

[0185] Understandably, some sensitive information lacks a fixed format and explicit keywords, making it impossible to match through rule-based identification. Examples include implicit malicious guidance, veiled violations, and content that is not explicitly labeled but semantically involves privacy.

[0186] Therefore, for such unstructured and implicit sensitive information, natural language processing or large language models in intelligent agents can be used for sensitive information identification. Through the deep understanding of semantics by the model, comprehensive coverage of various types of sensitive information can be achieved, further improving the completeness and accuracy of sensitive information identification.

[0187] S202. If sensitive information exists in the second memory unit, and the sensitivity level of the sensitive information is the first level, then the sensitive information is deleted from the structured summary, and the structured summary after deleting the sensitive information is determined as the long-term memory to be written.

[0188] The first level typically includes highly sensitive privacy information, classified information, or information with significant security risks.

[0189] It is understandable that if sensitive information exists in the second memory unit, and the sensitivity level of the sensitive information is the first level, such as user identity information, account keys, or private content that is explicitly prohibited from being recorded, it indicates that this type of information is not suitable for storage. Therefore, the corresponding sensitive information in the structured digest is directly deleted, and only the desensitized structured digest is retained as the long-term memory to be written.

[0190] S203. If the sensitivity level of the sensitive information is the second level, then the sensitive information in the structured digest is masked, and the masked structured digest is determined as the long-term memory to be written. The sensitivity of the second level is lower than that of the first level.

[0191] The second level typically includes general privacy information or information that poses a certain security risk but does not require direct deletion.

[0192] Understandably, while information classified as Level 2 sensitivity falls under user privacy, the security risks posed by its leakage are relatively limited. Therefore, complete deletion is unnecessary. Information can be partially hidden or have its identifier replaced to reduce its recognizability, thus preserving its structure while protecting privacy. For example, fragments of phone numbers, email addresses, and bank card numbers can have the middle digits masked, retaining only a few identifying bits.

[0193] In this context, the identifier refers to the key characters retained after masking for identifying information. For example, a mobile phone number like 12345678910 can be masked as 123***8910, retaining only the first 3 and last 4 characters as identifiers. Similarly, an email address like julizi@example.com can be masked as j****i@example.com, retaining only the first and last characters of the account name and the email domain. Furthermore, a bank card number like 1234567890123456 can be masked as 123456****3456, retaining only the first 6 and last 4 characters as identifiers.

[0194] S204. If the sensitivity level of the sensitive information is level three, then the sensitive information in the structured summary is generalized, and the generalized structured summary is determined as the long-term memory to be written. The sensitivity level of level three is lower than that of level two.

[0195] The third level typically includes low-sensitivity privacy information, scenario-based information, or information with low security risks.

[0196] Understandably, information classified as Level 3 in terms of sensitivity has relatively weak privacy attributes and does not require deletion or masking. Precise information can be blurred or broadened in scope, preserving its contextual semantics while avoiding precise identification of individuals. For example, a detailed address accurate to the house number can be generalized to a city or district; time information accurate to the minute can be generalized to a time period or date.

[0197] The long-term memory writing method for an intelligent agent provided in this application first identifies whether there is sensitive information in the second memory unit based on the structured summary of the second memory unit. If there is sensitive information in the second memory unit, corresponding desensitization processing is performed according to the sensitivity level of the sensitive information. Sensitive information with a sensitivity level of first level is deleted, sensitive information with a sensitivity level of second level is masked, and sensitive information with a sensitivity level of third level is generalized. Finally, the processed structured summary is determined as the long-term memory to be written.

[0198] This method identifies sensitive information in the structured summary of the second memory unit and performs deletion, masking, and generalization processing according to the sensitivity level. This ensures the security of the long-term memory to be written, effectively prevents the leakage of sensitive information, and retains the valid information of the second memory unit under the premise of compliance.

[0199] The long-term memory writing method for an intelligent agent provided in this application embodiment can also perform deduplication processing on the second memory unit and the long-term memory bank based on the historical long-term memory in the long-term memory bank before identifying whether there is sensitive information in the second memory unit.

[0200] The following is combined Figure 3 The implementation process of deduplication for the second memory unit and the long-term memory bank is explained. Figure 3 This is a schematic diagram illustrating the deduplication process for a second memory unit and a long-term memory bank, as provided in an embodiment of this application. Figure 3 As shown, the method includes:

[0201] S301. Based on the second memory unit, retrieve a similar memory candidate set from the long-term memory bank. The similar memory candidate set includes multiple candidate historical long-term memories.

[0202] Long-term memory can be implemented using at least one of vector databases, structured databases, object databases, etc. In the embodiments of this application, the long-term memory can adopt a pluggable design, supporting flexible access and switching of different types of storage engines, thereby adapting to diverse memory storage and retrieval needs.

[0203] Retrieving a similar memory candidate set from the long-term memory bank based on the second memory unit can be achieved through vector retrieval, keyword matching, semantic matching, etc., and the embodiments of this application do not limit this.

[0204] S302. Determine the similarity between the structured summary of the second memory unit and the structured summary of the candidate historical long-term memory, and determine the maximum similarity among the similarities corresponding to each candidate historical long-term memory.

[0205] In determining the similarity between the structured summary of the second memory unit and the structured summaries of the candidate historical long-term memories, one implementation involves first converting the structured summary of the second memory unit into its corresponding vector representation, and simultaneously converting the structured summaries of each candidate historical long-term memory into their corresponding vector representations. The semantic similarity between the two is then calculated using cosine similarity, with the following formula:

[0206]

[0207] in, The vector representation corresponding to the structured summary of the second memory unit; This refers to the sequence number of the candidate historical long-term memory in the candidate set of similar memories. Represented as the first A candidate for long-term historical memory, Indicates the first The vector representation of the structured summary of each candidate historical long-term memory.

[0208] After calculating the similarity between the structured summary of the second memory unit and the structured summaries of each candidate historical long-term memory, the maximum similarity is selected from the similarity scores of each candidate historical long-term memory. The calculation formula is as follows:

[0209]

[0210] S303. If the maximum similarity is greater than or equal to the first threshold, delete the candidate historical long-term memory corresponding to the maximum similarity from the long-term memory bank.

[0211] The first threshold is a preset similarity judgment threshold, used to determine whether the structured summary of the second memory unit is sufficiently similar to the structured summary of the candidate historical long-term memory.

[0212] It is understandable that when the maximum similarity is greater than or equal to the first threshold, it indicates that the second memory unit is highly similar to the candidate historical long-term memory corresponding to the maximum similarity in semantics. The second memory unit and the candidate historical long-term memory corresponding to the maximum similarity have overlapping or repeated content. In order to avoid redundant and repeated memories in the long-term memory bank, the candidate historical long-term memory corresponding to the maximum similarity is deleted from the long-term memory bank.

[0213] Optionally, if the maximum similarity is less than the first threshold, conflict detection is performed on the second memory unit and the historical long-term memory in the long-term memory bank to obtain the conflict detection result. The conflict detection result is used to indicate whether there is a historical long-term memory in the long-term memory bank that conflicts with the second memory unit.

[0214] After obtaining the long-term memory to be written, the long-term memory writing method for an intelligent agent provided in this application embodiment includes:

[0215] If the conflict detection result indicates that there is no historical long-term memory in the long-term memory bank that conflicts with the second memory unit, the long-term memory to be written is written into the long-term memory bank; if the conflict detection result indicates that there is historical long-term memory in the long-term memory bank that conflicts with the second memory unit, a first write approval request is generated; in response to the approval approval instruction of the first write approval request, the long-term memory to be written is written into the long-term memory bank, or, in response to the approval rejection instruction of the first write approval request, the long-term memory to be written is deleted.

[0216] The first write approval request includes the long-term memory to be written, and may also include information related to the conflict detection results, such as the conflict type and conflict content description. The first write approval request can be presented to the user through interface display, message push, etc., and the user can confirm or reject it.

[0217] Understandably, when the maximum similarity is less than the first threshold, although redundant storage due to high repetition will not occur, the second memory unit may still conflict with the candidate historical long-term memory corresponding to the maximum similarity in terms of logical relationship or factual content. Therefore, by performing conflict detection and submitting the conflict detection results and the long-term memory to be written to the user for approval, the accuracy of long-term memory in the long-term memory bank can be ensured.

[0218] The long-term memory writing method for an intelligent agent provided in this application first retrieves a set of similar memory candidates from the long-term memory bank based on the second memory unit, calculates the similarity between the structured summary of the second memory unit and the structured summaries of each candidate historical long-term memory, and determines the maximum similarity. If the maximum similarity is greater than or equal to a first threshold, the corresponding candidate historical long-term memory is deleted, thereby effectively avoiding the problem of duplicate content accumulation in the long-term memory bank.

[0219] If the maximum similarity is less than the first threshold, conflict detection is performed. If there is no historical long-term memory in the long-term memory bank that conflicts with the second memory unit, the long-term memory to be written is written into the long-term memory bank. If there is a historical long-term memory in the long-term memory bank that conflicts with the second memory unit, the conflict detection result and the long-term memory to be written are submitted to the user for approval. The user's approval result determines whether the long-term memory to be written is written into the long-term memory bank.

[0220] This allows for information conflict and validity checks on the long-term memory to be written, improving the accuracy of long-term memory writing and preventing the accumulation of erroneous and conflicting information in the long-term memory bank.

[0221] The following is combined Figure 4 This section explains how to obtain the collision detection results. Figure 4 This application provides a flowchart illustrating a process for determining conflict detection results, which involves performing conflict detection on the second memory unit and historical long-term memories in the long-term memory bank to obtain conflict detection results, including:

[0222] S401. If the memory subject identifier and attribute key in the structured summary of the second memory unit are different from the memory subject identifier and attribute key in the structured summary of each historical long-term memory, then the conflict detection result is determined to be that there is no historical long-term memory in the long-term memory bank that conflicts with the second memory unit.

[0223] The subject identifier is used to uniquely identify the memory subject corresponding to the second memory unit, so as to distinguish the memory content corresponding to different memory subjects. The subject identifier of the second memory unit can be a user, such as user A or user B, or a certain entity object, such as device X or product Y.

[0224] The attribute key is used to represent the attribute dimension described by the second memory unit; the attribute value is the specific value corresponding to the attribute key; the type of the attribute value is used to represent the data format of the attribute value, which may include enumeration type, numeric type, boolean type or text type.

[0225] For example, assuming the content of the second memory unit is "User A's usual delivery address is Chaoyang District, Beijing", then the subject identifier is "User A", the attribute key is "Usual Delivery Address", the attribute value is "Chaoyang District, Beijing", and the attribute value type is "Text". As another example, if the content of the second memory unit is "Device X's operating status is normal", then the subject identifier is "Device X", the attribute key is "Operating Status", the attribute value is "Normal", and the attribute value type is "Enumeration Type".

[0226] The memory subject identifier and attribute key in the structured summary of the second memory unit are different from the memory subject identifier and attribute key in the structured summary of each historical long-term memory. They can be the memory subject identifier in the structured summary of the second memory unit, which is different from the memory subject identifier in the structured summary of each historical long-term memory.

[0227] Alternatively, the memory attribute keys in the structured summary of the second memory unit may be different from the attribute keys in the structured summaries of each historical long-term memory; or the memory subject identifier and attribute keys in the structured summary of the second memory unit may be different from the corresponding memory subject identifier and attribute keys in the structured summaries of each historical long-term memory.

[0228] It is understandable that if the memory subject identifier in the structured summary of the second memory unit is different from the memory subject identifier in the structured summary of each historical long-term memory, it means that the second memory unit is different from the object described by each historical long-term memory, and naturally there will be no conflict in attributes under the same subject.

[0229] For example, suppose the subject identifier in the structured summary of a historical long-term memory in the long-term memory bank is "User B" and the attribute key is "frequently used shipping address," while the subject identifier in the structured summary of the second memory unit is "User A" and the attribute key is also "frequently used shipping address." The subject identifier in the second memory unit is different from the subject identifier in the structured summary of the historical long-term memory. Even if the attribute key is the same, they belong to the same attribute of different subjects, so there is no conflict. Therefore, it is determined that there is no conflict.

[0230] Similarly, if the memory subject identifier in the structured summary of the second memory unit is different from the memory subject identifier in the structured summary of each historical long-term memory, then there is no conflict.

[0231] Furthermore, if the memory attribute keys in the structured summary of the second memory unit are different from the attribute keys in the structured summaries of each historical long-term memory, it indicates that the second memory unit and each historical long-term memory describe different characteristics of the same subject, and there will be no conflict.

[0232] For example, suppose the subject identifier in the structured summary of a historical long-term memory in the long-term memory bank is "User A" and the attribute key is "Contact Number". The subject identifier in the structured summary of the second memory unit is "User A" and the attribute key is "Frequently Used Shipping Address". Even if the subject identifier in the second memory unit is the same as the subject identifier in the structured summary of the historical long-term memory, the attribute keys are different, describing different characteristics of User A. There is no inconsistency in the same attribute, so it is determined that there is no conflict.

[0233] Similarly, if the attribute keys in the structured summary of the second memory unit are different from the attribute keys in the structured summaries of each historical long-term memory, then there is no conflict.

[0234] Furthermore, if the memory subject identifier and attribute key in the structured summary of the second memory unit are different from the corresponding memory subject identifier and attribute key in the structured summary of each historical long-term memory, it indicates that the second memory unit and the historical long-term memory do not belong to the same descriptive subject or the same attribute dimension. The second memory unit is unrelated to the content described by each historical long-term memory, so there will be no memory conflict, and it can be determined as conflict-free.

[0235] Therefore, as long as the second memory unit is different from the memory subject identifier or attribute key in the structured summary of each historical long-term memory, it can be determined that there is no conflict, and the conflict detection result is that there is no historical long-term memory in the long-term memory bank that conflicts with the second memory unit.

[0236] S402. If the memory subject identifier and attribute key in the structured summary of the second memory unit are the same as the memory subject identifier and attribute key in the structured summary of any historical long-term memory, then the conflict detection result is determined according to the attribute value and attribute value type corresponding to the same attribute key.

[0237] It is understandable that if the memory subject identifier and attribute key in the structured summary of the second memory unit are the same as the memory subject identifier and attribute key in the structured summary of a certain historical long-term memory, it means that the second memory unit and the historical long-term memory describe the attribute information corresponding to the same attribute key of the same subject.

[0238] For example, suppose the subject identifier in the structured summary of a historical long-term memory in the long-term memory bank is "User A" and the attribute key is "Frequently Used Shipping Address". The subject identifier and attribute key in the structured summary of the second memory unit are the same as those in the structured summary of the historical long-term memory.

[0239] In this case, conflict detection can be further performed based on the attribute value corresponding to the attribute key and the type of the attribute value, and the corresponding conflict detection result can be determined.

[0240] This application embodiment can accurately identify whether there is a content conflict between the second memory unit and the historical long-term memory by comparing the memory subject identifier and attribute key in the structured summary of the second memory unit and the historical long-term memory. This effectively avoids data pollution of the long-term memory bank due to memory conflict issues, thereby improving the accuracy of long-term memory bank management.

[0241] The following describes the implementation process of determining the conflict detection result based on the attribute values ​​and types corresponding to the same attribute key, mainly including the following three cases:

[0242] Case 1: If the attribute value is of type enumeration or Boolean, and the attribute value in the structured summary of the second memory unit is different from the attribute value in the structured summary of the historical long-term memory, then the conflict detection result is determined to be that there is a historical long-term memory in the long-term memory bank that conflicts with the second memory unit; if the attribute value in the structured summary of the second memory unit is the same as the attribute value in the structured summary of the historical long-term memory, then the conflict detection result is determined to be that there is no historical long-term memory in the long-term memory bank that conflicts with the second memory unit.

[0243] Among them, the attribute value of the enumeration type must match the value in the preset enumeration set. For example, the preset enumeration value of the "gender" attribute is "male, female or unknown". Only when the attribute value in the structured summary of the second memory unit is consistent with the attribute value in the structured summary of the historical long-term memory (such as both being "male"), it can be determined to be without conflict; if one is "male" and the other is "female", it is determined to be a conflict.

[0244] Boolean attribute values ​​must match corresponding values ​​such as "true or false" or "yes or no". The two types of expressions cannot be mixed for judgment. For example, "yes" and "true" must be converted to the same standard before matching. For example, for the attribute "whether authentication is completed", "yes" and "no" are considered to be conflicting, while "true" and "true" or "no" and "no" are considered to be non-conflicting.

[0245] It is understandable that the attribute values ​​of enumeration types and boolean types have a clear and finite range of values. Therefore, a matching conflict determination method can be used to avoid misjudgments caused by fuzzy matching.

[0246] Scenario 2: When the attribute value is a numeric type, if the difference between the attribute value in the structured summary of the second memory unit and the attribute value in the structured summary of the historical long-term memory is greater than or equal to the second threshold, then the conflict detection result is determined to be that there is a historical long-term memory in the long-term memory bank that conflicts with the second memory unit; if the difference between the attribute value in the structured summary of the second memory unit and the attribute value in the structured summary of the historical long-term memory is less than the second threshold, then the conflict detection result is determined to be that there is no historical long-term memory in the long-term memory bank that conflicts with the second memory unit.

[0247] The second threshold is used to determine whether the numerical difference reaches a conflict level, and this threshold can be adjusted according to the specific application scenario.

[0248] It is understandable that numerical attribute values ​​often exhibit natural fluctuations or measurement errors, such as daily weight fluctuations, annual age increases, and minor deviations in data recording. Using the same "equivalence matching" method as enumeration and Boolean types would lead to numerous meaningless conflict determinations, thus reducing the practicality of the long-term memory. Therefore, allowing a certain range of error, and only determining a conflict when the difference reaches a second threshold (i.e., the difference is sufficiently significant), can improve both the accuracy of detection and the flexibility and applicability of the detection logic.

[0249] Scenario 3: If the attribute value is of text type, the agent determines the conflict detection result based on the attribute values ​​in the structured summary of the second memory unit and the attribute values ​​in the structured summary of the historical long-term memory.

[0250] Among them, the intelligent agent can use methods such as semantic similarity calculation and keyword matching to determine the conflict detection result.

[0251] Understandably, conflict detection in text-based systems is complex because the same information can be expressed in multiple ways, such as with synonyms, different word orders, or varying levels of detail, and can be influenced by context, tone, or subjective judgment. Therefore, more flexible and intelligent semantic-level judgments by intelligent agents can improve the accuracy of conflict detection.

[0252] Figure 5 This is a schematic diagram of a long-term memory writing device for an intelligent agent, provided as an embodiment of this application. Figure 5 As shown, the long-term memory writing device 500 for an intelligent agent includes:

[0253] The acquisition module 501 is used to extract at least one first memory unit from the agent's session information;

[0254] The filtering module 502 is used to determine the confidence level of each first memory unit and filter at least one first memory unit according to the confidence level of the first memory unit to obtain a second memory unit, wherein the confidence level is used to characterize the accuracy of the first memory unit;

[0255] The mapping module 503 is used to identify whether there is sensitive information in the second memory unit. If there is sensitive information in the second memory unit, the second memory unit is desensitized according to the sensitivity level of the sensitive information to obtain the long-term memory to be written.

[0256] Optionally, the mapping module 503 is used for:

[0257] Determine the multi-dimensional score corresponding to the first memory unit. The multi-dimensional score includes at least two of the following: the confidence score of the agent for the first memory unit, the confidence score of the tool invoked by the agent for the first memory unit, the strength score of the retrieval evidence corresponding to the first memory unit, the standardization score of the first memory unit, and the consistency score of multiple information sources of the first memory unit.

[0258] The confidence level of the first memory unit is obtained by weighted summation of the multi-dimensional scores corresponding to the first memory unit.

[0259] Optionally, the mapping module 503 is used for:

[0260] Based on the structured summary of the second memory unit, identify whether there is sensitive information in the second memory unit;

[0261] If sensitive information exists in the second memory unit, and the sensitivity level of the sensitive information is the first level, then the sensitive information is deleted from the structured summary, and the structured summary after deleting the sensitive information is determined as the long-term memory to be written.

[0262] If the sensitivity level of the sensitive information is the second level, then the sensitive information in the structured digest is masked, and the masked structured digest is determined as the long-term memory to be written. The sensitivity of the second level is lower than that of the first level.

[0263] If the sensitivity level of the sensitive information is level three, then the sensitive information in the structured digest is generalized, and the generalized structured digest is determined as the long-term memory to be written. The sensitivity level of level three is lower than that of level two.

[0264] Optionally, the long-term memory writing device for the intelligent agent further includes: a first preprocessing module, used for:

[0265] Determine the event types of each sub-segment in the first memory unit;

[0266] If the event type is a preset sensitive type or a temporary information type, the sub-fragment will be deleted from the first memory unit.

[0267] Optionally, the long-term memory writing device for the intelligent agent further includes: a second preprocessing module, used for:

[0268] Based on historical long-term memories in the long-term memory bank, deduplication is performed on the second memory unit and the long-term memory bank.

[0269] Optionally, the device may also include: a deletion module for:

[0270] Retrieve a candidate set of similar memories from the long-term memory bank, which includes multiple candidate historical long-term memories;

[0271] Determine the similarity between the structured summary of the second memory unit and the structured summaries of the candidate historical long-term memories, and determine the maximum similarity among the similarities corresponding to each candidate historical long-term memory;

[0272] If the maximum similarity is greater than or equal to the first threshold, the candidate historical long-term memory corresponding to the maximum similarity will be deleted from the long-term memory bank.

[0273] Optionally, the long-term memory writing device for the intelligent agent also includes: a third preprocessing module, used for:

[0274] If the maximum similarity is less than the first threshold, then conflict detection is performed on the second memory unit and the historical long-term memory in the long-term memory bank to obtain the conflict detection result. The conflict detection result is used to indicate whether there is a historical long-term memory in the long-term memory bank that conflicts with the second memory unit.

[0275] After obtaining the long-term memory to be written, the methods include:

[0276] If the conflict detection result indicates that there is no historical long-term memory in the long-term memory bank that conflicts with the second memory unit, the long-term memory to be written is written into the long-term memory bank.

[0277] If the conflict detection result indicates that there is a historical long-term memory in the long-term memory bank that conflicts with the second memory unit, a first write approval request is generated, which includes the long-term memory to be written.

[0278] In response to an approval instruction for the first write approval request, the long-term memory to be written is written to the long-term memory bank; or, in response to an approval rejection instruction for the first write approval request, the long-term memory to be written is deleted.

[0279] Optionally, the mapping module 503 is used for:

[0280] If the memory subject identifier and attribute key in the structured summary of the second memory unit are different from the memory subject identifier and attribute key in the structured summary of each historical long-term memory, then the conflict detection result is determined to be that there is no historical long-term memory in the long-term memory bank that conflicts with the second memory unit.

[0281] If the memory subject identifier and attribute key in the structured summary of the second memory unit are the same as the memory subject identifier and attribute key in the structured summary of any historical long-term memory, then the conflict detection result is determined according to the attribute value and attribute value type corresponding to the same attribute key.

[0282] Optionally, the mapping module 503 is used for:

[0283] If the attribute value is of type enumeration or Boolean, and the attribute value in the structured summary of the second memory unit is different from the attribute value in the structured summary of the historical long-term memory, then the conflict detection result is determined to be that there is a historical long-term memory in the long-term memory bank that conflicts with the second memory unit.

[0284] If the attribute values ​​in the structured summary of the second memory unit are the same as the attribute values ​​in the structured summary of the historical long-term memory, then the conflict detection result is determined to be that there is no historical long-term memory in the long-term memory bank that conflicts with the second memory unit.

[0285] Optionally, the mapping module 503 is used for:

[0286] If the attribute value is of type numeric, and the difference between the attribute value in the structured summary of the second memory unit and the attribute value in the structured summary of the historical long-term memory is greater than or equal to the second threshold, then the conflict detection result is determined to be that there is a historical long-term memory in the long-term memory bank that conflicts with the second memory unit.

[0287] If the difference between the attribute values ​​in the structured summary of the second memory unit and the attribute values ​​in the structured summary of the historical long-term memory is less than the second threshold, then the conflict detection result is determined to be that there is no historical long-term memory in the long-term memory bank that conflicts with the second memory unit.

[0288] Optionally, the mapping module 503 is used for:

[0289] If the attribute value is of text type, the agent determines the conflict detection result based on the attribute values ​​in the structured summary of the second memory unit and the attribute values ​​in the structured summary of the historical long-term memory.

[0290] Optionally, the long-term memory writing device for the intelligent agent also includes: a fourth preprocessing module, used for:

[0291] If the confidence level of the second memory unit is greater than or equal to the first confidence threshold, the long-term memory to be written is written into the long-term memory bank.

[0292] If the confidence level of the second memory cell is greater than or equal to the second confidence threshold and less than the first confidence level, a second write approval request is generated, which includes the long-term memory to be written.

[0293] In response to an approval instruction for a second write approval request, the long-term memory to be written is written to the long-term memory bank; or, in response to an approval rejection instruction for a second write approval request, the long-term memory to be written is deleted.

[0294] The long-term memory writing device for the intelligent agent provided in this application embodiment can execute the technical solution shown in the above method embodiment. Its implementation principle and beneficial effects are similar, and will not be repeated here.

[0295] Figure 6 This is a schematic diagram of the structure of an electronic device provided for an exemplary embodiment of this application. Please refer to... Figure 6 The electronic device 600 may include at least one processor 601 for implementing the long-term memory writing method for the intelligent agent provided in the embodiments of this application.

[0296] Optionally, the electronic device 600 further includes at least one memory 602 for storing program instructions and / or data. The memory 602 is coupled to the processor 601. The coupling in this embodiment is an indirect coupling or communication connection between devices, units, or modules, and can be electrical, mechanical, or other forms, used for information exchange between devices, units, or modules. The processor 601 may operate in conjunction with the memory 602. The processor 601 may execute program instructions stored in the memory 602. At least one of the at least one memory may be included in the processor.

[0297] Optionally, the electronic device 600 further includes a communication interface 603 for communicating with other devices via a transmission medium, thereby enabling the electronic device 600 to communicate with other devices. The communication interface 603 may be, for example, a transceiver, interface, bus, circuit, or a device capable of transmitting and receiving functions. The processor 601 can utilize the communication interface 603 to transmit and receive data and / or information, and to implement the methods provided in the embodiments of this application. For details, please refer to the detailed descriptions in the preceding embodiments; further elaboration is not repeated here.

[0298] This application embodiment does not limit the specific connection medium between the processor 601, memory 602, and communication interface 603. This application embodiment... Figure 6 The processor 601, memory 602, and communication interface 603 are connected via bus 604. Bus 604 is... Figure 6 The connections between other components are shown in thick lines only and are not intended to be limiting. This bus can be divided into address bus, data bus, control bus, etc. For ease of illustration, Figure 6 The bus is represented by a single thick line, but this does not mean that there is only one bus or one type of bus.

[0299] It should be understood that the processor in the embodiments of this application can be an integrated circuit chip with signal processing capabilities. In implementation, each step of the above method embodiments can be completed by the integrated logic circuits in the processor's hardware or by instructions in software form. The processor can be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. It can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of this application. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the methods disclosed in the embodiments of this application can be directly embodied in the execution of a hardware decoding processor, or executed by a combination of hardware and software modules in the decoding processor. The software modules can be located in random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, registers, or other mature storage media in the art. The storage medium is located in memory, and the processor reads the information in the memory and, in conjunction with its hardware, completes the steps of the above method.

[0300] It should also be understood that the memory in the embodiments of this application can be volatile memory or non-volatile memory, or may include both volatile and non-volatile memory. The non-volatile memory can be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. The volatile memory can be random access memory (RAM), which is used as an external cache. By way of example, but not limitation, many forms of RAM are available, such as static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous linked dynamic random access memory (SLDRAM), and direct rambus RAM (DR RAM). It should be noted that the memory used in the systems and methods described herein is intended to include, but is not limited to, these and any other suitable types of memory.

[0301] Accordingly, embodiments of this application provide a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, are used to implement the methods described in the above-described method embodiments.

[0302] Accordingly, embodiments of this application may also provide a computer program product, including a computer program, which, when executed by a processor, can implement the methods shown in the above-described method embodiments.

[0303] The terms “unit”, “module”, etc., used in this specification may be used to refer to computer-related entities, hardware, firmware, combinations of hardware and software, software, or software in execution.

[0304] Those skilled in the art will recognize that the various illustrative logical blocks and steps described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application. In the several embodiments provided in this application, it should be understood that the disclosed apparatus, devices, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for example, the division of units is merely a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the shown or discussed mutual couplings or direct couplings or communication connections may be through some interfaces; indirect couplings or communication connections between devices or units may be electrical, mechanical, or other forms.

[0305] The unit described as a separate component may or may not be physically separate. The component shown as a unit may or may not be a physical unit; that is, it may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0306] In addition, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.

[0307] In the above embodiments, the functions of each functional unit can be implemented entirely or partially through software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented entirely or partially in the form of a computer program product. This computer program product includes one or more computer instructions (programs). When the computer program instructions (programs) are loaded and executed on a computer, all or part of the flow or function according to the embodiments of this application is generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that integrates one or more available media. The available medium can be magnetic media (e.g., floppy disk, hard disk, magnetic tape), optical media (e.g., digital video disc (DVD)), or semiconductor media (e.g., solid-state disk (SSD)).

[0308] If this function is implemented as 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 this application, in essence, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, ROM, RAM, magnetic disks, or optical disks.

[0309] The user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties. Furthermore, the collection, use and processing of the relevant data must comply with the relevant laws, regulations and standards of the relevant countries and regions, and corresponding operation entry points are provided for users to choose to authorize or refuse.

[0310] The above are merely specific embodiments of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.

Claims

1. A method for writing long-term memory to an intelligent agent, characterized in that, include: Extract at least one first memory unit from the conversation information of the agent; The confidence level of each first memory unit is determined, and the at least one first memory unit is filtered according to the confidence level of the first memory unit to obtain a second memory unit, wherein the confidence level is used to characterize the accuracy of the first memory unit; If sensitive information is present in the second memory unit, the second memory unit is desensitized according to the sensitivity level of the sensitive information to obtain the long-term memory to be written.

2. The method according to claim 1, characterized in that, Determining the confidence level of each of the first memory cells includes: Determine the multi-dimensional score corresponding to the first memory unit, wherein the multi-dimensional score includes at least two of the following: the confidence score of the agent for the first memory unit, the confidence score of the tool invoked by the agent for the first memory unit, the strength score of the retrieval evidence corresponding to the first memory unit, the standardization score of the first memory unit, and the consistency score of multiple information sources of the first memory unit. The confidence level of the first memory unit is obtained by weighted summation of the multi-dimensional scores corresponding to the first memory unit.

3. The method according to claim 1, characterized in that, The process of identifying whether sensitive information exists in the second memory unit, and if the sensitive information exists in the second memory unit, performing desensitization processing on the second memory unit according to the sensitivity level of the sensitive information to obtain the long-term memory to be written, includes: Based on the structured digest of the second memory cell, identify whether the sensitive information exists in the second memory cell; If the sensitive information exists in the second memory unit, and the sensitivity level of the sensitive information is the first level, then the sensitive information is deleted from the structured digest, and the structured digest after deleting the sensitive information is determined as the long-term memory to be written. If the sensitivity level of the sensitive information is the second level, then the sensitive information in the structured digest is masked, and the masked structured digest is determined as the long-term memory to be written, wherein the sensitivity of the second level is lower than that of the first level. If the sensitivity level of the sensitive information is level three, then the sensitive information in the structured digest is generalized, and the generalized structured digest is determined as the long-term memory to be written, wherein the sensitivity level of level three is lower than that of level two.

4. The method according to any one of claims 1-3, characterized in that, Before determining the confidence level of each of the first memory cells, the method further includes: Determine the event type of each sub-unit in the first memory unit; If the event type is a preset sensitive type or a temporary information type, the sub-unit will be deleted from the first memory unit.

5. The method according to any one of claims 1-3, characterized in that, Before identifying whether the sensitive information exists in the second memory unit, the method further includes: Based on the historical long-term memories in the long-term memory bank, the second memory unit and the long-term memory bank are deduplicated.

6. The method according to claim 5, characterized in that, The step of deduplicating the second memory unit and the long-term memory bank based on historical long-term memories in the long-term memory bank includes: Retrieve a candidate set of similar memories from the long-term memory bank, the candidate set of similar memories including multiple candidate historical long-term memories; Determine the similarity between the structured summary of the second memory unit and the structured summary of the candidate historical long-term memory, and determine the maximum similarity among the similarities corresponding to each candidate historical long-term memory; If the maximum similarity is greater than or equal to a first threshold, the candidate historical long-term memory corresponding to the maximum similarity is deleted from the long-term memory bank.

7. The method according to claim 6, characterized in that, The method further includes: If the maximum similarity is less than the first threshold, then conflict detection is performed on the second memory unit and the historical long-term memory in the long-term memory bank to obtain a conflict detection result. The conflict detection result is used to indicate whether there is a historical long-term memory in the long-term memory bank that conflicts with the second memory unit. After obtaining the long-term memory to be written, the method includes: If the conflict detection result indicates that there is no historical long-term memory in the long-term memory bank that conflicts with the second memory unit, the long-term memory to be written is written into the long-term memory bank. If the conflict detection result indicates that there is a historical long-term memory in the long-term memory bank that conflicts with the second memory unit, a first write approval request is generated, and the first write approval request includes the long-term memory to be written. In response to the approval instruction of the first write approval request, the long-term memory to be written is written to the long-term memory bank; or, in response to the approval rejection instruction of the first write approval request, the long-term memory to be written is deleted.

8. The method according to claim 7, characterized in that, The conflict detection process between the second memory unit and the historical long-term memories in the long-term memory bank, to obtain conflict detection results, includes: If the memory subject identifier and attribute key in the structured summary of the second memory unit are different from the memory subject identifier and attribute key in the structured summary of each historical long-term memory, then the conflict detection result is determined to be that there is no historical long-term memory in the long-term memory bank that conflicts with the second memory unit. If the memory subject identifier and attribute key in the structured summary of the second memory unit are the same as the memory subject identifier and attribute key in the structured summary of any of the historical long-term memories, then the conflict detection result is determined according to the attribute value and attribute value type corresponding to the same attribute key.

9. The method according to claim 8, characterized in that, Determining the conflict detection result based on the attribute values ​​and type of the same attribute key includes: If the attribute value is of type enumeration or Boolean, and the attribute value in the structured summary of the second memory unit is different from the attribute value in the structured summary of the historical long-term memory, then the conflict detection result is determined to be that there is a historical long-term memory in the long-term memory bank that conflicts with the second memory unit; if the attribute value in the structured summary of the second memory unit is the same as the attribute value in the structured summary of the historical long-term memory, then the conflict detection result is determined to be that there is no historical long-term memory in the long-term memory bank that conflicts with the second memory unit.

10. The method according to claim 8, characterized in that, Determining the conflict detection result based on the attribute values ​​and type of the same attribute key includes: If the attribute value is of type numeric, and the difference between the attribute value in the structured summary of the second memory unit and the attribute value in the structured summary of the historical long-term memory is greater than or equal to the second threshold, then the conflict detection result is determined to be that there is a historical long-term memory in the long-term memory bank that conflicts with the second memory unit; if the difference between the attribute value in the structured summary of the second memory unit and the attribute value in the structured summary of the historical long-term memory is less than the second threshold, then the conflict detection result is determined to be that there is no historical long-term memory in the long-term memory bank that conflicts with the second memory unit.

11. The method according to claim 8, characterized in that, Determining the conflict detection result based on the attribute values ​​and type of the same attribute key includes: If the attribute value is of type text, the agent determines the conflict detection result based on the attribute values ​​in the structured summary of the second memory unit and the attribute values ​​in the structured summary of the historical long-term memory.

12. The method according to any one of claims 1-3, characterized in that, After obtaining the long-term memory to be written, the method further includes: If the confidence level of the second memory unit is greater than or equal to the first confidence threshold, the long-term memory to be written is written into the long-term memory bank. If the confidence level of the second memory cell is greater than or equal to the second confidence threshold and less than the first confidence level, a second write approval request is generated, and the second write approval request includes the long-term memory to be written. In response to the approval instruction of the second write approval request, the long-term memory to be written is written to the long-term memory bank; or, in response to the approval rejection instruction of the second write approval request, the long-term memory to be written is deleted.

13. A long-term memory writing device for an intelligent agent, characterized in that, include: The acquisition module is used to extract at least one first memory unit from the session information of the agent; A filtering module is used to determine the confidence level of each first memory unit and to filter the at least one first memory unit according to the confidence level of the first memory unit to obtain a second memory unit, wherein the confidence level is used to characterize the accuracy of the first memory unit; The mapping module is used to identify whether there is sensitive information in the second memory unit. If the sensitive information exists in the second memory unit, the second memory unit is desensitized according to the sensitivity level of the sensitive information to obtain the long-term memory to be written.

14. An electronic device, characterized in that, The electronic device includes: At least one processor; and A memory that is communicatively connected to the at least one processor; The memory stores instructions that can be executed by the at least one processor to cause the electronic device to perform the method as described in any one of claims 1-12.

15. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions, which, when executed by a processor, implement the method as described in any one of claims 1-12.

16. A computer program product, characterized in that, The computer program product includes a computer program that, when executed by a processor, implements the method as described in any one of claims 1-12.