Automated regulatory reporting system using large language models
Computer-implement system and method respond to regulatory queries using a modular orchestration framework that leverages large language models (LLMs). A backend computer system receives a regulatory query from a user and identifies subtasks such as regulation interpretation, task matching, and code explanation. For each subtask, the system retrieves a pre-authored natural language prompt from a prompt library and invokes an LLM hosted remotely to generate an intermediate output. The orchestration engine processes the intermediate outputs to produce a structured, machine-readable response, which is returned to the user device. Subtasks may be executed via specialized agents or services, and the structured response may include regulatory summaries, task metadata, and source code explanations. The architecture enables scalable, context-sensitive use of general-purpose LLMs for compliance-related reasoning, while improving traceability, consistency, and output structure through prompt curation and task orchestration.
1 . A computer-implemented method for responding to a regulatory query pertaining to an enterprise, comprising:
receiving, by an orchestration engine executing on a backend computer system for the enterprise, a query from a user device, the query pertaining to a regulatory requirement associated with a product or service of the enterprise;
identifying, by the orchestration engine, a plurality of subtasks to fulfill the query, the subtasks including at least a regulation interpretation subtask, a task-matching subtask, and a code-explanation subtask;
selecting, by the orchestration engine, for each of the subtasks, a corresponding software agent of the orchestration engine, wherein each corresponding software agent comprises executable instructions and is configured to retrieve a task-specific prompt template from a prompt library and to invoke a large language model (LLM) using the task-specific prompt template, wherein the LLM is hosted on a computing infrastructure remote from the orchestration engine;
for each of the plurality of subtasks:
retrieving, by the corresponding software agent of the orchestration engine, the task-specific prompt template from a prompt library stored in memory, the prompt library comprising pre-authored natural language prompts associated with respective regulatory subtasks;
invoking, by the orchestration engine, the LLM, wherein invoking the LLM comprises;
invoking the LLM via an LLM interface over an electronic data network using an authenticated API call;
providing the task-specific prompt template and associated contextual data to the LLM; and
receiving, by the orchestration engine, from the LLM, an intermediate output generated in response to the task-specific prompt template;
processing, by the backend computer system, the intermediate outputs of the subtasks to generate a structured response, wherein the structured response comprises a machine-readable, electronically formatted structured response; and
transmitting, by the backend computer system, the structured response to the user device.
2 . The method of claim 1 , wherein the task-specific prompt template comprises a natural language function description and a structured reasoning strategy defined in the prompt library.
3 . The method of claim 1 , wherein invoking the LLM comprises executing a stateless microservice configured to format the task-specific prompt template and communicate with the LLM.
4 . The method of claim 1 , wherein invoking the LLM comprises executing a callable software agent comprising executable instructions for preparing inputs, invoking the LLM, and post-processing outputs.
5 . The method of claim 1 , wherein the structured response comprises: (i) a regulatory summary section comprising simplified text derived from the regulation; (ii) a task record section listing relevant task records with metadata; and (iii) a code explanation section comprising textual summaries of associated source code segments.
6 . The method of claim 1 , wherein the regulation interpretation subtask is performed by invoking a regulation summary agent configured to generate a regulatory summary for a relevant regulation pertaining to the regulatory query by extracting and simplifying provisions from a stored regulatory document pertaining to the relevant regulation using a summarization prompt.
7 . The method of claim 6 , wherein the task-matching subtask is performed by invoking a task-matching agent configured to compute a relevance score for each task record based on semantic similarity to the regulatory summary.
8 . The method of claim 7 , wherein the code-explanation subtask is performed by invoking a code explanation agent configured to extract referenced source code segments linked to task records and generate a natural language explanation using a pre-authored code summarization prompt.
9 . The method of claim 8 , further comprising retrieving, by the orchestration engine, from the prompt library, a prompt sequence comprising a regulatory summary prompt, a task-matching prompt, and a code explanation prompt, wherein the sequence is stored in a workflow graph data structure.
10 . The method of claim 1 , wherein the orchestration engine is executed as a containerized service deployed in a cloud-based computing environment, wherein the containerized service comprises orchestration logic, prompt management, and agent invocation modules.
11 . The method of claim 1 , further comprising dynamically formatting, by the backend computer system, the structured response based on a role of a user logged in via the user device.
12 . A computer system for responding to a regulatory query pertaining to an enterprise, comprising:
a backend computer system configured to receive, from a user device, a query pertaining to a regulatory requirement associated with a product or service of the enterprise;
a memory storing a prompt library comprising pre-authored natural language prompts associated with respective regulatory subtasks;
an orchestration engine executed on the backend computer system and configured to:
identify a plurality of subtasks to fulfill the query, the subtasks including at least a regulation interpretation subtask, a task-matching subtask, and a code-explanation subtask;
select, for each of the subtasks, a corresponding software agent of the orchestration engine, wherein each corresponding software agent comprises executable instructions and is configured to retrieve a task specific prompt template from the prompt library and to invoke a large language model (LLM) using the task-specific prompt template, wherein the LLM is hosted on a computing infrastructure remote from the backend computer system; and
for each of the plurality of subtasks:
retrieve a task-specific prompt template from the prompt library;
invoke the LLM, wherein invoking the LLM comprises:
invoking the LLM via an LLM interface over an electronic data network using an authenticated API call;
providing the task-specific prompt template and associated contextual data to the LLM; and
receive an intermediate output generated in response to the task-specific prompt template;
wherein the backend computer system is configured to:
process the intermediate outputs of the subtasks to generate a structured response, wherein the structured response comprises a machine-readable, electronically formatted structured response; and
transmit the structured response to the user device.
13 . The system of claim 12 , wherein the task-specific prompt template comprises a natural language function description and a structured reasoning strategy defined in the prompt library.
14 . The system of claim 12 , wherein the orchestration engine is configured to invoke the LLM by executing a stateless microservice configured to format the task-specific prompt template and communicate with the LLM.
15 . The system of claim 12 , wherein the orchestration engine is configured to invoke the LLM by executing a callable software agent comprising executable instructions for preparing inputs, invoking the LLM, and post-processing outputs.
16 . The system of claim 12 , wherein the structured response comprises:
a regulatory summary section comprising simplified text derived from the regulation;
a task record section listing relevant task records with metadata; and
a code explanation section comprising textual summaries of associated source code segments.
17 . The system of claim 12 , wherein the orchestration engine is further configured to invoke a regulation summary agent to generate a regulatory summary by extracting and simplifying provisions from a stored regulatory document using a summarization prompt.
18 . The system of claim 17 , wherein the orchestration engine is further configured to invoke a task-matching agent to compute a relevance score for each task record based on semantic similarity to the regulatory summary.
19 . The system of claim 18 , wherein the orchestration engine is further configured to invoke a code explanation agent to extract referenced source code segments linked to task records and generate a natural language explanation using a pre-authored code summarization prompt.
20 . The system of claim 12 , wherein the orchestration engine is executed as a containerized service deployed in a cloud-based computing environment, wherein the containerized service comprises orchestration logic, prompt management, and agent invocation modules.