← All labs
FDE Agentic AI & Data Lab
Local-first practice for the FDE programme: analytical SQL, governed data agents, evals, security and customer delivery. Includes source examples and a small offline model practice app; AWS deployment is optional and separately billed.
Sign in to download the starter kitLicence: Practice app: MIT. Uploaded teaching material and datasets retain their respective terms; verify model licences.
What's inside
Source lab examples
Eight-step guide with Docker Compose, datasets, read-only roles, SQL guard and teardown snippets. Teaching examples require adaptation, not production-ready services.
Needs: Full stack: 16 GB RAM, Docker, uv, Ollama; AWS optional
Local practice app
Offline chat and notes retrieval, with model/token/source receipts for learning and checking agent concepts.
Needs: Python 3.10+, FastAPI, Uvicorn, httpx, Ollama
FDE skill handbook
All 25 supplied skill guides, including golden sets, customer discovery, workflow approvals and portfolio packaging.
Needs: Markdown reader; current official docs for SDK verification
Labs by week
- Week 1 D01 Toolchain, repo and AWS guardrails Get a reproducible project skeleton and a cost-safe AWS sandbox before writing any agent code. 2.5 h Local lab — step by step Install the base toolchain for your OS (see the Local Lab tab, Steps 1–2). Confirm each tool prints a version. Create the project with uv , pin Python 3.12, add ruff and pytest, and write one passing test. Create a private GitHub repo and push. Add a .gitignore that excludes .env , data/ and *.duckdb . Configure AWS CLI with IAM Ide
- Week 2 D08 Strands agent with schema tools Build the first tool-using agent that can explore a schema and run read-only SQL. 2.5 h Local lab — step by step Add Strands Agents with the Ollama extra. Write three tools: list_tables() , describe_table(name) , run_sql(query) against DuckDB opened read_only=True . Give each tool a precise docstring: the model reads it as the tool contract. Ask 10 questions from easy to medium. Read every tool call the agent made. Record the 3 most common failure patterns (w
- Week 3 D15 Glossary RAG: ingest into pgvector Give the agent cited business definitions retrieved from documents, not memorized prompts. 2.5 h Local lab — step by step Write a 15-page synthetic business glossary + data dictionary (metric definitions, fiscal calendar, exclusions, region mapping, data-quality caveats). Markdown, one heading per term. Chunk by heading (≈ 300–600 tokens, keep the heading in each chunk), embed locally with nomic-embed-text (768 dims). Store in Postgres with pgvector; add m
- Week 4 D22 Infrastructure as code with CDK (Python) Make the cloud environment reproducible and disposable. 2.5 h Local lab — step by step cdk init app --language python in infra/ ; bootstrap the account once. Stack: S3 data bucket (block public access, encryption, lifecycle), Athena workgroup with scan limit, Secrets Manager secret, ECR repo reference, Cognito user pool + app client, tags project=fde-lab . cdk deploy , verify, then cdk destroy and deploy again to prove it is disposable. infra/stack.p
- Week 5 W05 Permissions-aware RAG Document ACLs + RLS, locally and on Aurora · Analyze 14 h What you'll master Retrieval must respect who is asking. You will filter retrieval by ACL metadata derived from the authenticated identity, and prove with tests that no chunk crosses a boundary. Objectives Model ACL metadata (public, finance, hr, exec) on every chunk. Derive the filter from the authenticated identity , never from the prompt. Apply Postgres RLS on the glossary table as a second layer. Write leak
- Week 6 W06 Semantic layer with dbt Staging → marts → governed metrics · Analyze 14 h What you'll master Move metric definitions out of a YAML prompt and into a real semantic layer that analysts and agents share. The agent queries metrics first and raw SQL only with justification. Objectives Build a dbt Core project on DuckDB: staging, intermediate, marts. Define metrics with MetricFlow (or Cube) and test them. Add dbt tests (unique, not_null, relationships, accepted_values). Give the agent a query_met
- Week 7 W07 Build vs buy: managed text-to-SQL on AWS Bedrock KB structured store vs your agent · Evaluate 14 h What you'll master Customers will ask “why not just use the managed service?” You will run the same golden set on a managed option and write an honest build-vs-buy memo. Objectives Configure a Bedrock Knowledge Base structured data store (Redshift query engine). Use query generation without execution to inspect SQL safely. Compare accuracy, control, latency and cost on the same 50 questions .
- Week 8 W08 Evals in CI Regression gates on every change · Evaluate 14 h What you'll master Make quality non-negotiable: any change to prompt, model, semantic layer or tools runs the evals, and a drop blocks the merge. Objectives Run the golden set in GitHub Actions on every PR. Add promptfoo or DeepEval assertions for answer quality and abstention. Add Ragas metrics for retrieval (context precision/recall). Block merge if execution accuracy drops more than 3 points . Publish an eval badge and trend ch
- Week 9 W09 Code-interpreter analysis agent Sandboxed pandas/Polars for “why” questions · Analyze 14 h What you'll master SQL answers “what”; analysts are asked “why”. Add a sandboxed Python execution tool that runs statistical checks and charts, and verify its numbers independently. Objectives Run generated code in an isolated container : no network, CPU/memory limits, time limit. Pass data by file, not by giving the sandbox database credentials. Require verification : every number in the narrative is
- Week 10 W10 Data engineering for agents + Project 2 ship Ingestion, partitions, quality, drift · Analyze Project 2 14 h What you'll master Agents are only as good as their data. Build an ingestion pipeline for NYC Taxi data with quality checks, and give the agent a data-health tool so it warns instead of answering on bad data. Objectives Ingest monthly Parquet into MinIO/S3 with partitioning . Data-quality checks: freshness, nulls, ranges, row counts. Detect schema drift and expose it via data_health()
- Week 11 W11 Workflow agents with human approval Graphs, state, checkpoints, HITL · Evaluate Project 3 14 h What you'll master Move from Q&A to action: an investigation workflow that gathers evidence, drafts a finding, waits for human approval, then acts idempotently. Objectives Model a workflow as an explicit graph with typed state. Add a human-in-the-loop interrupt before any write. Make write tools idempotent (idempotency keys) and retries safe. Persist checkpoints so a run can resume after failure.
- Week 12 W12 Gateway, Policy and Identity Cedar default-deny, OIDC, agent identity · Evaluate 14 h What you'll master Separate authorization from reasoning. Tools sit behind AgentCore Gateway; Cedar policies decide what each identity may call with which parameters. Objectives Expose tools as Gateway MCP targets . Write Cedar policies: default deny, per-tool, per-parameter limits. Inbound auth with Cognito/OIDC ; outbound credentials via AgentCore Identity. Build a policy test matrix (principal × tool ×
- Week 13 W13 Memory, observability, online evals Production quality loop · Evaluate 14 h What you'll master Operate the agent like a service: traces for every decision, memory used deliberately, and online evaluations sampling real traffic. Objectives Use AgentCore Memory for short-term session context and long-term user preferences. Instrument with OpenTelemetry ; propagate a trace ID end to end. Run AgentCore Evaluations on-demand and online with built-in evaluators. Add ground-truth assertions (expec
- Week 14 W14 Multi-agent + A2A + MCP current spec Interop without chaos · Evaluate 14 h What you'll master Add a second agent only where it earns its place. A “data steward” agent answers data-quality and lineage questions over A2A; your MCP server moves to the current spec. Objectives Know when not to use multiple agents. Implement an A2A agent card and task exchange between two agents. Authenticate agent-to-agent calls (OWASP ASI07 ). Upgrade the MCP server to the 2026-07-28 stateless revision; re-run
- Week 15 W15 Cost and latency engineering Routing, caching, budgets · Evaluate 14 h What you'll master Make the system affordable. Measure, then route small tasks to small models, cache aggressively, and set a cost ceiling per answer. Objectives Build a cost model per answer (tokens, scans, runtime). Model routing : small model for SQL drafts, larger for narrative. Prompt caching and result caching (keyed by normalized SQL + data version). Set p95 latency and $/answer budgets; alert on breach. Optional:
- Week 16 W16 AIP-C01 exam week AWS Certified Generative AI Developer – Professional · Evaluate 14 h What you'll master Convert 15 weeks of hands-on work into the primary credential. Study by domain weight and close gaps with labs, not videos. Objectives Map your projects to the five exam domains and their weights. Take the official practice question set/pretest ; log every miss by domain. Close gaps with targeted labs (guardrails, KB tuning, model customization options, monitoring). Practice scenario el
- Week 17 W17 TypeScript minimum + Project 3 ship Typed front end / MCP client · Create Project 3 14 h What you'll master TypeScript appears in a meaningful share of FDE postings. Learn enough to build a typed front end or MCP client and to read customer TS codebases. Objectives TypeScript essentials: types, interfaces, generics, async/await, zod validation. Build a Next.js page (or Node CLI) calling your API with typed responses. Or build a TS MCP client against your server. Approval UI for Project 3 (a
- Week 18 W18 Capstone: discovery Supplier onboarding compliance & risk analytics · Create Project 4 14 h What you'll master Run the capstone like a real engagement. This week produces no code: only discovery artifacts a sponsor would sign. Objectives Run a recorded 45-minute discovery with a peer playing the sponsor. Map the current workflow and measure a baseline (minutes per case, cycle time, rework). Write the discovery brief and data-access request . Define acceptance criteria and a no-AI alternativ
- Week 19 W19 Capstone build I: extraction + rules Documents → structured fields → deterministic checks · Create Project 4 14 h What you'll master Build the backbone: extract fields from supplier submissions, validate them with rules, and store with provenance. Objectives Structured extraction with schemas and confidence. Deterministic rule checks (expiry dates, missing documents, thresholds). Provenance: every field links to its source page. Field-level accuracy eval on a labeled set. Weekly demo + stat
- Week 20 W20 Capstone build II: risk analytics + analyst Q&A Scores, text-to-SQL, approvals · Create Project 4 14 h What you'll master Add risk scoring over structured data and reuse your Analyst Copilot for onboarding questions. Approvals gate every status change. Objectives Transparent risk score (explainable features, no black box). Analyst Q&A over onboarding data via the semantic layer. Approval before onboarding status changes. Second timed take-home rehearsal (5 h). End-to-end happy path. Vocabul
- Week 21 W21 Capstone hardening Security, failure injection, runbook · Create Project 4 14 h What you'll master Make it production-shaped: full OWASP agentic mapping, failure injection, rollback and a runbook another engineer can use. Objectives Red-team with poisoned supplier documents (ASI01, ASI06). Failure injection : model timeout, tool 500s, stale data. Rollback demonstrated via CI/CD. Runbook : alerts, dashboards, common incidents. Risk register mapped to OWASP ASI + NIST AI RMF. Vocabulary Blast
- Week 22 W22 UAT and change control Acceptance against agreed criteria · Create Project 4 14 h What you'll master Run user acceptance testing against the criteria agreed in Week 18 and handle scope changes formally. Objectives Run UAT scripts with a peer as business user. Process two change requests with the template. Produce an acceptance report : criteria, results, gaps, decision. Optional: Databricks Generative AI Engineer Associate if targeting Databricks-ecosystem roles. Handover pack draft. Vocabu
- Week 23 W23 Business value and executive readout ROI, risk posture, decision · Create Project 4 14 h What you'll master Translate evidence into a decision. Build the ROI model from measured baseline and pilot results, label assumptions, and present to an executive in 10 minutes. Objectives ROI model : baseline vs pilot, modeled scale, cost per case. Explicit assumptions and sensitivity analysis. Exec deck : problem → evidence → risk → ROI → decision. Three full mock interview loops begin. Update Linked
- Week 24 W24 FDE-ready: polish, mock loops, launch Gate G4 · Create 14 h What you'll master Finish: polish four projects, complete mock loops, publish the capstone case study, and launch your search or internal FDE practice. Objectives Polish all READMEs to the 5-minute evaluation standard. Mock loops #2 and #3 with peers or mentors. Publish the capstone case study and a teaching artifact (talk/workshop). Decide on optional SAP-C03 (only if not already held). Set up an ongoing practice loop (monthly eva
Setup
1. Step 1 · Base toolchain
- macOS Windows (WSL2) Linux macOS Copy xcode-select --install /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" brew install uv git gh jq duckdb awscli node brew install --cask docker # or OrbStack / Colima brew install ollama && (ollama serve &) npm install -g aws-cdk uv --version && docker --version && ollama --version && aws --version && cdk --version PowerShell (admin) Copy wsl --install -d Ubuntu-24.04 # Install Docker Desktop -> Settings -> Resources -> WSL Integration -> enable Ubuntu # Install Ollama for Windows (native). From WSL reach it at http://localhost:11434 # (enable mirrored networking in .wslconfig) or use the Windows host IP. Inside Ubuntu (WSL) Copy sudo apt update && sudo apt install -y git jq unzip build-essential curl curl -LsSf https://astral.sh/uv/install.sh | sh curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o awscliv2.zip && unzip awscliv2.zip && sudo ./aws/install curl -fsSL https://deb.nodesource.com/setup_22.x | sudo -E bash - && sudo apt install -y nodejs && sudo npm i -g aws-cdk (type -p gh >/dev/null) || sudo apt install -y gh Linux Copy curl -fsSL https://get.docker.com | sh && sudo usermod -aG docker $USER # log out/in curl -LsSf https://astral.sh/uv/install.sh | sh curl -fsSL https://ollama.com/install.sh | sh # AWS CLI v2 + Node 22 + CDK as in the WSL block
2. Step 2 · Models
- Ollama Copy ollama pull qwen3:8b # default tool-calling model on 16 GB machines ollama pull nomic-embed-text # local embeddings (768 dims) # 32 GB+ RAM or 24 GB VRAM: ollama pull qwen3:30b-a3b ollama show qwen3:8b # confirm "tools" under Capabilities Third-party 2026 guides rank Qwen3 8B as the default local tool-calling model; treat their reliability figures as anecdotal and measure on your golden set.
3. Step 3 · Project dependencies
- uv Copy uv init analyst-copilot && cd analyst-copilot && uv python pin 3.12 uv add duckdb polars pandas pyarrow sqlglot fastapi uvicorn pydantic streamlit \ "psycopg[binary]" pgvector boto3 ollama "strands-agents[ollama]" strands-agents-tools \ "mcp[cli]" arize-phoenix-otel pyyaml httpx uv add --dev pytest ruff moto deepeval ragas ipykernel jupyterlab
4. Step 4 · docker-compose.yml
- docker-compose.yml Copy services: postgres: image: pgvector/pgvector:pg17 environment: {POSTGRES_USER: fde, POSTGRES_PASSWORD: fde_local_only, POSTGRES_DB: analytics} ports: ["5432:5432"] volumes: [pgdata:/var/lib/postgresql/data, ./sql/init:/docker-entrypoint-initdb.d:ro] healthcheck: {test: ["CMD-SHELL", "pg_isready -U fde"], interval: 5s, retries: 10} minio: image: minio/minio command: server /data --console-address ":9001" environment: {MINIO_ROOT_USER: minio, MINIO_ROOT_PASSWORD: minio_local_only} ports: ["9000:9000", "9001:9001"] volumes: [miniodata:/data] phoenix: image: arizephoenix/phoenix:latest ports: ["6006:6006", "4317:4317"] jupyter: image: quay.io/jupyter/scipy-notebook ports: ["8888:8888"] volumes: [./notebooks:/home/jovyan/work, ./data:/home/jovyan/data] sandbox: # Week 9 code-interpreter target image: quay.io/jupyter/scipy-notebook network_mode: none mem_limit: 2g cpus: 1.0 volumes: [./sandbox:/home/jovyan/work, ./data/extracts:/home/jovyan/data:ro] command: ["sleep", "infinity"] profiles: ["sandbox"] localstack: # optional; needs LOCALSTACK_AUTH_TOKEN; Hobby plan = non-commercial image: localstack/localstack environment: {LOCALSTACK_AUTH_TOKEN: "${LOCALSTACK_AUTH_TOKEN}"} ports: ["4566:4566"] profiles: ["aws-emu"] volumes: {pgdata: {}, miniodata: {}} Run Copy docker compose up -d && docker compose ps # Postgres :5432 · MinIO console http://localhost:9001 · Phoenix http://localhost:6006 · Jupyter :8888 docker compose logs jupyter | grep token # Jupyter login URL docker compose down -v # wipe volumes (re-runs init SQL)
5. Step 5 · Datasets
- Dataset Use How TPC-H (DuckDB extension) Weeks 1–8: clean schema, known answers CALL dbgen(sf=1) NYC TLC Yellow Taxi (Parquet) Weeks 9–10: volume, dirty values, time series Download monthly files from the TLC Trip Record Data page Chinook / Northwind Quick demos, small readable schemas SQL scripts from their public repos BIRD dev set Eval-method practice only Remember the documented annotation errors Synthetic (Faker) Projects 3–4: procurement, suppliers with seeded anomalies Generator script + ground-truth file
6. Step 6 · Read-only role and row-level security
- sql/init/10_roles.sql Copy CREATE SCHEMA IF NOT EXISTS tpch; CREATE ROLE agent_ro LOGIN PASSWORD 'agent_ro_local'; GRANT CONNECT ON DATABASE analytics TO agent_ro; GRANT USAGE ON SCHEMA tpch TO agent_ro; ALTER DEFAULT PRIVILEGES FOR ROLE fde IN SCHEMA tpch GRANT SELECT ON TABLES TO agent_ro; ALTER ROLE agent_ro SET default_transaction_read_only = on; ALTER ROLE agent_ro SET statement_timeout = '15s'; sql/init/20_rls.sql (apply after loading tables) Copy -- One DB role per region/user; never let the model SET roles or session variables. CREATE ROLE agent_emea LOGIN PASSWORD 'x' IN ROLE agent_ro; ALTER ROLE agent_emea SET default_transaction_read_only = on; ALTER TABLE tpch.orders ENABLE ROW LEVEL SECURITY; CREATE POLICY emea_only ON tpch.orders FOR SELECT TO agent_emea USING (o_custkey IN ( SELECT c.c_custkey FROM tpch.customer c JOIN tpch.nation n ON c.c_nationkey = n.n_nationkey JOIN tpch.region r ON n.n_regionkey = r.r_regionkey WHERE r.r_name = 'EUROPE')); -- agent_ro (no policy) now sees no orders rows: add a permissive policy for it if needed. Note: init scripts run before you load TPC-H, so default privileges cover tables created later by fde . If you load tables first, run GRANT SELECT ON ALL TABLES IN SCHEMA tpch TO agent_ro .
7. Step 7 · SQL guard (defense layer 1 of 4)
- agent/guard.py Copy import sqlglot from sqlglot import exp ALLOWED = {"customer", "orders", "lineitem", "nation", "region", "part", "partsupp", "supplier"} FORBIDDEN = (exp.Insert, exp.Update, exp.Delete, exp.Drop, exp.Create, exp.Alter, exp.Command, exp.Merge) def guard(sql: str, dialect: str = "duckdb", max_rows: int = 1000) -> str: stmts = [s for s in sqlglot.parse(sql, read=dialect) if s is not None] if len(stmts) != 1: raise ValueError("Exactly one statement allowed") root = stmts[0] if not isinstance(root, (exp.Select, exp.Union)): raise ValueError("Only SELECT queries allowed") if any(True for _ in root.find_all(*FORBIDDEN)): raise ValueError("Write/DDL detected") ctes = {c.alias_or_name.lower() for c in root.find_all(exp.CTE)} tables = {t.name.lower() for t in root.find_all(exp.Table)} - ctes if any(not t for t in tables) or not tables <= ALLOWED: raise ValueError(f"Table or table function not allowed: {sorted(tables - ALLOWED)}") if isinstance(root, exp.Select) and not root.args.get("limit"): root = root.limit(max_rows) return root.sql(dialect=dialect) Layers 2–4: DuckDB read_only=True + SET enable_external_access=false ; Postgres read-only role + statement_timeout ; RLS per user. Cloud adds Lake Formation, Athena scan limits and AgentCore Policy (Cedar). Test table functions like read_csv(...) explicitly: confirm in your tests that the guard rejects them.
8. Step 8 · Local → AWS mapping and cost controls
- Local AWS counterpart Cost control DuckDB / Parquet S3 + Glue Data Catalog + Athena Partition data; workgroup per-query scan limit MinIO S3 Lifecycle rules; tag project=fde-lab Postgres + pgvector Aurora PostgreSQL Serverless v2 + pgvector, or Bedrock Knowledge Bases Stop/delete after each lab Ollama (qwen3:8b) Amazon Bedrock models Small models for dev; log tokens per request sqlglot guard + RO role + RLS IAM + Lake Formation + AgentCore Policy (Cedar) Policy billed per authorization request FastAPI container AgentCore Runtime or ECS Fargate (CDK) cdk destroy each session FastMCP server AgentCore Gateway (MCP targets) — Sandboxed Jupyter AgentCore Code Interpreter Session timeouts Phoenix AgentCore Observability → CloudWatch Log retention 7–14 days evals/run.py AgentCore Evaluations (on-demand / online / batch) Sample online traffic — (Week 7 only) Bedrock KB structured store on Redshift Serverless Create, test, delete same day moto Dedicated sandbox AWS account Budgets at 50/80/100% + Cost Anomaly Detection Makefile: one-command teardown Copy nuke: cd infra && cdk destroy --all --force aws s3 rm s3://$$BUCKET --recursive || true spend: aws ce get-cost-and-usage --time-period Start=$$(date -u +%Y-%m-01),End=$$(date -u +%Y-%m-%d) \ --granularity MONTHLY --metrics UnblendedCost --filter '{"Tags":{"Key":"project","Values":["fde-lab"]}}' Cloud spend figures in this program are planning estimates. Check current Bedrock, AgentCore, Athena, Aurora and Redshift pricing pages before each cloud week.
Which model for which computer
| Computer memory | Suggested open models | Command |
|---|---|---|
| 8 GB · practice app only | Small Qwen3 model; does not meet the full-stack minimum | ollama pull qwen3:1.7b |
| 16 GB · full stack minimum | Qwen3 8B, lightweight Phoenix tracing | ollama pull qwen3:8b |
| 32 GB / GPU recommended | Qwen3 8B with more headroom for data and services | ollama pull qwen3:8b |
Notes for teachers
- Programme workload is approximately 360 hours plus a 3-hour diagnostic; credits and employment milestones require review.
- Keep local practice on 127.0.0.1. Never expose Ollama or database ports to an untrusted network.
- Use synthetic/public data and least-privilege sandbox credentials. Do not put real customer data or cloud keys into the practice app.
- Run local iterations first. Check current cloud pricing, set budget alerts and tear down cloud resources after each exercise.
- The ZIP contains source code examples, not a complete production agent. Re-check SDK versions, model tags, licences and time-sensitive source claims.
Troubleshooting
| Full stack runs out of memory | Use the 8 GB practice app alone, or a 16–32 GB machine for the full stack; prefer Phoenix over the larger tracing stack. |
| Ollama unavailable | Start the Ollama application or run ollama serve; verify the model is installed. |
| Database init changes do not apply | Init scripts run on fresh volumes only. Export any work first; deleting volumes destroys local data. |
| SQL is rejected by the guard | Use one SELECT, allowed tables and explicit limits. Add a failing test before changing a safety boundary. |