AWS Builder Center
Part 2: The Architecture — Building GAD-P on AWS

Part 2: The Architecture — Building GAD-P on AWS

Your data team takes weeks to answer one question. This article shows how to give every business user instant, governed access to enterprise data using AI — safely and at scale.

Data and Ai lead at AWS

Governed Agentic Data Platform (GAD-P) — AWS Builder Center Series

Series: Enterprise NL2SQL with Mechanical Governance on AWS Level: 400 (Expert) Author: Faris Haddad, Tech Lead — Partner Strategy & Growth, AWS Prerequisite:  Mechanical Governance for LLM Decisions on AWS Bedrock  (Part 0 of this conceptual series)



Introduction

In  Part 1 , we defined the problem: enterprises have governed data but ungoverned AI access paths. We introduced the three failure classes (exfiltration, hallucination, cost explosion) and showed how mechanical governance — deterministic gates that don't rely on the model's cooperation — solves each one.
In this article, we build it. GAD-P is a concrete architecture using AWS managed services that delivers natural language access to enterprise data with mechanical security enforcement at each stage.

Architecture Overview

GAD-P is structured as a layered stack. Each layer has a clear responsibility and a defined contract with adjacent layers:
┌─────────────────────────────────────────────────────────────────────┐
│ LAYER -1: LOOM PLATFORM │
│ Agent lifecycle, RBAC/ABAC, identity propagation, HITL, registry │
├─────────────────────────────────────────────────────────────────────┤
│ LAYER 0: IDENTITY │
│ IAM Identity Center → OIDC/OAuth2 → AgentCore Identity │
├─────────────────────────────────────────────────────────────────────┤
│ LAYER 1: MANAGED AGENT INFRASTRUCTURE (AgentCore) │
│ Runtime (Strands) │ Gateway (MCP) │ Policy (Cedar) │ Memory │ Obs │
├─────────────────────────────────────────────────────────────────────┤
│ LAYER 2: INTELLIGENT RETRIEVAL │
│ AgenticRetrieveStream │ Semantic Layer (Catalog) │ CuratedQueries │
├─────────────────────────────────────────────────────────────────────┤
│ LAYER 3: GOVERNED SQL COMPILATION ★ GAD-P Differentiator │
│ SQL Generation → AST Validator (sqlglot) → EXPLAIN → Self-Correct │
├─────────────────────────────────────────────────────────────────────┤
│ LAYER 4: GOVERNED EXECUTION │
│ Athena (BytesScannedCutoff) → Lake Formation ABAC → Guardrails │
├─────────────────────────────────────────────────────────────────────┤
│ LAYER 5: FEEDBACK & CONTINUOUS LEARNING │
│ Certified queries → AgentCore Memory LTM → CuratedQueries loop │
└─────────────────────────────────────────────────────────────────────┘


Layer -1: Platform Governance with Loom for AWS

 Loom for AWS  (AWS Labs, Jul 2026) provides the enterprise platform layer:
Capability
How It Works
Identity propagation
 RFC 8693 token exchange 
— user JWT flows through agent → tools → data layer
Human-in-the-loop
Strands lifecycle hooks pause execution for approval when queries touch PII tables or exceed scan thresholds
Agent Registry
Governance review board approves agents before production data access
Cost attribution
Automated resource tagging ( loom:group ,  loom:cost.center ) for per-team billing

Layer 1: AgentCore Infrastructure

 Amazon Bedrock AgentCore  provides fully managed agent infrastructure:
  • Runtime: Serverless execution with session isolation (Strands Agents SDK)
  • Gateway: MCP-compatible tool routing with policy enforcement at every invocation
  • Observability: OpenTelemetry-compatible distributed tracing

Cedar Policy: Three-Layer Model

// Layer 1: User → Tool (blocks DDL/DML at the policy layer)
forbid (
principal,
action == AgentCore::Action::"GadpSqlAgent___execute_query",
resource
)
when {
context.input.sql_query.like("*DROP*") ||
context.input.sql_query.like("*DELETE*") ||
context.input.sql_query.like("*ALTER*")
};

// Layer 2: Agent can only invoke approved tools
permit (
principal == AgentCore::Agent::"gadp-sql-agent",
action == AgentCore::Action::"InvokeTool",
resource
)
when {
resource.toolName in ["search_schema", "generate_sql",
"validate_sql", "execute_query"]
};

// Layer 3: Originating user identity propagates to data layer
permit (
principal == AgentCore::Agent::"gadp-sql-agent",
action == AgentCore::Action::"GadpSqlAgent___execute_query",
resource
)
when {
context.originatingUser.department == resource.requiredDepartment
};


Layer 2: Intelligent Retrieval

AgenticRetrieveStream

 Agentic Retrieval  replaces custom query decomposition with a managed planning loop:
  1. Decomposes multi-part questions into sub-queries
  1. Retrieves relevant schema definitions and certified SQL exemplars per sub-query
  1. Judges sufficiency — iterates if evidence is incomplete
  1. Delivers grounded context to the SQL generation step
This achieves +22–37% recall improvement over single-shot retrieval on multi-hop benchmarks.

Semantic Layer Options

Option
Best For
Key Benefit
 SageMaker Catalog 
Greenfield / regulated
Governed metrics +
 OpenLineage 
audit trail
Glue Catalog + DataZone + Bedrock KB
Existing data lakes
Enriched metadata + vector search + CuratedQueries feedback

