Multi-agent collaborative data processing method and system for audit work
Patent Information
- Application Number
- CN202610879043.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-06-17
- Publication Date
- 2026-09-11
AI Technical Summary
[0007]本发明提供了一种面向审计作业的多智能体协同数据处理方法、系统,克服了上述现有技术之不足,以解决现有审计系统中自然语言查询能力弱、文件解析与数据分析链路割裂、数据库表结构匹配准确性不足、模型配置缺乏组织隔离以及结果输出协议不统一等技术问题
1、通过任务路由模块将审计作业请求分发至数据库查询智能体、文件数据分析智能体或通用推理智能体,避免单一智能体处理复杂任务时的能力混杂问题,提高任务处理准确性。
Smart Images

Figure CN122736796A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the fields of artificial intelligence and audit information technology, and in particular to a multi-agent collaborative data processing method and system for audit operations. Background Technology
[0002] During the audit process, auditors typically need to obtain data from the auditee's financial systems, business systems, contract systems, procurement systems, and various ledger documents, and then filter, correlate, summarize, and identify anomalies in the data. Traditional audit information systems mostly rely on fixed reports, rule queries, or manual configuration, making it difficult to quickly adapt to complex and ever-changing audit issues.
[0003] On the one hand, database queries typically require auditors to understand the database table structure, field meanings, and SQL statement writing rules. Many frontline auditors lack the ability to directly write SQL, leading to reliance on technical personnel for data acquisition and reducing audit efficiency.
[0004] On the other hand, audit materials contain a large number of files in different formats such as Word, Excel, PDF, OFD, images, PPT, and CSV. Existing tools often can only parse a single format and cannot perform continuous analysis of multiple files, multiple tables, and multiple rounds of issues in the same session.
[0005] Meanwhile, existing intelligent question-answering systems are usually based on a single model or a single intelligent agent, lacking a task diversion mechanism for database queries, file data analysis, and general question-answering. This leads to problems such as context confusion, uncontrolled tool calls, and inconsistent output formats during the execution of complex auditing tasks.
[0006] Furthermore, in government, enterprise, and auditing scenarios, the system also needs to adapt to different organizations' model configurations, permission boundaries, domestic databases, and IT innovation environments. Existing solutions lack sufficient overall collaborative support for organization-level model configuration, domestic database connectivity, agent state persistence, and streaming output protocols. Summary of the Invention
[0007] This invention provides a multi-agent collaborative data processing method and system for auditing tasks, which overcomes the shortcomings of the prior art and solves the technical problems in existing auditing systems such as weak natural language query capabilities, fragmented file parsing and data analysis links, insufficient accuracy of database table structure matching, lack of organizational isolation in model configuration, and inconsistent result output protocols.
[0008] To address the above problems, one of the technical solutions of this invention is implemented through the following method: a multi-agent collaborative data processing method for auditing tasks, comprising the following steps: Receive audit job requests, which include user identifier, organization code, session identifier, natural language query content, and optional uploaded file information; The task type is determined based on the audit job request, and the task type is routed to the agent; the task types include database query tasks, file data analysis tasks, and general question answering tasks. Based on the organization encoding, the corresponding large language model instance is obtained from the multi-model configuration, and the statement adapted to the target database is generated. Combine the statements adapted to the target database, call the corresponding agent to perform audit processing according to the task type, and output the execution results; The execution results of each agent are encapsulated into streaming response data with data type tags and output to the front end; Obtain agent state information and persistently store audit job requests, execution results, and agent state information.
[0009] The above process determines the task type based on the audit job request and routes the task type to the agent. The task types include database query tasks, file data analysis tasks, and general question-answering tasks; including: When an audit job request includes a question-and-answer type field, it is routed according to the question-and-answer type field. When an audit job request does not carry a question-and-answer type field or the question-and-answer type field does not meet the preset routing conditions, semantic routing is performed based on the natural language query content, uploaded file information and session context. Specifically, database query tasks are routed to the Text2SQL agent, file data analysis tasks are routed to the file data analysis agent, and general question answering tasks are routed to the general ReAct agent.
[0010] The above-mentioned method, based on organizational coding, retrieves the corresponding large language model instance from a multi-model configuration and generates statements adapted to the target database, including: Organize the coding in the enabled model configuration set according to the priority of exact match, longest prefix match, and default configuration; The matched model configurations are cached in memory, and the cache is invalidated when the configurations are added, modified, or deleted. Large language model instances with the same model configuration are cached for a limited time to reduce the need for repeated connection creation; different organization codes can correspond to different model service addresses, model names, model parameters and authentication information.
[0011] The above statements, combined with the target database adaptation, invoke the corresponding agent to perform audit processing based on the task type and output the execution results; including: When the task type is a database query task, the database query agent is invoked to perform table structure matching, table relationship retrieval, query statement generation, query statement execution, result summarization, and result rendering. When the task type is a file data analysis task, the file data analysis agent is invoked to perform file type detection, file parsing, table data registration, query statement generation, query statement execution, result summarization, and result rendering. When the task type is a general question-and-answer task, a general reasoning agent is invoked to generate a response by combining tool calls and contextual memory.
[0012] The above table structure matching includes hybrid retrieval and table structure index persistence, where: The hybrid retrieval includes: organizing the database table structure, field information, field comments, and table comments into a set of table structure documents; performing keyword segmentation on the user's natural language query content and the set of table structure documents, and calculating a first relevance ranking result based on a keyword retrieval model; converting the natural language query content and the set of table structure documents into vector representations through an embedding model, and obtaining a second relevance ranking result based on vector similarity; fusing the first and second relevance ranking results using a reciprocal ranking fusion method to obtain a candidate table set; and re-ranking the candidate table set using a re-ranking model to select relevant data tables that meet preset quantity conditions or preset score conditions. The table structure index persistence step includes: generating a fingerprint identifier based on the database schema information; loading the persisted vector index when the fingerprint identifier matches the saved fingerprint identifier; and regenerating the vector representation of the table structure document set when the fingerprint identifier does not match the saved fingerprint identifier, constructing a new vector index and storing it persistently. The fingerprint identifier is generated based on at least one or more of the following: table name, field name, field type, field comment, and table comment.
[0013] The above table relationship retrieval, query statement generation, query statement execution, result summarization, and result rendering include: Table relationship retrieval: Store the primary and foreign key relationships, reference relationships, or business association relationships between database tables as graph structure data; Based on the relevant data tables obtained through table structure matching, query the connection paths between the relevant data tables in the graph structure data; Input the connection paths, the table structure information of the relevant data tables, and the natural language query content into the query statement generation step, so that the generated query statement includes the corresponding table join conditions, filtering conditions, aggregation conditions, and sorting conditions; Query statement generation: Generate SQL statements adapted to the target database dialect based on a large language model; perform at least one of the following checks before executing the SQL statement: statement type validation, table name validation, or field name validation; Query execution: Execute the validated SQL statement through the database connection pool and obtain the structured query results; Results Summary: Natural language audit analysis summary generated based on structured query results; Result rendering: Based on the number of data columns, field semantics, and chart type request of the query results, select one of the following display formats: table, bar chart, line chart, or pie chart, and downgrade to table display if the chart display conditions are not met.
[0014] The aforementioned file type detection includes: reading the file byte stream of the uploaded file and performing a first type identification based on the file header features; when the first type identification does not yield a definite result, performing a second type identification based on the file extension; when the second type identification does not yield a definite result, performing a third type identification based on the content type reported by the client; for office document formats with compressed package structures, further parsing the internal directory or identifier files of the compressed package to distinguish between word processing documents, spreadsheet documents, presentation documents, and layout documents.
[0015] The above-mentioned file parsing, table data registration, query statement generation, query statement execution, result summarization, and result rendering include: Document parsing: For text processing documents, extract paragraphs, heading levels, lists, tables, and text styles and convert them into structured text; for spreadsheet documents, extract worksheets, column names, column types, and cell data; for PDF documents, determine whether they are text-based or scanned PDFs; text-based PDFs are parsed using text-level extraction, while scanned PDFs are parsed using OCR recognition; for layout documents, first convert them into parsable documents or images before performing text extraction or OCR recognition; for image files, extract text content using OCR recognition; create or acquire independent memory analysis database instances at the session identifier level. Table data registration: Register one or more worksheets from the uploaded file as virtual tables in the in-memory analysis database instance; normalize the column names of the virtual tables to meet query compatibility requirements; Query statement generation: Generate query statements adapted to the memory analysis database instance based on natural language query content and virtual table metadata; Query execution: Execute the query to obtain file data analysis results; multiple uploaded files under the same session ID can be linked across files using unified directory information.
[0016] The above encapsulates the execution results of each agent into streaming response data with data type tags and outputs it to the front end; including: The streaming response data with data type tags includes at least one of task identifier data, answer text data, business data, and stream end data; wherein, task identifier data is used to identify the task corresponding to the current audit job request, answer text data is used to carry natural language response fragments, business data is used to carry tabular or chart data, and stream end data is used to indicate that the corresponding agent has completed execution; and / or, the step of obtaining agent state information and persistently storing the audit job request, execution result, and agent state information includes: storing question and answer records, query results, model configuration, prompt word information, and agent dialogue state to a relational database; wherein, the relational database includes domestic databases, which are connected through a unified database access interface, and convert the binary large objects, character large objects, or driver layer objects returned by the database into native data types that can be processed by computer programs.
[0017] The second technical solution of this invention is achieved through the following means: a multi-agent collaborative data processing system for auditing tasks, using a multi-agent collaborative data processing method for auditing tasks, including: The audit request module receives audit job requests, which include user identifier, organization code, session identifier, natural language query content, and optional upload file information. The task routing module determines the task type based on the audit job request and routes the task type to the agent; the task types include database query tasks, file data analysis tasks, and general question answering tasks. The model acquisition module retrieves the corresponding large language model instance from the multi-model configuration based on the organization encoding, and generates statements adapted to the target database. The audit processing module, in conjunction with statements adapted to the target database, calls the corresponding intelligent agent to perform audit processing based on the task type and outputs the execution results; The result encapsulation module encapsulates the execution results of each agent into streaming response data with data type tags and outputs it to the front end; The information storage module acquires agent status information and persistently stores audit job requests, execution results, and agent status information.
[0018] Compared with the prior art, the present invention has the following advantages: 1. The task routing module distributes audit job requests to database query agents, file data analysis agents, or general reasoning agents, avoiding the problem of mixed capabilities when a single agent handles complex tasks and improving the accuracy of task processing.
[0019] 2. By combining keyword retrieval, vector retrieval, inverse ranking fusion, and reordering into a table structure matching mechanism, the accuracy of matching between natural language queries and database table structures is improved, enabling auditors to complete database queries without needing to master SQL syntax.
[0020] 3. By using a session-level memory analysis database management mechanism, data from multiple files and multiple sheets can be registered as queryable virtual tables, enabling one-time upload, multiple rounds of analysis, and cross-file relational queries, thereby improving the efficiency of audit file analysis.
[0021] 4. By employing multi-level file type detection and multi-format parsing strategies, the system's compatibility with audit materials such as Word, Excel, PDF, OFD, images, PPT, and CSV is improved, reducing the file parsing failure rate.
[0022] 5. Through dynamic configuration of organizational-level models and model instance caching mechanisms, different organizations can use different model backends or parameter configurations, meeting the needs of organizational isolation, information technology innovation adaptation, and flexible operation and maintenance in government and enterprise scenarios.
[0023] 6. By using a streaming output protocol with data type tags, answer text, business data, chart data, and stream end status can be rendered in real time and in layers by the front end, improving user interaction experience and system scalability. Attached Figure Description
[0024] The specific embodiments of the present invention will be described in further detail below with reference to the accompanying drawings.
[0025] Figure 1 This is a flowchart of the method in Embodiment 1 of the present invention.
[0026] Figure 2 This is a flowchart of the task routing module in Embodiment 2 of the present invention.
[0027] Figure 3 This is a flowchart of the general reasoning agent module in Embodiment 2 of the present invention.
[0028] Figure 4 This is a flowchart of the database query agent module in Embodiment 2 of the present invention.
[0029] Figure 5 This is a flowchart of the intelligent file parsing pipeline in Embodiment 2 of the present invention.
[0030] Figure 6 This is a flowchart of the document data analysis intelligent agent in Embodiment 2 of the present invention.
[0031] Figure 7 This is a flowchart of the multi-model dynamic configuration process in Embodiment 2 of the present invention.
[0032] Figure 8This is a flowchart of the unified streaming output in Embodiment 2 of the present invention.
[0033] Figure 9 This is a system architecture diagram of Embodiment 3 of the present invention. Detailed Implementation
[0034] The present invention is not limited to the following embodiments, and the specific implementation can be determined according to the technical solution of the present invention and the actual situation.
[0035] Example 1: As Figure 1 As shown in the figure, this invention discloses a multi-agent collaborative data processing method for auditing tasks, including the following steps: S101, Receive audit job request, wherein the audit job request includes user identifier, organization code, session identifier, natural language query content and optional uploaded file information; S102, determine the task type based on the audit job request, and route the task type to the agent; the task types include database query tasks, file data analysis tasks, and general question answering tasks; S103, Based on the organization encoding, obtain the corresponding large language model instance from the multi-model configuration and generate a statement adapted to the target database; S104, combining the statements adapted to the target database, calls the corresponding intelligent agent to perform audit processing according to the task type, and outputs the execution results; S105, encapsulate the execution results of each agent into streaming response data with data type tags, and output it to the front end; S106, Obtain agent state information and persistently store audit job requests, execution results, and agent state information.
[0036] In step S102 above, such as Figure 2 As shown, the task type is determined based on the audit job request, and the task type is routed to the agent. The task types include database query tasks, file data analysis tasks, and general question-and-answer tasks; including: When an audit job request includes a question-and-answer type field, it is routed according to the question-and-answer type field. When an audit job request does not carry a question-and-answer type field or the question-and-answer type field does not meet the preset routing conditions, semantic routing is performed based on the natural language query content, uploaded file information and session context. Specifically, database query tasks are routed to the Text2SQL agent, file data analysis tasks are routed to the file data analysis agent, and general question answering tasks are routed to the general ReAct agent.
[0037] In step S103 above, obtaining the corresponding large language model instance from the multi-model configuration based on organization encoding includes: Organize the coding in the enabled model configuration set according to the priority of exact match, longest prefix match, and default configuration; The matched model configurations are cached in memory, and the cache is invalidated when the configurations are added, modified, or deleted. Large language model instances with the same model configuration are cached for a limited time to reduce the need for repeated connection creation; different organization codes can correspond to different model service addresses, model names, model parameters and authentication information.
[0038] In step S104 above, the corresponding agent is invoked to perform audit processing according to the task type, and the execution result is output; including: When the task type is a database query task, the database query agent is invoked to perform table structure matching, table relationship retrieval, query statement generation, query statement execution, result summarization, and result rendering. When the task type is a file data analysis task, the file data analysis agent is invoked to perform file type detection, file parsing, table data registration, query statement generation, query statement execution, result summarization, and result rendering. When the task type is a general question-and-answer task, a general reasoning agent is invoked to generate a response by combining tool calls and contextual memory.
[0039] The table structure matching process includes a hybrid retrieval step and a table structure index persistence step, wherein: The hybrid retrieval steps include: organizing the database table structure, field information, field comments, and table comments into a table structure document set; performing keyword segmentation on the user's natural language query content and the table structure document set, and calculating the first relevance ranking result based on the keyword retrieval model; converting the natural language query content and the table structure document set into vector representations through an embedding model, and obtaining the second relevance ranking result based on vector similarity; fusing the first relevance ranking result and the second relevance ranking result using a reordering fusion method to obtain a candidate table set; and re-ranking the candidate table set through a reordering model to select relevant data tables that meet preset quantity conditions or preset score conditions. The table structure index persistence steps include: generating a fingerprint identifier based on the database schema information; loading the persisted vector index when the fingerprint identifier matches the saved fingerprint identifier; and regenerating the vector representation of the table structure document set when the fingerprint identifier does not match the saved fingerprint identifier, constructing a new vector index and storing it persistently. The fingerprint identifier is generated based on at least one or more of the following: table name, field name, field type, field comment, and table comment.
[0040] The table relationship acquisition process includes: storing primary and foreign key relationships, reference relationships, or business association relationships between database tables as graph structure data; querying the connection paths between related data tables in the graph structure data based on the related data tables obtained through table structure matching; and inputting the connection paths, the table structure information of related data tables, and natural language query content into the query statement generation step, so that the generated query statement includes the corresponding table join conditions, filtering conditions, aggregation conditions, and sorting conditions.
[0041] The query statement generation, query statement execution, result summarization, and result rendering include: Query statement generation: Generate SQL statements adapted to the target database dialect based on a large language model; perform at least one of the following checks before executing the SQL statement: statement type validation, table name validation, or field name validation; Query execution: Execute the validated SQL statement through the database connection pool and obtain the structured query results; Results Summary: Natural language audit analysis summary generated based on structured query results; Result rendering: Based on the number of data columns, field semantics, and chart type request of the query results, select one of the following display formats: table, bar chart, line chart, or pie chart, and downgrade to table display if the chart display conditions are not met.
[0042] The file type detection includes: reading the file byte stream of the uploaded file and performing a first type identification based on the file header features; when the first type identification does not yield a definite result, performing a second type identification based on the file extension; when the second type identification does not yield a definite result, performing a third type identification based on the content type reported by the client; for office document formats with compressed package structures, further parsing the internal directory or identifier files of the compressed package to distinguish between word processing documents, spreadsheet documents, presentation documents, and layout documents.
[0043] The file parsing process includes: for text processing documents, extracting paragraphs, heading levels, lists, tables, and text styles and converting them into structured text; for spreadsheet documents, extracting worksheets, column names, column types, and cell data; for PDF documents, determining whether they are text-based or scanned PDFs, parsing text-based PDFs using text-level extraction and scanned PDFs using OCR recognition; for layout documents, first converting them into parsable documents or images before performing text extraction or OCR recognition; for image files, extracting text content using OCR recognition; and creating or acquiring independent in-memory analysis database instances at the session identifier level.
[0044] The table data registration, query statement generation, and query statement execution include: Table data registration: Register one or more worksheets from the uploaded file as virtual tables in the in-memory analysis database instance; normalize the column names of the virtual tables to meet query compatibility requirements; Query statement generation: Generate query statements adapted to the memory analysis database instance based on natural language query content and virtual table metadata; Query execution: Execute the query to obtain file data analysis results; multiple uploaded files under the same session ID can be linked across files using unified directory information.
[0045] The general reasoning agent adopts an alternating reasoning and action execution mode, including: taking the user's natural language query content, the parsed file content, and the historical conversation summary as context input; determining whether to call external tools based on a large language model; when external tools need to be called, connecting to the external tool service through a standardized tool protocol and obtaining the tool's return result; continuing reasoning based on the tool's return result until a response is generated; and serializing the dialogue state during the agent's execution process and storing it in the database to restore the context in cross-conversation scenarios.
[0046] In step S105 above, the execution results of each agent are encapsulated into streaming response data with data type tags and output to the front end; including: The streaming response data with data type tags includes at least one of task identification data, answer text data, business data, and stream end data; wherein, task identification data is used to identify the task corresponding to the current audit job request, answer text data is used to carry natural language response fragments, business data is used to carry tabular data or chart data, and stream end data is used to indicate that the corresponding agent has completed execution.
[0047] In S106 above, the agent state information is obtained, and the audit job request, execution result and agent state information are persistently stored, including: storing question and answer records, query results, model configuration, prompt word information and agent dialogue state to a relational database; wherein, the relational database includes domestic databases, which are connected through a unified database access interface, and converting the binary large objects, character large objects or driver layer objects returned by the database into native data types that can be processed by computer programs.
[0048] Example 2: This embodiment of the invention discloses a multi-agent collaborative data processing system for auditing tasks, using a multi-agent collaborative data processing method for auditing tasks, including: The audit request module receives audit job requests, which include user identifier, organization code, session identifier, natural language query content, and optional upload file information. The task routing module determines the task type based on the audit job request and routes the task type to the agent; the task types include database query tasks, file data analysis tasks, and general question answering tasks. The model acquisition module retrieves the corresponding large language model instance from the multi-model configuration based on the organization encoding, and generates statements adapted to the target database. The audit processing module, in conjunction with statements adapted to the target database, calls the corresponding intelligent agent to perform audit processing based on the task type and outputs the execution results; The result encapsulation module encapsulates the execution results of each agent into streaming response data with data type tags and outputs it to the front end; The information storage module acquires agent status information and persistently stores audit job requests, execution results, and agent status information.
[0049] like Figure 2 As shown, after receiving a request from a front-end user, the task routing module first performs identity authentication verification. After successful authentication, the system parses the question-and-answer type field in the request or performs semantic routing based on the query content, distributing the general question-and-answer task, database query task, and file data analysis task to the corresponding general ReAct agent, Text2SQL agent, and file data analysis agent, respectively. After each agent queries the user's organization code, each agent calls the model configuration model according to the user's organization code to obtain the organization-specific model instance before execution, and returns the result through the unified streaming output module after execution.
[0050] like Figure 7 As shown, the above model acquisition module is a dynamic configuration of multiple models, and the specific process is as follows: Upon receiving the organization code, the model acquisition module first checks if the memory cache has expired. If expired, it loads the enabled model configuration from the configuration database and writes it to the cache. Then, it determines the model configuration in the order of exact match, longest prefix match, and default configuration match. If a match is successful, the system further checks if the model instance cache is hit. If it is, the instance is returned directly; otherwise, a new instance is created and written to the cache.
[0051] The aforementioned audit processing modules include a database query agent module, a file data analysis agent module, and a general reasoning agent module; among them, The database query agent module, when the task type is a database query task, calls the database query agent to perform table structure matching, table relationship retrieval, query statement generation, query statement execution, result summarization and result rendering. The file data analysis intelligent agent module, when the task type is file data analysis task, calls the file data analysis intelligent agent to perform file type detection, file parsing, table data registration, query statement generation, query statement execution, result summarization and result rendering. The general reasoning agent module, when the task type is a general question-and-answer task, calls the general reasoning agent to generate a response by combining tool calls and context memory.
[0052] Among them, the database query intelligent agent module, such as Figure 4 As shown, the database query agent executes the query using a state diagram approach. Specifically: S1. In the table structure awareness and index preparation (schema_inspector) step, load the table structure and determine whether the schema fingerprint has changed; then perform keyword retrieval, vector retrieval, inverse ranking fusion and reordering to determine the relevant table structure; S2. Obtain the relationship between tables by querying the table relationships; S3. Generate SQL statements from the query statement generation steps; S4. The SQL is executed by the query statement execution step and the structured results are returned; S5. Generate an audit analysis summary from the results summary steps; S6. Based on the number of data columns, field semantics, and chart type request of the query results, select one of the following display formats: table, bar chart, line chart, or pie chart. Based on the characteristics of the results, select the table or chart format and output it in a streaming manner.
[0053] The specific implementation of the database query intelligent agent module is as follows: Auditors input "Query the summary of procurement amounts for each department in the past month". The system takes words such as "past month", "department", "procurement", "amount", and "summary" as part of the query intent, performs keyword and vector retrieval with the table structure document set, filters out the procurement table, department table and related detailed tables, and generates an SQL statement that includes time filtering, department grouping and amount aggregation based on the table relationships. After execution, it generates a summary table and natural language conclusions.
[0054] Among them, the general reasoning agent module is as follows: Figure 3 As shown, the general reasoning agent includes an initialization phase, an execution phase, and a middleware / persistence support phase, wherein: Initialization phase: Establish tool protocol connection, initialize dialogue state persistence component and register session summary middleware and context editing middleware; Execution phase: Receives user queries and document structured context, determines whether tools need to be invoked in each round of reasoning, and continues reasoning based on the results returned by the tools until the final answer is generated; the invoked tools include database query tools, document parsing tools, data analysis tools, and chart generation tools; Middleware / Persistence Support Phase: Automatic message digest compression when messages exceed thresholds, retention of recent messages, and cleanup of tool call records.
[0055] The file data analysis intelligent agent module includes a file intelligent parsing pipeline and a file data analysis intelligent agent, such as... Figure 5 As shown, the intelligent file parsing pipeline process is as follows: The intelligent file parsing pipeline first performs MIME type detection on user-uploaded files. The detection process prioritizes file header features, followed by file extensions, and finally the content type reported by the client. For compressed files, it can further parse internal directories or identifying files. The system selects the corresponding parsing engine based on the recognition results and organizes the parsing results into structured content or Markdown text for subsequent intelligent agents to use. Among them, such as Figure 6 As shown, the specific process of the file data analysis intelligent agent is as follows: The file data analysis agent starts in a session-level state, including user queries, file lists, session identifiers, and organization codes. The Excel parsing node reads information from multiple files and multiple sheets, the SQL generation node generates SQL statements adapted to the in-memory analysis database, the SQL execution node executes the queries in the session-level in-memory database, the summary node generates data analysis conclusions, and the rendering node outputs tables or charts based on the chart type.
[0056] The session-level memory analysis database manager can create or retrieve corresponding instances based on session identifiers, register worksheets uploaded within the same session as virtual tables, and clean up special characters in column names. This instance can be configured with a timeout cleanup mechanism to release memory resources after a prolonged period of inactivity.
[0057] The above file intelligent parsing pipeline selects the corresponding parsing engine, including multi-format parsing engines. The specific parsing process is as follows: Word documents (DOCX / DOCM / DOTX / DOTM / WPS / WPT): Parsed using the python-docx library, preserving heading levels, table structure, list formatting, bold / italic text styles, etc., and outputting in Markdown format; For older Word documents (DOC / DOT): First convert them to DOCX using LibreOffice headless mode, then perform the parsing. Spreadsheets (XLSX / XLS / XLSM / XLSB / ODS / CSV): Parsed using pandas + openpyxl / xlrd engine, supporting multi-sheet output; WPS Spreadsheet (ET / ETT / ETS): First, convert it to XLSX using LibreOffice, then perform parsing; during the parsing process, extract structured content (text / tables / images / metadata), and upload the parsed original file and parsing results to MinlO object storage, and perform vectorization processing and Markdown result generation on the stored text blocks and inter-block relationships; PDF documents: First, check if it is a scanned document (containing both text and image layers). Text PDFs are extracted using pymupdf4llm, and scanned PDFs are parsed using the MinerU 3.0 OCR service. OFD formatted documents: Use the easyofd library to convert OFD to PDF, and then call the MinerU OCR service to extract the text; Image files (PNG / JPEG / BMP / TIFF / WEBP): Directly call MinerU OCR service to recognize text; PPT / PPTX documents: parsed using the MinerU API; HTML document: Use HTMLParser to extract text content while preserving the basic structure; Markdown documents: Read text content directly.
[0058] like Figure 8 As shown, the above result encapsulation module is a unified streaming output, which uses a server-side event stream method to output data. The system can first send a task identifier to the front end, and then send answer text fragments multiple times; when there is business data such as charts or tables, a business data marker is sent, and finally a stream end marker is sent.
[0059] In the above embodiments, the domestic database adaptation module can connect to Shentong Database, Dameng Database, Renmin University Kingbase Database or other relational databases through database drivers or bridging methods, and perform type conversion on database-specific large field objects, character objects or time objects, so that agent states, question and answer records, model configurations and business data can be persisted in the information technology innovation environment.
[0060] In the above embodiments, the result rendering module can select output formats such as tables, bar charts, line charts, or pie charts based on the number of data columns, field semantics, and chart request type. When the data does not meet specific chart display conditions, the system automatically downgrades to table display, thereby reducing chart misuse.
[0061] Example 3: As Figure 9As shown in the figure, this invention discloses a multi-agent collaborative data processing system for auditing tasks. The system can adopt a layered architecture, including a business application layer, an AI capability layer, a data service layer, and an infrastructure layer. The business application layer provides auditors with entry points such as intelligent dialogue question answering, intelligent database querying, file data analysis, prompt word management, user management, and model configuration management. The AI capability layer includes an agent orchestration engine, a state graph execution engine, tool protocols, middleware engines, streaming components, and large language model services. The data service layer provides connection pool management, user authentication, prompt word management, question-and-answer record persistence, and model configuration caching. The infrastructure layer may include domestic databases, general relational databases, object storage, graph databases, OCR services, and in-memory analysis databases.
[0062] This invention enables auditors to perform database queries, file data analysis, and generate audit conclusions in natural language through mechanisms such as task routing, dedicated intelligent agent collaboration, hybrid retrieval table structure matching, session-level file data analysis, multi-model dynamic configuration, and structured streaming output.
[0063] In summary, compared with the prior art, the present invention has the following beneficial effects: 1. The task routing module distributes audit job requests to database query agents, file data analysis agents, or general reasoning agents, avoiding the problem of mixed capabilities when a single agent handles complex tasks and improving the accuracy of task processing.
[0064] 2. By combining keyword retrieval, vector retrieval, inverse ranking fusion, and reordering into a table structure matching mechanism, the accuracy of matching between natural language queries and database table structures is improved, enabling auditors to complete database queries without needing to master SQL syntax.
[0065] 3. By using a session-level memory analysis database management mechanism, data from multiple files and multiple sheets can be registered as queryable virtual tables, enabling one-time upload, multiple rounds of analysis, and cross-file relational queries, thereby improving the efficiency of audit file analysis.
[0066] 4. By employing multi-level file type detection and multi-format parsing strategies, the system's compatibility with audit materials such as Word, Excel, PDF, OFD, images, PPT, and CSV is improved, reducing the file parsing failure rate.
[0067] 5. Through dynamic configuration of organizational-level models and model instance caching mechanisms, different organizations can use different model backends or parameter configurations, meeting the needs of organizational isolation, information technology innovation adaptation, and flexible operation and maintenance in government and enterprise scenarios.
[0068] 6. By using a streaming output protocol with data type tags, answer text, business data, chart data, and stream end status can be rendered in real time and in layers by the front end, improving user interaction experience and system scalability.
[0069] Example 4: This embodiment of the invention discloses a storage medium storing a computer program that can be read by a computer. The computer program is configured to execute a multi-agent collaborative data processing method for auditing tasks at runtime.
[0070] The aforementioned storage media may include, but are not limited to, USB flash drives, read-only memory, portable hard drives, magnetic disks, optical disks, and other media capable of storing computer programs.
[0071] Example 5: This embodiment of the invention discloses a terminal: including a processor, a memory, a communication interface, and one or more programs, the one or more programs being stored in the memory and configured to be executed by the processor, the programs including instructions for performing steps in a multi-agent collaborative data processing method for auditing tasks.
[0072] Example 6: This embodiment of the invention discloses an electronic device, including a processor and a memory, wherein the memory stores a computer program, which is loaded and executed by the processor to implement a multi-agent collaborative data processing method for auditing tasks.
[0073] The aforementioned electronic device also includes transmission devices and input / output devices, wherein both the transmission devices and the input / output devices are connected to the processor.
[0074] The processor described above can be a central processing unit (CPU), a general-purpose processor, a digital signal processor (DSP), an ASIC, an FPGA, or other programmable logic devices, transistor logic devices, hardware components, or any combination thereof. It can implement or execute the various exemplary logic blocks, modules, and circuits described in conjunction with the disclosure of this application. It can also be a combination that implements computational functions, such as a combination of one or more microprocessors, a combination of a DSP and a microprocessor, etc. The memory can include, but is not limited to, various media capable of storing computer programs, such as USB flash drives, read-only memory, portable hard drives, magnetic disks, or optical disks.
[0075] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code. The solutions in the embodiments of this application can be implemented in various computer languages, such as the object-oriented programming language Java and the interpreted scripting language JavaScript.
[0076] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart... Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0077] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0078] This application also provides a computer program product, which includes a non-transitory computer-readable storage medium storing a computer program operable to cause a computer to perform some or all of the steps of any of the methods described in the above method embodiments. The computer program product may be a software installation package, and the computer may include an electronic device.
[0079] It should be noted that the specific framework, model, database, OCR service, charting tool, and file parsing tool in the above embodiments can be replaced according to the actual deployment environment. As long as they can achieve the task routing, multi-agent collaborative processing, dual-path analysis of database and file, organizational-level model configuration, and structured streaming output described in this invention, they fall within the protection scope of this invention.
Claims
1. A multi-agent collaborative data processing method for auditing tasks, characterized in that, Includes the following steps: Receive audit job requests, which include user identifier, organization code, session identifier, natural language query content, and optional uploaded file information; The task type is determined based on the audit job request, and the task type is routed to the agent; the task types include database query tasks, file data analysis tasks, and general question answering tasks. Based on the organization encoding, the corresponding large language model instance is obtained from the multi-model configuration, and the statement adapted to the target database is generated. Combine the statements adapted to the target database, call the corresponding agent to perform audit processing according to the task type, and output the execution results; The execution results of each agent are encapsulated into streaming response data with data type tags and output to the front end; Obtain agent state information and persistently store audit job requests, execution results, and agent state information.
2. The multi-agent collaborative data processing method for auditing tasks according to claim 1, characterized in that, The step of determining the task type based on the audit job request and routing the task type to the intelligent agent includes database query tasks, file data analysis tasks, and general question-answering tasks; including: When an audit job request includes a question-and-answer type field, it is routed according to the question-and-answer type field. When an audit job request does not carry a question-and-answer type field or the question-and-answer type field does not meet the preset routing conditions, semantic routing is performed based on the natural language query content, uploaded file information and session context. Specifically, database query tasks are routed to the Text2SQL agent, file data analysis tasks are routed to the file data analysis agent, and general question answering tasks are routed to the general ReAct agent.
3. The multi-agent collaborative data processing method for auditing tasks according to claim 1, characterized in that, The step of obtaining the corresponding large language model instance from the multi-model configuration based on organization encoding and generating an application access instance adapted to the user includes: Organize the coding in the enabled model configuration set according to the priority of exact match, longest prefix match, and default configuration; The matched model configurations are cached in memory, and the cache is invalidated when the configurations are added, modified, or deleted. Large language model instances with the same model configuration are cached for a limited time to reduce the need for repeated connection creation; different organization codes can correspond to different model service addresses, model names, model parameters and authentication information.
4. The multi-agent collaborative data processing method for auditing tasks according to claim 1, characterized in that, The statement, combined with the target database, calls the corresponding agent to perform audit processing according to the task type and outputs the execution result; including: When the task type is a database query task, the database query agent is invoked to perform table structure matching, table relationship retrieval, query statement generation, query statement execution, result summarization, and result rendering. When the task type is a file data analysis task, the file data analysis agent is invoked to perform file type detection, file parsing, table data registration, query statement generation, query statement execution, result summarization, and result rendering. When the task type is a general question-and-answer task, a general reasoning agent is invoked to generate a response by combining tool calls and contextual memory.
5. The multi-agent collaborative data processing method for auditing tasks according to claim 4, characterized in that, Table structure matching includes hybrid retrieval and table structure index persistence, where: The hybrid retrieval includes: organizing the database table structure, field information, field comments, and table comments into a set of table structure documents; performing keyword segmentation on the user's natural language query content and the set of table structure documents, and calculating a first relevance ranking result based on a keyword retrieval model; converting the natural language query content and the set of table structure documents into vector representations through an embedding model, and obtaining a second relevance ranking result based on vector similarity; fusing the first and second relevance ranking results using a reciprocal ranking fusion method to obtain a candidate table set; and re-ranking the candidate table set using a re-ranking model to select relevant data tables that meet preset quantity conditions or preset score conditions. The table structure index persistence step includes: generating a fingerprint identifier based on the database schema information; loading the persisted vector index when the fingerprint identifier matches the saved fingerprint identifier; and regenerating the vector representation of the table structure document set when the fingerprint identifier does not match the saved fingerprint identifier, constructing a new vector index and storing it persistently. The fingerprint identifier is generated based on at least one or more of the following: table name, field name, field type, field comment, and table comment.
6. The multi-agent collaborative data processing method for auditing tasks according to claim 4, characterized in that, The process includes retrieving table relationships, generating query statements, executing query statements, summarizing results, and rendering results, including: Table relationship retrieval: Store the primary and foreign key relationships, reference relationships, or business association relationships between database tables as graph structure data; Based on the relevant data tables obtained through table structure matching, query the connection paths between the relevant data tables in the graph structure data; Input the connection paths, the table structure information of the relevant data tables, and the natural language query content into the query statement generation step, so that the generated query statement includes the corresponding table join conditions, filtering conditions, aggregation conditions, and sorting conditions; Query statement generation: Generate SQL statements adapted to the target database dialect based on a large language model; perform at least one of the following checks before executing the SQL statement: statement type validation, table name validation, or field name validation; Query execution: Execute the validated SQL statement through the database connection pool and obtain the structured query results; Results Summary: Natural language audit analysis summary generated based on structured query results; Result rendering: Based on the number of data columns, field semantics, and chart type request of the query results, select one of the following display formats: table, bar chart, line chart, or pie chart, and downgrade to table display if the chart display conditions are not met.
7. The multi-agent collaborative data processing method for auditing tasks according to claim 4, characterized in that, File type detection includes: reading the file byte stream of the uploaded file and performing first type identification based on the file header features; when the first type identification does not yield a definite result, performing second type identification based on the file extension; when the second type identification does not yield a definite result, performing third type identification based on the content type reported by the client; for office document formats with compressed package structures, further parsing the internal directory or identifier files of the compressed package to distinguish between word processing documents, spreadsheet documents, presentation documents, and layout documents.
8. The multi-agent collaborative data processing method for auditing tasks according to claim 4, characterized in that, File parsing, table data registration, query statement generation, query statement execution, result summarization, and result rendering, including: Document parsing: For text processing documents, extract paragraphs, heading levels, lists, tables, and text styles and convert them into structured text; for spreadsheet documents, extract worksheets, column names, column types, and cell data; for PDF documents, determine whether they are text-based or scanned PDFs; text-based PDFs are parsed using text-level extraction, while scanned PDFs are parsed using OCR recognition; for layout documents, first convert them into parsable documents or images before performing text extraction or OCR recognition; for image files, extract text content using OCR recognition; create or acquire independent memory analysis database instances at the session identifier level. Table data registration: Register one or more worksheets from the uploaded file as virtual tables in the in-memory analysis database instance; normalize the column names of the virtual tables to meet query compatibility requirements; Query statement generation: Generate query statements adapted to the memory analysis database instance based on natural language query content and virtual table metadata; Query execution: Execute the query to obtain file data analysis results; multiple uploaded files under the same session ID can be linked across files using unified directory information.
9. The multi-agent collaborative data processing method for auditing tasks according to claim 1, characterized in that, The execution results of each agent are encapsulated into streaming response data with data type tags and output to the front end; include: The streaming response data with data type tags includes at least one of task identifier data, answer text data, business data, and stream end data; wherein, task identifier data is used to identify the task corresponding to the current audit job request, answer text data is used to carry natural language response fragments, business data is used to carry tabular or chart data, and stream end data is used to indicate that the corresponding agent has completed execution; and / or, the step of obtaining agent state information and persistently storing the audit job request, execution result, and agent state information includes: storing question and answer records, query results, model configuration, prompt word information, and agent dialogue state to a relational database; wherein, the relational database includes domestic databases, which are connected through a unified database access interface, and convert the binary large objects, character large objects, or driver layer objects returned by the database into native data types that can be processed by computer programs.
10. A multi-agent collaborative data processing system for auditing operations, characterized in that, Using a multi-agent collaborative data processing method for auditing tasks as described in any one of claims 1 to 9, comprising: The audit request module receives audit job requests, which include user identifier, organization code, session identifier, natural language query content, and optional upload file information. The task routing module determines the task type based on the audit job request and routes the task type to the agent; the task types include database query tasks, file data analysis tasks, and general question answering tasks. The model acquisition module retrieves the corresponding large language model instance from the multi-model configuration based on the organization encoding, and generates statements adapted to the target database. The audit processing module, in conjunction with statements adapted to the target database, calls the corresponding intelligent agent to perform audit processing based on the task type and outputs the execution results; The result encapsulation module encapsulates the execution results of each agent into streaming response data with data type tags and outputs it to the front end; The information storage module acquires agent status information and persistently stores audit job requests, execution results, and agent status information.