ProjectBuild an AI-Powered Digital Bank with RAG: the explanation · Start here · part 1 of 20
Part 1 · Start here

Build an AI-Powered Digital Bank with RAG: the explanation

2 min read·

Eighteen illustrated modules that take a working system apart. The system is in ../source-code/: a digital bank whose AI assistant answers customers from the bank's own documents and the customer's own data, and moves money only after the customer approves. Admins upload the documents and watch quality.

Who it is for: anyone who knows a little Python and wants to understand, rebuild or extend a production-style AI application, from beginners to working engineers. Each module says what to read first.

How each module is laid out

Every module explains one part of the system in the same order, so you always know where to look.

SectionAnswers
Where this fitsthe same architecture map in every module, with this module's parts highlighted
What it doesthe idea in one picture
How it worksthe mechanism step by step, one figure per step, with real data
Code tourthe real files, short excerpts, every line explained in plain words
Design decisionswhat was chosen, the alternatives, and why, with measured numbers
What can go wrongfailures and attacks, how the code handles each, and the test that proves it
Try it yourselfexact commands and what you should see
When to choose differently(inside Design decisions) the scenarios where another technique wins, and whether this project already has a setting for it
Check yourself, Key termsa short quiz and a glossary

Figures use one colour language: blue is our system, amber is the model or anything uncertain, green is correct or safe, red is failure or attack, grey is background.

Modules

#ModuleMain code
0Project overview: a guided tour of the running appscreenshots of the real app, no code
1The problem a bank assistant solvesscripts/plain_vs_grounded.py, core/rbac.py, evals/datasets
2The solution: retrieval, tools and approvalagent/graph.py, agent/tools.py
3Infrastructure decisionspyproject.toml, docker-compose.yml, core/config.py
4High-level designmain.py, services/assistant_service.py
5Low-level designmodels/, alembic/, schemas/
6Authentication and RBACcore/security.py, core/rbac.py, services/auth_service.py
7Core banking and synthetic customersservices/banking_service.py, services/seed.py
8Document ingestionrag/parsing.py, rag/chunking.py, rag/ingest.py
9Hybrid retrievalrag/retriever.py
10The agentagent/graph.py, agent/tools.py
11Model routing: two modelsagent/router.py, agent/llm.py, observability/costs.py
12Guardrails and PII maskingagent/guardrails.py, core/pii.py
13Prompt versioningservices/prompt_service.py, models/prompt.py
14Evaluationevals/
15Observabilityobservability/, core/logging.py
16The frontend and running it locallyfrontend/src, Makefile, tests/
17Containers: the Dockerfiles and the local stackbackend/Dockerfile, frontend/Dockerfile, frontend/nginx.conf.template, docker-compose.yml
18Deploying to Google Cloud step by step, with CI/CDdeploy/gcp/, .github/workflows/ci.yml, .github/workflows/deploy.yml