Checking tens of 1000’s of condo leases towards continually altering state landlord-tenant legal guidelines, and proving you truly checked all of them, has been past the attain of most compliance groups. However with generative AI in Amazon Fast, paired with the suitable backend, it’s now potential. On this publish, we introduce a design sample referred to as Adjudicated Question. Enterprise customers can use it to ask compliance questions in a chat interface (Amazon Fast), whereas the precise go/fail selections keep in a deterministic (non-AI) guidelines engine. We stroll by way of an AWS reference structure that implements the sample, and deploy a working pattern you’ll be able to run finish to finish. The sample applies to different high-stakes compliance domains as effectively (sanctions screening, insurance coverage claims adjudication, export management), however lease compliance serves as our concrete instance.
The compliance problem at scale
A portfolio operator holds 50,000 leases throughout a number of states. Every state publishes landlord-tenant statutes (late-fee caps, discover durations, security-deposit limits) that change on the legislature’s schedule, not the operator’s. When a regulation modifications, the staff accountable for compliance should decide which leases at the moment are out of line.
At small quantity a paralegal reads the leases. The reply is reliable as a result of a human stands behind it. Previous some threshold, that stops being potential. The work strikes to software program, and a brand new drawback seems: the reply is now a quantity on a display that no person can independently confirm.
Two properties comply with from that actuality:
- Provable completeness: A declare like “we checked all 22,910 Texas leases” have to be true and demonstrable. A file by no means assessed have to be reported as unevaluated reasonably than silently omitted.
- Defensibility: A discovering could also be challenged months later in litigation, an audit, or a regulatory examination. Defending it means realizing which model of which rule was utilized, to which clause textual content, by what methodology, on what date, and by whom.
These two properties are what distinguish this drawback from enterprise search. Retrieval Augmented Technology (RAG) addresses the accessibility hole however can’t fulfill both property. Similarity search has no threshold which means all of them. A ranked pattern by no means is aware of what it excluded.
Textual content-to-SQL narrows this hole, however carries a category-level threat: a hallucinated predicate can silently cut back the inhabitants, and the ensuing quantity appears to be like precise even when the scope is improper.
How the Adjudicated Question sample solves it
The Adjudicated Question sample is a bounded conversational layer over a deterministic guidelines engine. The mannequin does precisely two issues: translate a natural-language query right into a name on a set set of typed operations, and narrate the outcome that comes again. It by no means writes a question, by no means fixes the inhabitants, and by no means performs a dedication.
Behind the boundary sits a guidelines engine. Guidelines are versioned knowledge, not code. The engine is aware of generic comparability operators (gte, lte, equals, exists) and comprises no department naming a jurisdiction or matter. A regulation change is a rulebook row edit, not a code deployment.
Each compliance sweep produces a completeness receipt: an asserted invariant the place compliant + in-breach + ambiguous + unreadable should equal scanned. That is computed from counts and asserted earlier than something persists. A run that may’t account for its inhabitants by no means finishes. There’s no path by which a file is silently skipped.
The conversational floor carries counts, the receipt, and a labeled pattern. The complete outcome set (doubtlessly tens of 1000’s of rows) lives on a dashboard floor studying the identical knowledge retailer, drillable per file. This separation means the mannequin by no means summarizes away the assure.
Why not RAG or text-to-SQL?
| Method | Inhabitants | Completeness | Defensibility |
| Semantic retrieval (RAG) | A ranked pattern | Structurally unimaginable | Partial |
| Generated queries (text-to-SQL) | Claimed however unprovable | Silent narrowing threat | If modeled |
| Guidelines engine + BI (no chat) | Actual and confirmed | Sure | Sure |
| Adjudicated Question | Actual and confirmed | Sure | Sure |
The Adjudicated Question sample provides natural-language entry to the principles engine plus enterprise intelligence (BI) strategy with out sacrificing the assure. It’s the suitable selection when accountable customers want conversational entry, and a missed file is a legal responsibility reasonably than a light inconvenience.
Reference structure
The next diagram reveals how the elements match collectively finish to finish. A compliance officer interacts with two surfaces in Amazon Fast: a chat agent for asking questions and an Amazon Fast Sight dashboard for searching the total outcome set. The chat agent first fetches an OAuth token from Amazon Cognito. It then sends Mannequin Context Protocol (MCP) requests over an Amazon API Gateway HTTP API, which validates the token earlier than forwarding to an AWS Lambda perform. The Lambda perform hosts the MCP server and the principles engine, reads and writes to Amazon Aurora Serverless v2 by way of the RDS Information API, and calls Amazon Bedrock just for the exploratory clause-search path. The Amazon Fast Sight dashboard reads the identical Aurora retailer immediately by way of a digital non-public cloud (VPC) connection. Each surfaces due to this fact learn from one retailer, which is what makes the completeness receipt a single supply of fact.
Each surfaces learn the identical retailer. The chat agent carries the completeness receipt and a hyperlink to the dashboard. The dashboard carries the amount, as a result of 10,800 rows don’t render in a chat message. Amazon Bedrock known as from AWS Lambda solely by the exploratory operation. No mannequin is concerned in compliance sweeps, and Amazon Aurora Serverless v2 doesn’t name a mannequin.
The bounded operation floor
The MCP server exposes precisely six instruments, every with a definite semantic:
| Device | What it does | Consequence means |
| sweep_compliance | Exhaustive inhabitants sweep towards guidelines in drive on a said date | Official. Each lease accounted for in a computed receipt. Writes findings |
| simulate_rule_change | One rule examined at a proposed worth towards the authorized baseline | Exploratory. Directional counts solely. Information nothing |
| explore_clauses | High Ok by semantic similarity inside a filtered inhabitants | Interpretive. A ranked pattern. Can not reply “what number of” |
| get_finding | One discovering’s full proof chain | Drill-down right into a single dedication |
| list_rules | The rulebook in drive on a date, with variations, citations, approvers | Reference lookup |
| check_connection | Liveness examine, touches no knowledge | Transport well being |
This bounded floor removes the trail to the silent-narrowing threat of generated queries. As a result of the mannequin can solely choose from a set set of operations whose inhabitants logic was written, reviewed, and examined by folks, it has no option to compose a improper inhabitants.
Key structure elements
With the Amazon Fast conversational interface and agent orchestration layer, you’ll be able to ask natural-language compliance questions that the Amazon Fast chat agent interprets into calls on the bounded MCP operation floor. Amazon Fast authenticates to the MCP server through the use of OAuth 2LO by way of Amazon Cognito and handles instrument discovery and response narration. The deterministic engine handles the compliance logic.
Amazon Aurora Serverless v2 (Postgres + pgvector) shops the rulebook, lease data, extraction standing, determinations, and runs in a single relational retailer. Placing every thing in a single database makes the completeness receipt a SQL rely, a cheap option to make the central assure inspectable.
AWS Lambda hosts the MCP server (JSON-RPC 2.0 over Streamable HTTP, utilizing Server-Despatched Occasions framing for responses, which the Amazon Fast shopper requires) and the rule engine. Bounded operations translate to set-based SQL through the use of rule values sure as parameters. No pure language reaches the question layer.
Amazon API Gateway HTTP API offers the entrance door with a JSON Net Token (JWT) authorizer backed by Amazon Cognito. No unauthenticated route exists.
Amazon Cognito points OAuth tokens by way of a two-legged (shopper credentials) circulate. The shopper secret is learn from Amazon Cognito at registration time and never written to disk.
Amazon Bedrock powers the exploratory path solely, utilizing Amazon Titan Textual content Embeddings V2 (amazon.titan-embed-text-v2:0) for semantic similarity rating and Anthropic Claude Sonnet 5, invoked by way of a cross-region inference profile, for qualitative clause evaluation. It isn’t consulted for an official compliance dedication. Amazon Bedrock mannequin availability, together with Amazon Titan Textual content Embeddings V2 and Anthropic Claude Sonnet 5, varies by AWS Area, so verify the fashions can be found in your Area earlier than deploying.
Amazon Fast Sight connects to Aurora by way of a VPC connection and renders the total findings desk, filterable by sweep and severity band, with each column wanted to defend a dedication already on the row.
Design guidelines which might be non-negotiable
- Guidelines are knowledge. A regulation change is a rulebook row. The engine comprises no jurisdiction-specific department.
- No pure language reaches SQL. Operators choose fastened SQL templates. Rule values bind as parameters.
- Deterministic earlier than AI. A numeric comparability solutions the sweep. No mannequin is consulted.
- Actual filtering for completeness, vectors just for rating. Similarity by no means decides membership.
- Receipts are computed, not written by hand. The invariant is asserted earlier than a sweep commits.
- Unreadable paperwork are named, not dropped. Each lease lands in precisely one bucket.
- Findings are append-only. No UPDATE or DELETE towards findings exists within the code base.
Treating the summarizing mannequin as an untrusted renderer
One design factor deserves its personal part as a result of it would look unfamiliar: engineering safeguards to outlive paraphrase by the chat mannequin.
Excluding the mannequin from the choice path however placing one again within the supply path reintroduces threat on the finish of the chain. In apply, we noticed:
- A mannequin stripped a caveat prefix. An ILLUSTRATIVE quotation tag was eliminated throughout paraphrase, and the mannequin offered an invented quotation as statute.
- A mannequin extrapolated from a pattern. Given 20 preview rows, the mannequin inferred a population-wide vary that didn’t exist within the knowledge.
Three strategies deal with this:
- Phrase caveats as un-strippable bracketed suffixes repeated at a number of payload ranges, not main labels that learn as detachable metadata.
- Provide the info that makes the trustworthy reply the simple one. Compute actual aggregates over each file and hand them to the mannequin. A mannequin that has the actual quantity doesn’t have to guess from a pattern.
- Repeat mode labels at a number of structural ranges (area, string, abstract) in order that a minimum of one survives paraphrase.
The precept: a safeguard within the payload is simply as sturdy as its survival by way of paraphrase.
Deploy and run the pattern
The entire reference implementation is obtainable on GitHub. It ships with artificial knowledge (no actual buyer lease knowledge), deterministic corpus era, and acceptance checks towards the deployed stack.
Stipulations
Earlier than deploying, confirm that you’ve:
- An AWS account with Amazon Bedrock mannequin entry enabled for Amazon Titan Textual content Embeddings V2 and Anthropic Claude Sonnet 5 within the US East (N. Virginia) Area (us-east-1).
- AWS Command Line Interface (AWS CLI) v2 with credentials configured (
aws sts get-caller-identityought to succeed). - Python 3.12.
- Node.js 24 for the AWS Cloud Improvement Equipment (AWS CDK) CLI. mise is elective and solely used to provision Node 24. You’ll be able to set up Node 24 by your selection of methodology (Node 18 has reached finish of life for CDK).
Step 1: Clone the repository
Clone the pattern repository and arrange the Python surroundings:
Step 2: Deploy the infrastructure
Bootstrap CDK (if not already carried out) and deploy the stack. Aurora provisioning sometimes takes round 11 minutes, although timing varies by account and Area.
The CDK model is pinned to 2.261.0 to match necessities.txt. The stack deploys:
- Amazon Cognito (2LO shopper).
- Amazon API Gateway with JWT authorizer.
- AWS Lambda (MCP server + rule engine).
- Amazon Aurora Serverless v2.
- Amazon Fast Sight networking.
Step 3: Seed knowledge and confirm
Run the migration, corpus era, ingestion, and Amazon Fast Sight setup scripts in sequence:
The corpus is deterministic, so a rebuilt stack reproduces similar outcomes.
Step 4: Register the MCP integration in Amazon Fast
Amazon Fast snapshots the instrument record at registration time. Amazon Fast doesn’t detect new or renamed instruments till you delete and recreate the mixing. Deploying the Lambda alone isn’t sufficient.
Print the registration inputs out of your deployment outputs:
Retrieve the shopper secret (learn from Amazon Cognito every time, not written to disk). Use the consumer pool ID from the Issuer URL in your outputs:
Then in Amazon Fast: Connectors > Create in your staff > Mannequin Context Protocol. Delete any present entry first, then create a brand new one with these values (OAuth client-credentials/2LO). Copy the shopper secret into Amazon Fast immediately reasonably than right into a file or shell variable.
Step 5: Confirm the mixing
Confirm the deployment finish to finish, on this order:
The acceptance suite proves the server works. The following part walks by way of the Amazon Fast chat expertise to verify Amazon Fast picks the suitable instrument.
Strolling by way of the expertise
With the stack deployed and verified, now you can run a compliance sweep from Amazon Fast chat and examine the outcomes.
Ask a compliance query
In Amazon Fast chat, enter: “Which Texas leases violate the late price cap? Use guidelines efficient 01/01/2026.”
Amazon Fast identifies this as a compliance sweep and selects the sweep_compliance instrument. The instrument runs an exhaustive examine towards each Texas lease within the inhabitants, making use of guidelines in drive on the said date. No mannequin is concerned within the dedication.
Amazon Fast narrates the structured outcome. Determine 2 reveals the chat response: a brief pattern of noncompliant findings in a desk, the completeness receipt rendered as counts, a synthetic-data caveat, and a hyperlink to open the total dashboard.
The response features a pattern of noncompliant findings and the completeness receipt as counts: 10,111 violations, 689 ambiguous, and 20 unreadable. It additionally features a synthetic-data caveat and a hyperlink into the Amazon Fast Sight dashboard. It intentionally doesn’t attempt to render all 10,111 rows.
Confirm the completeness receipt by checking the invariant: compliant + in-breach + ambiguous + unreadable ought to equal the overall scanned inhabitants. On this instance, the counts sum to the overall Texas lease inhabitants, confirming that each file landed in precisely one bucket.
Examine the total inhabitants on the dashboard
Comply with the dashboard hyperlink within the chat response to open the Amazon Fast Sight dashboard. Determine 3 reveals the findings tab, the place each lease-rule pair from the sweep seems as its personal row with the total proof chain.
The dashboard shows each discovering from the sweep, one row per lease-rule pair. Use the severity band filter to isolate in-breach findings. Every row carries the lease ID, the rule that fired, the extracted worth, and the anticipated worth. Type by rule to group associated violations and determine patterns throughout the portfolio.
Drill right into a single discovering
Choosing a row opens the discovering element. Determine 4 reveals a single discovering, with the verbatim lease clause on one facet and the rule that fired on the opposite, together with its model, quotation, and the in contrast values.
That is what defensibility appears to be like like in apply. The discovering reveals the extracted worth (7 % late price), the required worth (5 % cap), and the rule quotation (TX Prop. Code ch. 92 subch. B, as amended eff. 2026-01-01). All of this seems alongside the clause textual content verbatim from the lease, so nothing must be reconstructed.
Check extra routing paths
Affirm Amazon Fast routes to the right instrument by testing the remaining operations:
- “Discover Texas clauses that learn like legal responsibility waivers.” (ought to invoke
explore_clauses). - “What if the Texas late price cap dropped to three%?” (ought to invoke
simulate_rule_change).
Cleanup
To keep away from ongoing expenses, destroy the stack when you find yourself completed:
Aurora Serverless v2 can scale to 0 Aurora Capability Items (ACU) and mechanically pause after a interval of inactivity (see Amazon Aurora pricing). This pattern units a small non-zero minimal capability as an alternative, as a deliberate selection, as a result of a paused cluster provides resume latency to the primary query of a session. No NAT gateway is deployed.
Should you plan to return to the stack later however need to decrease price between periods, set serverless_v2_min_capacity=0 in infra/stack.py and redeploy to allow scale-to-zero with auto-pause. Anticipate a brief resume delay on the primary question after the cluster has paused. The corpus is deterministic, so a totally destroyed and redeployed stack reproduces similar outcomes.
Safety concerns
As a result of this sample is constructed for compliance work, safety is a part of the design reasonably than an add-on. The pattern applies the next practices, and you need to evaluation every one towards your individual necessities earlier than adapting it.
- Authenticated entry solely. Each request from Amazon Fast reaches the MCP server by way of an Amazon API Gateway HTTP API protected by a JSON Net Token (JWT) authorizer backed by Amazon Cognito. No unauthenticated route exists, and the two-legged (shopper credentials) OAuth circulate points short-lived tokens reasonably than long-lived keys.
- Secret dealing with. The Amazon Cognito shopper secret is learn at registration time and isn’t written to disk or dedicated to supply management. Retailer it solely within the Amazon Fast connector configuration, and rotate it in your regular schedule.
- Least-privilege mannequin entry. The AWS Lambda execution position grants Amazon Bedrock InvokeModel just for the particular Amazon Titan Textual content Embeddings V2 and Anthropic Claude Sonnet 5 mannequin ARNs the pattern makes use of, not a wildcard over all fashions. Scope AWS Identification and Entry Administration (IAM) permissions the identical approach in your individual construct.
- Community isolation for the info path. Amazon Fast Sight reaches Amazon Aurora Serverless v2 by way of a VPC connection reasonably than a public endpoint, and the database safety group admits solely the anticipated sources. Preserve the shop off the general public web.
- No pure language within the question path. The foundations engine assembles SQL solely from a set operator-to-template desk with rule values sure as parameters, which removes the injection floor {that a} model-written question would create. It is a safety property as a lot as a correctness one.
- Auditable, append-only findings. Findings are append-only, with no UPDATE or DELETE path within the code base, so the compliance file can’t be silently altered after the very fact. Every dedication carries its proof chain for later evaluation.
- Artificial knowledge boundary. The pattern ships with artificial lease knowledge and clearly labeled placeholder guidelines and citations. Earlier than working towards actual data, full your group’s knowledge classification, entry evaluation, and authorized validation of any rule content material.
- Human attribution of a sweep. Amazon Fast authenticates to the MCP server machine-to-machine by way of the two-legged (shopper credentials) circulate, so the token identifies the Amazon Fast utility, not the person who requested the query in chat. The engine data what was determined, the rule model, the proof, the strategy, and the date, however it doesn’t obtain an end-user identification to retailer alongside a discovering. For the “by whom” a part of defensibility, attribution lives within the Amazon Fast audit layer, which data which consumer ran which chat motion. A discovering ties again to an individual by correlating its sweep ID and timestamp with that file. Should you want attribution recorded within the compliance retailer itself, thread an end-user ID from Amazon Fast into the instrument name and persist it on the sweep row. The “who” then travels with the discovering reasonably than dwelling solely within the Amazon Fast audit layer.
When to make use of this sample
The Adjudicated Question sample applies at any time when:
- A missed file is a legal responsibility reasonably than a light inconvenience.
- Solutions is likely to be challenged months later by somebody who was not within the room.
- The governing logic is externally owned and modifications by itself schedule.
- The physique of data is enumerable (you’ll be able to record each file a query covers).
That description covers a variety of domains. Examples embrace lease compliance, insurance coverage claims adjudication, sanctions screening, export management, medical trial protocol monitoring, constructing code inspection, monetary reporting controls testing, and credential verification.
RAG is the easier selection when believable solutions suffice and customers can re-ask. Textual content-to-SQL works effectively for groups that may confirm generated queries and tolerate occasional incorrect outcomes. If accountable customers will settle for dashboards and not using a conversational layer, contemplate a guidelines engine plus BI immediately: it delivers the identical assure at decrease price.
When that is the improper selection
The sample is heavy: a guidelines engine, a bounded instrument floor, and a completeness receipt. That equipment earns its preserve solely on the suitable drawback, and copying it onto the improper one provides price with out including belief. Keep away from the sample in three circumstances.
- The foundations aren’t actually deterministic. The sample works when compliance is a clear comparability, equivalent to price is lower than or equal to a cap, or discover is bigger than or equal to a required variety of days. When the decision is a real judgment, equivalent to whether or not a clause is unconscionable or a disclosure is ample, forcing it into this sample hides the subjectivity inside rule-authoring and makes the outcome look precise when it’s not. Preserve a human within the loop for these determinations reasonably than dressing them as deterministic ones.
- Completeness doesn’t matter for the query. If the consumer solely desires a couple of consultant examples, or is exploring reasonably than adjudicating, the completeness receipt is overhead for a assure they don’t want. RAG is the easier, right reply for that sort of query.
- The inhabitants itself is fuzzy. The receipt proves you coated each file within the inhabitants, not that the inhabitants is the suitable one. If the definition of “all Texas leases” is itself contestable, the assure is exact concerning the improper denominator. Be certain the inhabitants could be drawn by an actual, defensible predicate earlier than you depend on the receipt.
Conclusion
On this publish, we launched the Adjudicated Question sample and demonstrated the way it delivers provably full, defensible compliance solutions by way of the Amazon Fast conversational interface. The sample pairs a bounded MCP operation floor with a deterministic guidelines engine, so the mannequin interprets questions and narrates outcomes however doesn’t contact the selections that produce the assure.
By deploying the pattern stack, asking a compliance query in Amazon Fast chat, and following the outcomes by way of the Amazon Fast Sight dashboard, you walked by way of the total sample finish to finish. The completeness receipt accounts for each file, findings carry their full proof chain, and the split-surface supply retains the assure intact by way of paraphrase.
To get began, clone the pattern repository, deploy the stack, register the MCP integration in Amazon Fast, and take a look at asking your first compliance query.
Sources
In regards to the creator