Layer 3: Governed SQL Compilation (The Differentiator)

This is where GAD-P adds value that no managed service provides:

AST Validator Lambda

import sqlglot
from sqlglot import exp

BLOCKED_STATEMENTS = {exp.Drop, exp.Delete, exp.AlterTable,
exp.Insert, exp.Update, exp.Create}
MAX_JOIN_DEPTH = 4

def validate(sql_query, allowed_tables):
parsed = sqlglot.parse_one(sql_query, read="athena")
# Block mutations
for node in parsed.walk():
if type(node) in BLOCKED_STATEMENTS:
return {'valid': False, 'error': 'Mutation blocked'}
# Enforce join limits
if len(list(parsed.find_all(exp.Join))) > MAX_JOIN_DEPTH:
return {'valid': False, 'error': 'Too many joins'}
# Verify table references
tables = {t.name for t in parsed.find_all(exp.Table)}
if tables - allowed_tables:
return {'valid': False, 'error': 'Unauthorized table'}
return {'valid': True}


Self-Correction Loop

On validation or execution failure, the agent receives structured error feedback and retries (max 2 attempts). This pattern, validated by  AWS's own Dynamic Text-to-SQL sample , resolves 15–20% of edge cases automatically.

Layer 4: Governed Execution

  •  Athena  with  BytesScannedCutoffPerQuery  — hard cost ceiling per query
  •  Bedrock Guardrails  — contextual grounding verifies the natural-language answer matches the query results

Layer 5: Feedback & Continuous Learning

The virtuous cycle:
  1. User approves a query result → stored in  AgentCore Memory LTM 
  1. Certified queries become CuratedQueries in the  GenerateQuery API 
  1. Future similar questions retrieve the certified exemplar → instant, accurate response
  1. System accuracy compounds over time without retraining

Mapping to the Mech-Gov Framework

Connecting back to  Part 0 :
Regime
GAD-P Implementation
Gate Type
R1 (Hard Gate)
Cedar Policy + AST Validator + Lake Formation
Deterministic — blocks before execution regardless of model output
R2 (Soft Gate + Audit)
Guardrails contextual grounding + WORM audit trail
Probabilistic check with immutable logging
R3 (Monitoring + Feedback)
Certified query memory + accuracy metrics + cost dashboards
Continuous improvement loop
The  mech-gov pattern's  key insight — that governance regimes must be independent of the model they govern — is the organising principle behind the entire stack.

Implementation Roadmap

Phase
Duration
Deliverable
Phase 1
Weeks 1–8
Core NL2SQL: Loom + AgentCore + KB + AST Validator + Athena + Lake Formation
Phase 2
Weeks 9–14
Advanced governance: Cedar 3-layer model, HITL triggers, tiered model routing
Phase 3
Weeks 15–24
Multi-modal: unstructured docs + time-series + cross-account data mesh

Cost Profile

At 1,000 queries/day:
Component
Monthly
AgentCore (Runtime + Memory + Policy)
~$220
Loom Platform Infrastructure
~$150
AgenticRetrieveStream + KBs
~$320
Bedrock Models (tiered routing)
~$355
Athena + Lake Formation + Glue
~$40
Guardrails + Observability
~$25
Total
~$1,110/mo
Compare: equivalent Databricks Genie deployment typically runs $3,000–5,000/month — without the governance depth GAD-P provides.

Conclusion

GAD-P shows that governed AI data access is not a contradiction in terms. By placing deterministic gates outside the model's control, enterprises can give authorised users instant, natural-language access to their data estate without compromising security, compliance, or cost control.
The architecture builds on three pillars:
  1. Managed infrastructure ( AgentCore  +  Loom ) — eliminates custom platform engineering
  1. Mechanical governance ( Cedar  +  AST validation  +  Lake Formation ) — security that holds even if the model is compromised
  1. Continuous accuracy ( AgenticRetrieveStream  +  Memory feedback loops ) — the system improves with every interaction
The code is production-ready. The services are GA. The pattern is  validated at scale by Amazon internally . The only remaining question is: how many days are your business users waiting for answers they could have in seconds?



References

  1.  Mechanical Governance for LLM Decisions on AWS Bedrock  — Faris Haddad, AWS Builder Center (2026)
  1.  Santander mech-gov (GitHub)  — Model-agnostic governance regimes for LLM decisions (2026)
  1.  Loom for AWS (GitHub)  — Enterprise agent platform, AWS Labs (Jul 2026)
  1.  Building Secure AI Agents at Scale: Introducing Loom  — AWS Open Source Blog (Jul 2026)
  1.  Why Policy in AgentCore Chose Cedar  — AWS Security Blog (Jul 2026)
  1.  sample-agentic-data-governance (GitHub)  — Ablation study: accuracy from governance context (Jul 2026)
  1.  Governing and Architecting Agentic AI at Scale  — AWS Prescriptive Guidance
  1.  Governance for Trustworthy Agentic AI  — AWS Public Sector Blog (May 2026)
  1.  Athena Workgroup Control Limits  — AWS Documentation
  1.  sqlglot — SQL Parser & Transpiler  — Open-source AST parser


About the author: Faris Haddad is a technical lead at AWS based in UK, specializing in AI/ML and data solutions for enterprise customers. He works with financial services organizations to build scalable machine learning systems on AWS.
Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article