Link copied!
Integrating AI with Deterministic Rules Engines: The Adjudicated Query Pattern Technical Log

TechiesAIE Journal

Integrating AI with Deterministic Rules Engines: The Adjudicated Query Pattern

TechiesAIE
TechiesAIE
Lead Developer · TechiesAIE
5 min read 989 words

Based on the sources linked below.

Cover image: Aboutbigdata · CC BY-SA 4.0 · License · Image source

The Adjudicated Query pattern combines the accessibility of generative AI with the reliability of deterministic rules engines, providing a solution for high-stakes compliance challenges that demand provable completeness and defensibility. This approach is particularly useful in scenarios like checking thousands of apartment leases against evolving landlord-tenant laws, where accuracy and an auditable trail are critical. Unlike traditional AI methods such as Retrieval Augmented Generation (RAG) or text-to-SQL, Adjudicated Query ensures that pass/fail decisions remain with a non-AI rules engine, preventing AI hallucination from compromising the integrity of compliance checks.

The Challenge of Compliance at Scale

For organizations managing large portfolios, such as 50,000 leases across multiple states, ensuring compliance with constantly changing regulations is a significant hurdle. Manually reviewing each lease is impractical beyond a certain volume. While software can automate parts of the process, it introduces a new problem: verifying the accuracy and completeness of the results. Two properties are paramount in these high-stakes domains: provable completeness and defensibility.

Provable completeness means that a claim, such as "we checked all 22,910 Texas leases," must be demonstrably true. Any record not assessed must be explicitly reported rather than silently omitted. Defensibility requires that any finding can be challenged months later in legal or regulatory contexts. This means knowing precisely which rule version was applied, to which clause, by what method, on what date, and by whom. These requirements differentiate compliance from general enterprise search, which RAG and similarity search cannot fully satisfy due to their inherent limitations in guaranteeing comprehensive and auditable results.

How Adjudicated Query Solves It

The Adjudicated Query pattern works by establishing a bounded conversational layer over a deterministic rules engine. The generative AI model, such as one available in Amazon Quick, performs two specific functions: translating natural-language compliance questions into calls on a predefined set of typed operations and narrating the results. Crucially, the AI model never writes a query, fixes the population of records, or makes a compliance determination itself. These critical functions are handled by the rules engine.

Behind the conversational interface, the rules engine operates with versioned data, not code. Rules are generic comparison operators (e.g., gte, lte, equals, exists) and do not contain jurisdiction-specific or topic-specific branching logic. A change in law is managed as an edit to a rulebook row, avoiding the need for code deployments. Every compliance sweep generates a completeness receipt, an asserted invariant where compliant + in-breach + ambiguous + unreadable must equal the total number of scanned records. This ensures no record is silently skipped. The conversational interface presents counts, the receipt, and a labeled sample, while the full result set is available on a dashboard, maintaining a single source of truth for all data.

Why Not RAG or Text-to-SQL?

Traditional RAG approaches provide a ranked sample of results, making provable completeness structurally impossible and defensibility only partial. Text-to-SQL approaches claim provable completeness but carry a risk of silent narrowing if a hallucinated predicate incorrectly reduces the population being queried. The Adjudicated Query pattern avoids these pitfalls by ensuring that population control and determination logic are external to the AI, residing in the deterministic rules engine. This allows for natural-language access without sacrificing the guarantees needed for accountable compliance operations.

Reference Architecture

An AWS reference architecture demonstrates this pattern using Amazon Quick as the conversational interface and dashboard. A compliance officer uses a chat agent in Amazon Quick to ask questions and an Amazon Quick Sight dashboard to browse full result sets. The chat agent authenticates via Amazon Cognito, sending Model Context Protocol (MCP) requests through Amazon API Gateway to an AWS Lambda function. This Lambda function hosts the MCP server and the rules engine, interacting with Amazon Aurora Serverless v2 through the RDS Data API. Amazon Bedrock is only used for exploratory clause search, ensuring that compliance sweeps are entirely model-agnostic.

The architecture ensures that both the chat agent and the Quick Sight dashboard read from the same Aurora store, making the completeness receipt a single source of truth. Amazon Bedrock is specifically limited to exploratory operations, meaning no model is involved in the high-stakes compliance sweeps themselves, and the core Aurora database never interacts with a generative AI model for compliance decisions.

The Bounded Operation Surface

The MCP server in this architecture exposes a fixed and bounded set of six tools, each with a distinct semantic. For example, 'sweep_compliance' performs an exhaustive population sweep against rules in force on a stated date, generating official, accounted-for findings. In contrast, 'simulate_rule_change' offers an exploratory test of a single rule, yielding only directional counts and recording nothing. 'explore_clauses' provides an interpretive, ranked sample for semantic similarity within a filtered population but cannot answer "how many" questions definitively. This bounded surface is key to preventing the silent-narrowing risk associated with generated queries. By restricting the AI model to selecting from predefined operations, whose logic has been human-written, reviewed, and tested, the system eliminates any possibility of the AI composing an incorrect population for critical compliance tasks.

Practical Uses and Limitations

The Adjudicated Query pattern is ideal for any high-stakes compliance domain where a missed record is a liability. Beyond lease compliance, it applies to sanctions screening, insurance claims adjudication, and export control. The key benefit is providing accountable users with conversational access to information without sacrificing the essential guarantees of completeness and defensibility. This separation of AI for interface and rules engine for determination allows organizations to leverage AI for user experience while maintaining stringent control over critical business logic and regulatory adherence.

While powerful, this pattern requires careful definition of the rules engine and the bounded set of operations exposed to the AI. The quality of the natural language interaction is also influenced by effective prompt engineering, ensuring the AI correctly interprets user intent within the defined operational boundaries. However, by strictly delineating the roles of AI and deterministic systems, the Adjudicated Query pattern offers a robust solution for integrating generative AI into highly regulated environments.

Sources