Interactive Best Practices Tutorial - 20 Pillars, 4 Layers, 77 Learning Scenarios
Agentic AI Well Architected is an interactive demo application that teaches agentic AI best practices on AWS through side-by-side comparisons. Follow the story of AnyCompany building SupportBot - a GenAI-powered customer support assistant - from first prototype to enterprise product. Each of the 20 pillars tackles a different challenge, showing a naive approach alongside an AWS best-practice implementation with live Amazon Bedrock calls. Covers 4 layers (Model, Guardrail, Orchestration, Platform), 6 foundation models, Bedrock Guardrails with Automated Reasoning (35 formal logic rules), RAG with Knowledge Bases, multi-agent orchestration via Strands Agents, AgentCore primitives (Gateway, Memory, Policy, Evaluation, Observability), SSO authentication via Cognito, and full audit logging. All infrastructure defined in CDK.
Enterprise teams adopting generative AI and agentic patterns face a steep learning curve. AWS offers powerful primitives - Bedrock models, Guardrails, Knowledge Bases, AgentCore (Gateway, Memory, Policy, Evaluation, Observability) - but understanding when and how to apply each one requires deep expertise. Teams either skip best practices entirely (shipping unsafe, unobservable prototypes) or spend months reading documentation without seeing the real-world impact of each decision.
The goal was to build a comprehensive interactive tutorial where every pillar of agentic AI architecture is demonstrated through side-by-side comparison - send the same prompt through a naive implementation and a best-practice implementation, see both results in real time, and understand exactly what changed and why it matters.
cdk deploy -c auth=YFull-stack serverless application on AWS integrating Bedrock models, Guardrails, Knowledge Bases, Strands Agents, and multiple AgentCore primitives:
CloudFront (CDN)
/ \
/ \
S3 (React SPA) API Gateway HTTP API
|
API Lambda (Node.js)
/ | | \ \
Bedrock Guardrails KB Strands DynamoDB
Converse (Content + (S3 Agent (Audit
API Auto-Reason)Vectors)Lambda Logs)
|
S3 (Agent Results)
Authentication:
Browser → Cognito Hosted UI → MidWay SSO (OIDC) → Callback → Lambda token exchange → JWT session
AgentCore Primitives:
Gateway (Managed MCP) → Memory (Semantic/Session/Preferences) → Policy (Cedar) → Evaluation (LLM Judge) → Observability (OTEL)
| Pillar | Story Beat | Naive vs. Best Practice |
|---|---|---|
| Prompt Engineering | Building the Prototype | Raw user prompt vs. role-specific system prompt with constraints and structured output |
| Performance Efficiency | Speed Matters | Unconstrained verbose output vs. token-budgeted ≤100-word bullet-only responses |
| Cost Optimization | The Bill Arrives | Verbose token-wasteful prompts vs. concise prompts with model routing (Haiku vs. Sonnet) |
| Pillar | Story Beat | Naive vs. Best Practice |
|---|---|---|
| Guardrails | Keeping SupportBot On-Topic | No content filtering vs. Bedrock Guardrails with topic denial, PII redaction, content policies |
| Responsible AI | Fair Customer Decisions | Generic AI responses vs. auditable decision-support with bias identification and human review triggers |
| Automated Reasoning | Getting the Facts Right | Unverified factual claims vs. 35 formal logic rules verifying AWS service limits (S3, Lambda, SQS, DynamoDB, API Gateway, SNS, Kinesis, Step Functions, EFS) |
| Pillar | Story Beat | Naive vs. Best Practice |
|---|---|---|
| Tool Calling Reliability | Real Data, Not Hallucinations | Hallucinated data vs. Bedrock Converse API toolConfig with strict JSON schemas |
| RAG & Data Quality | Company Knowledge | Parametric-only knowledge vs. Bedrock Knowledge Base grounding with source citations from 4 internal docs |
| Multi-Agent Orchestration | The Ops Agent Team | Single monolithic agent vs. Strands Agent-as-Tool with specialist agents (metrics, security, cost) |
| MCP Integration | Live Documentation | Outdated training data vs. AWS Documentation MCP Server for live doc search |
| AgentCore Gateway | Managed MCP at Scale | Fragile MCP subprocesses vs. managed SigV4 auth, rate limiting, and CloudWatch observability |
| AgentCore Memory | Persistent Agent Memory | Stateless conversations vs. semantic facts, session summaries, and user preferences across sessions |
| Legacy Integration | Old Meets New | Ignores system constraints vs. adapter patterns with circuit breakers and format translation |
| Pillar | Story Beat | Naive vs. Best Practice |
|---|---|---|
| Identity & Multi-Tenancy | Going Enterprise | No access controls vs. Cognito + IAM tenant isolation, per-tenant RAG filtering and billing |
| Security | Red-Teaming Before Launch | Vulnerable system prompt vs. hardened prompt blocking prompt injection, extraction, and jailbreak attacks |
| Reliability | Inconsistent Answers | Bare model call vs. structured output with CONFIDENCE levels, failure modes, and fallback model chains |
| AgentCore Policy | Cedar-Based Governance | No restrictions on agent actions vs. Cedar authorization policies for models, KBs, tools, and token budgets |
| Agent Evaluation | Proving Agent Quality | No quality metrics vs. AgentCore Evaluation with Builtin.Helpfulness, Builtin.Correctness, custom evaluators, on-demand and online modes |
| Observability & Tracing | Proving It Works | Black-box model calls vs. AgentCore Observability with end-to-end OpenTelemetry tracing |
| Agent Testing | Ground-Truth Validation | No test coverage vs. tool call sequence validation and response content verification against ground-truth |
The Automated Reasoning pillar uses Bedrock's formal verification engine with 35 S-expression rules covering AWS service limits across 9 services. When the model claims "Lambda max timeout is 30 minutes," the guardrail flags it because the rule says 900 seconds (15 minutes). No statistical uncertainty, no false negatives - provable correctness.
The Multi-Agent pillar demonstrates the Strands Agents SDK with the Agent-as-Tool pattern. An orchestrator agent delegates to 3 specialist agents, each with focused tools and constrained system prompts:
get_service_metrics, get_error_logs, get_recent_deployments - surfaces CloudWatch data and deployment historyanalyze_iam_policies - evaluates IAM policy configurations for least-privilege violationsget_cost_breakdown - provides Cost Explorer data with S3 lifecycle and reserved capacity recommendationsPer-tool metrics (tokens, latency, cost) are tracked and returned for trace visualization in the UI. A ToolCallLimiter hook caps tool calls at 6 per agent to prevent runaway loops.
The AgentCore Gateway pillar shows the difference between fragile local MCP subprocesses and a managed, production-grade MCP endpoint:
The Memory pillar demonstrates persistent agent memory with three strategy types, seeded with demo data via a CDK custom resource:
The Policy pillar demonstrates Cedar-based governance for agent actions:
Builtin.Helpfulness and Builtin.Correctness for standardized quality scoringcdk deploy -c auth=Y, disabled by default for open accesstenantId and tenantTier attributes in Cognito for per-tenant RAG filtering and billing isolationStory-Driven Learning: All 20 pillars follow a continuous narrative (AnyCompany building SupportBot) rather than isolated demos. Decisions in Prompt Engineering affect Security, which affects Reliability, which affects Observability - users experience the compound effect.
Side-by-Side, Not Sequential: The dual-panel UI shows both approaches simultaneously on the same prompt. Users see the failure of the naive approach and the success of the best practice in the same view, with metrics to quantify the difference.
Real Calls, Not Canned Responses: Every comparison uses live Bedrock ConverseStream calls. Users can modify prompts and see how both architectures respond differently to the same variation.
Parameter-Driven Auth: Authentication is a CDK context parameter, not a code branch. The same codebase serves open-access demos and SSO-protected enterprise deployments.
Formal Verification Over Statistical: The Automated Reasoning pillar uses S-expression rules for provable correctness - not embeddings or similarity scores. When it flags a hallucinated service limit, the proof is a formal logic contradiction.
Watch the Agentic AI Well Architected application in action - explore how each pillar contrasts naive vs. best-practice approaches with live Amazon Bedrock calls: