Turn a dataset and a YAML file into a live, explained, multi-tenant AI product demo.
Tabular ML · deep learning · agentic RAG & GraphRAG · assisted forms · voice · a governed data platform — behind a real login, on Kubernetes.
▶ The 3-minute pitch (click for the narrated video) — data layer → ML, deep learning & GenAI consumption → AI gateway, governance & traceability. Every frame is the real app.
5 kinds of scenario (incl. a governed open-source data platform) · a showpiece dashboard for most of them · every one of them just a scenario.yaml
Follow the Money — ten days of payments at 13 banks, replayed hour by hour; every holder scored and explained.
Formerly known as ai-circus-framework. 🚧 Work in progress — a personal, evolving open-source project: architecture, scenarios and UI are all still moving. New scenarios — and, when one needs it, the generic module behind it — land continuously; the Showcase and the Scenario catalog always list what exists. Treat anything here as a snapshot rather than a finished product.
A scalable, multi-tenant microservices platform for building and demoing data-science and GenAI scenarios. A scenario is product content, not code: one YAML file picks the data, the model, the chat and — optionally — a custom dashboard tab that tells the scenario's story. One service instance per kind serves every scenario of that kind, every request is checked against the caller's tenant, and every prediction comes with its why.
Every scenario gets the generic tabs (Scenario · Data & BI · ML Predictions · ML Insights, or
their deep-learning equivalents) plus, optionally, a showpiece tab picked with ui_extras in
its scenario.yaml. Each tab is a generic renderer — a new scenario reuses any of them with no UI
code — and each one is backed by the real deployed model: live /predict calls, SHAP, and
honest out-of-fold scores wherever the tab reveals real outcomes.
📹 Watch Wall · camera_wallWildfire Smoke Watch — held-out HPWREN lookout cameras replayed side by side and scored live as each frame arrives; alerts timed against the moment the plume first appeared, false alarms counted, threshold sliders, occlusion heatmap on click. |
🎛 Change cameras · camera_wallPick any six of 11 held-out lookouts — fires, fainter fires, and no-fire controls where every alert is a false alarm. Images courtesy of HPWREN, UC San Diego. |
Demonstrations on public or synthetic data — not medical devices, not supervisory, legal or
benefits decisions. Each scenario's chapter and scenario.yaml state its sources and limits.
- Showcase — every custom dashboard
- Tour of the platform
- Scenario catalog
- Getting started
- Architecture
- LLM providers
- Adding a new scenario or service
- Testing & CI
- Reserved for later
- Why this exists
- Contributing
- Author & license
A single branded entry point: Keycloak-managed sign-in for real users/organizations, or the admin key shortcut for quick local demos — both resolve through the exact same identity path on the backend, so nothing is a security bypass, just a different way in.
Every scenario a tenant is entitled to, rendered generically from scenarios/*/scenario.yaml —
no per-scenario UI code — grouped by kind (Machine Learning, Deep Learning,
Conversational Assistant, Assisted Forms) with a Domain filter — the industries,
plus the learning/society domains Tutorials and Society & Ethics. Cards show their task
type (classification/regression, NLP/computer vision) and a chip for tutorial scenarios; within
each kind, the public-sector scenarios come last. The full catalog is in the
table below.
A tutorial scenario teaches the ML workflow on a classic dataset. titanic opens on an
11-chapter Tutorial tab (framing, cleaning, feature engineering, exploration,
cross-validated model selection, honest hold-out evaluation, SHAP, what-ifs, Responsible AI),
where every chart and metric is live. Its Voyage tab puts every passenger back aboard the
ship: reveal their real fate, find the model's surprises, and get any passenger's
probability explained as a SHAP waterfall, with a live what-if editor. Full walkthrough:
docs/scenarios/titanic.md.
toxic_leadership is the NLP tutorial, about toxic management and the work environment it
creates. In most companies it takes very few people — managers, salespeople, self-styled "AI
experts" with an inflated CV — to embitter a technical team: they offload their own job onto the
engineers, overload them and spread falsehoods about them. Engineers say so in what they write,
and senior engineers and tech leads have a responsibility to recognise the pattern and report it
with evidence. Its 13 chapters cover anonymisation, the halo effect, TF-IDF, gradient boosting on
words and ratings together, the vocabulary of toxic management, bag of words vs transformers
(TF-IDF, MiniLM, MPNet and voyage-4-nano, measured) and how to speak up responsibly. The
Office tab seats every review in an office tower; click one to read it with the words the
model weighed highlighted, and compare the deployed TF-IDF model with the sentence-transformer
challenger. The Leadership check reads a description of behaviour (never a named person)
against Project Oxygen's great-manager behaviours, the Toxic Leadership Scale and the patterns
engineers report most — offloading, overloading, credential inflation, spreading falsehoods. Full walkthrough: docs/scenarios/toxic_leadership.md.
Most AI demos start from a CSV. A real company starts from tills, a web shop, an ERP and daily files from a franchise
whose old systems nobody dares touch — and the hard part is making all of that trustworthy before any dashboard,
model or assistant sees it. surf_retail is the framework's first data product (scenario kind data_product): a
whole open-source data platform, end to end, around a fictional chain of surf, SUP and kite shops — 24 shops on the
coasts of Spain, France, Italy, Greece, Cyprus and Malta, a web shop, an ERP and five years of history. The
company, its brands and every sale are invented by the author, a surf enthusiast; the data comes from the scenario's own
simulator and nothing is for sale. Full walkthrough: docs/scenarios/surf_retail.md.
How a sale becomes trusted data. A till publishes a receipt to Kafka (a topic per tenant); the Greek
franchise's old tills send a daily file reconciled against a control total; five years of history arrive as
migration files; the ERP is captured by change data capture. data-ingest checks every record against its JSON
Schema contract and business rules — failures go to quarantine, where a data steward fixes and replays them — and
stores the rest once, by key, in bronze (re-sends are ignored, corrections counted), updates the live per-minute
tiles and archives to an Iceberg lake. dbt builds tested silver (clean, pseudonymised) and gold marts,
and one governed API, data-api, serves every door: the dashboards, governed SQL, Superset, and the assistant — all
with the same metrics, scoped to the tenant and to the user's role. View as a store manager and every door shows only
that store.
| Tab | What it shows |
|---|---|
| Guided tour | The whole platform as a live map: eleven steps at three depths (Simple, Detailed, Engineer) with live numbers and a try it button that does the real thing — ring up a sale, send a broken receipt, re-send a duplicate, ask the assistant |
| Surf HQ | Five years of seasons as a heatmap (summer lights up SUP, spring and autumn light up kites, Black Friday flashes every row) and next week's forecast, shop by shop, from a model trained on the platform's own gold marts |
| Live flow | The path every record takes, live tiles, pipeline events, and controls to simulate sales, malformed receipts, legacy files with a missing receipt and ERP price changes |
| Dashboards | Revenue, receipts, average basket, margin and loyalty share with a map and ranking of the shops, period and comparison pickers |
| Explore · Quality & lineage | Records with their processing trail, datasets, SQL and quarantine; freshness against SLOs, dbt test results, file-delivery reconciliation and lineage |
| Web shop | A fictional storefront with a recommender (association rules over every basket) whose orders become real web orders travelling the same pipeline |
Models on the gold marts. The surf_ml scenario holds weekly demand (LightGBM regression: units sold next week per shop and
category, from the season, recent weeks and the same week last year) and board buyers (surf_ml~buyers, classification:
will a loyalty customer buy a board in the next 90 days — customers are pseudonymised keys only) are ordinary
tabular_ml models whose training data is exported from the gold marts, so they are trained by the same pipeline as
every other model and the assistant can call them (ml_predict) next to its governed data and catalogue tools.
Run it. It is optional and never part of make k3s-all; see the tier table
for what each tier adds and costs:
make k3s-data-demo # every scenario kind + the core, analytics and bi data tiers (governance, MLflow, voice off)
make k3s-data-seed # five years of history through the real pipeline (k3s-data-seed-lite: one year)
make k3s-data-ml # train the two models on the feature martsThen open http://aiopen.localhost → Angel's Surf Co. — Data Platform.
Dataset summary stats, a filterable/queryable row explorer, a build-your-own chart dashboard, and credit for the original public dataset — all generated from the scenario's schema, not hand-built per dataset.
Run the live trained model on one record (or a batch), and see why it predicted what it did via a real, per-prediction SHAP breakdown — plus global feature importance and partial-dependence sweeps computed from live API calls, not precomputed synthetic charts.
Settings is purely about preferences and configuration — three sections, nothing operational (that lives on the admin Platform page below):
- Appearance (every user) — pick a theme; saved in the browser, applied instantly.
- LLM Provider Settings (admin) — every configured provider's live routing status in one
place, a per-provider Test button (a real completion round-trip, or Test All for every
provider concurrently), and instant switching of the active model — the same screen that makes
step 2 of Getting Started concrete. Keys still come from
.env(see LLM providers). - Voice Mode Settings (admin) — which speech-to-text / text-to-speech engine powers voice mode: the self-hosted defaults (Whisper / Piper, no API key) or a cloud engine (Deepgram, ElevenLabs, Cartesia) once its key is set; applies to the very next voice request, no restart.
Logged in as admin, a Platform button next to Settings opens the operational side of the
app, in five tabs:
-
Health — a live dashboard of every microservice, store and monitor: up / degraded / down / stopped / not deployed, probe latency, and (on k3s) each pod's readiness and restart count, re-checked every 15 s — with one-click links to the admin consoles: Langfuse (the GenAI monitor: every LLM call, per tenant/scenario/conversation), MLflow (the MLOps monitor: every training run's candidates, scores and selected model), Keycloak and the object store. Every card has a Ping button (three server-side probes in a row, with their latencies), and on k3s the optional services — voice (
agui-voice), MLflow, Langfuse (+ its ClickHouse),dl-inferenceand Kafka — get Start/Stop: scale to 0 to free memory, back to 1 later, data kept. See Observability below. -
Monitor — live CPU, memory and GPU usage (k3s): the node against its allocatable capacity, the GPU's utilization/memory/temperature/power, sparklines of the last few minutes, and every workload's CPU and memory against its own memory limit (heaviest first — past ~85 % it's the next OOM kill).
-
Capabilities — the live capability roadmap (what's built vs. planned, grouped by the Data / AI-BI-ML / Governance pillars of the Architecture) plus the operational controls behind it: pipeline job status/trigger, recent Kafka events, Change-Data-Capture, the Iceberg lakehouse, semantic/federated queries and the AI Gateway's rate limits. See Data Platform below.
-
Governance — governance at a glance (see Governance-ready by standards): which switches are on, the audit trail with a chain-verified badge and the latest admin changes, an AI-BOM (CycloneDX) download, and every AI system with what its owner declared — EU AI Act risk category and human oversight. It works while everything is off, which is the default.
-
Deep Learning — GPU availability, the deployed deep-learning models and in-cluster training (see Deep learning).
Only the visible tab is mounted, so each tab's poll stops while you're on another one.
The whole app is skinned from one Theme object (colors + a logo, see ui-react/src/themes/) —
switching themes in Settings → Appearance is instant, no rebuild. Three ship today: Tron
(the neon dark default), White Tron (the same blue/cyan branding on flat, light,
corporate-friendly surfaces) and White Green — adding one is a new entry in that folder,
nothing else. A fork can also keep its own themes out of git: any demo/themes/<name>/theme.json
(untracked) is merged into the picker at build time (ui-react/vite-plugins/demo-themes.ts) —
e.g. the Lime Slate theme in the Settings screenshot above.
A real LangChain tool-calling agent, not a fixed "always retrieve" pipeline — it decides whether a question needs retrieval at all, grounded in the scenario's own reference documents.
A RAG scenario can also ship a knowledge graph (GraphRAG): the agent then searches concepts and cited relations instead of plain chunks, and the chat splits in two so the subgraph behind each answer lights up — see the AML Rulebook Knowledge Graph.
Inside any tabular_ml scenario, that same assistant is also wired to the live model via
AG-UI (CopilotKit) generative UI: it can call the real prediction API on your behalf and
render the result as an actual chart or sortable table in the chat — not markdown pasted into
prose — using the exact same Plotly/table components as the Data tab.
Every chat panel has a mic button that dictates (press to listen, press again or Enter to stop: what you said is text
in the input, to edit and send with Enter), a voice button (a live conversation, push to talk: press to
start talking, press again — or hold and release the space bar — to send; pressing while the assistant
prepares or says its answer stops it) and a speaker icon on each reply (one-shot text-to-speech).
There is no automatic end-of-speech detection: a pause to think never ends your turn, and a
spoken question gets a short spoken answer, with the details shown (or offered) on screen
(ADR 0033). All are served by agui-voice, a Pipecat pipeline that uses the existing
assistant/rag-agent/form-agent /agui/{scenario_slug} endpoint as its LLM stage — so a
spoken turn lands in the same conversation, with the same tools, screen context and data, as a
typed one, for every scenario kind: by voice the agent also fills the form, draws a chart or has
the guide open a scenario, and then says what it did. Defaults are fully self-hosted (faster-whisper STT + Piper TTS, no API key,
model weights pre-warmed at container start); cloud engines are a .env key plus a pick in
Settings → Voice Mode Settings. With GROQ_API_KEY, Groq's hosted Whisper large-v3-turbo replaces the CPU Whisper
for speech to text (the turn's audio then leaves the cluster; local Whisper takes any turn it fails). Each turn logs its
audio length and level, never its words, so a silent microphone can be told from speech nobody could transcribe.
A recording with no speech in it (a click, a breath) is never transcribed: Whisper would invent words for it.
Settings → Microphone picks the one voice mode listens to, and tests it.
A third scenario kind, alongside tabular_ml and conversational_rag: a generic form rendered
entirely from a scenario's form: config, paired with a chat assistant that can fill fields in
live as you describe your request in plain language — classifying it via RAG over a small
reference catalog, and highlighting which fields it just filled in versus what's still missing.
Public Service Request Portal (service_request) is the reference example: report a
streetlight outage, request an address registration, or apply for a permit, and watch the form
fill itself in as you type.
A form that declares sections renders as an official, paper-like model instead: numbered
section bands, numbered boxes (casillas) on a 12-column grid, pen-mark checkboxes, a signature
line and a box reserved for the Administration. With variants it becomes a family of models
— a general request form plus specific ones sharing one identification block — and the assistant
picks the right model from the RAG catalog. Sede Electrónica — Official Tax Forms
(sede_electronica) is that example, in Spanish: upload a (fictional) ID card, census certificate,
tax notice or bank certificate from the chat's Sample documents and the assistant reads it
(OCR/vision), fills every box it can — saying which document each value came from — and validates
the DNI/NIE control letter and the IBAN check digits. form-agent prints the same sheet as a PDF: a
watermarked draft at any time, and after filing, the stamped copy with its filing receipt (registry
number, verification code, QR and barcode).
Five kinds of scenario exist today (tabular_ml, conversational_rag, assisted_form, deep_learning, data_product) — adding a new one is a YAML file, never new UI or container
code (see Adding a new scenario).
| Scenario | Kind / task | What it predicts | Source |
|---|---|---|---|
Customer Churn Prediction (churn) |
tabular_ml — classification |
Bank customer churn risk | Kaggle — Sonali Dasgupta |
Machine Predictive Maintenance (mpm) |
tabular_ml — classification |
Industrial machine failure risk | Kaggle — AI4I 2020 |
Supply Chain Shipping ETA (supply_chain) |
tabular_ml — regression, domain logistics |
Days to delivery — a Dispatch Tower tab: the 8 hubs with real shipments in flight, each hub's ETA landscape (a 33×33 grid of destinations scored at once, drawn as isochrones) and a race of every carrier × priority to a pinned destination with 90% prediction intervals — fastest option and safest promise date | AWS SageMaker workshop (synthetic) |
Supermarket Weekly Sales (supermarket_sales) |
tabular_ml — regression |
Weekly department sales | Kaggle — Walmart dataset |
Electric Motor Speed (electric_motor) |
tabular_ml — regression |
Motor rotational speed (rpm) | Kaggle — Electric Motor Temperature |
Building Energy Consumption (energy_building) |
tabular_ml — regression + forecast |
Appliance energy use (Wh) under given conditions; and hourly, 24 hours ahead | UCI — Appliances Energy Prediction |
CNC Turning Surface Finish (cnc_surface_finish) |
tabular_ml — regression |
Machined-part surface roughness (Ra) | Original content (synthetic, physically grounded) |
Steel Plate Defect Triage (steel_defects) |
tabular_ml — classification |
Unrecognized optical-scan defect flag | UCI — Steel Plates Faults |
Turbofan Engine Remaining Useful Life (turbofan_rul) |
tabular_ml — regression |
Jet engine RUL (operating cycles) | NASA C-MAPSS FD001 |
Regional Electricity Demand Forecasting (luznova_regional_demand) |
tabular_ml — regression + forecast |
Daily electricity demand per region (MWh) — with a live Spain regional map tab; a second model forecasts each of 50 provinces 30 days ahead | Original content (synthetic, real Spain geography) |
Gas Meter Anomaly Detection (luznova_gas_anomaly) |
tabular_ml — classification |
Anomalous gas meter reading probability | Original content (synthetic, physically grounded) |
EV Charging Session Energy Prediction (luznova_ev_charging) |
tabular_ml — regression |
Energy delivered per charging session (kWh) | Original content (synthetic, physically grounded) |
Gas Contract Conversion & Revenue Potential (luznova_gas_prospects) |
tabular_ml — classification |
Whether a household prospect in a gas-network expansion area signs a supply contract, plus its revenue potential | Original content (synthetic, real Spain geography) |
Titanic Survival — ML Tutorial (titanic) |
tabular_ml — classification, domain tutorial |
Passenger survival probability — a guided Tutorial tab (every step of the ML workflow, live charts/metrics/SHAP) and a Voyage tab (all 891 passengers aboard an illustrated ship, filterable, SHAP-explained, what-if) · small-data LightGBM, 5-fold CV ROC AUC ≈ 0.88 | Kaggle — Titanic (via angelmtenor/data-science-keras) |
Toxic Management & Work Environment — NLP + ML Tutorial (toxic_leadership) |
tabular_ml — classification with free text, domain tutorial |
Whether an engineer rated senior management 1–2★, from their review text + job context — the vocabulary of the few who offload their job onto engineers, overload them and spread falsehoods — a 13-chapter Tutorial, The Office tab (4,000 reviews in an office tower, word-level SHAP, TF-IDF vs sentence-transformer challenger) and an LLM Leadership check · small-data LightGBM, 5-fold CV ROC AUC ≈ 0.87, hold-out 0.886 | Kaggle — Glassdoor Job Reviews (CC BY-SA 4.0) |
Global Health Shipments · Late Delivery Risk (global_health_shipments) |
tabular_ml — classification, domain logistics |
Whether a line item of HIV/AIDS medicines or test kits reaches the country after its scheduled date, seen when it is planned — a Lifeline Globe tab: 9,949 real shipments (2006-2015) as arcs on a rotating globe, replayed month by month, a split-flap departures board riskiest-first, SHAP + a live one-change re-plan (mode, route, lead time) and an honest out-of-fold backtest reveal · LightGBM, 5-fold CV ROC AUC ≈ 0.90, hold-out 0.92 | USAID SCMS delivery history (US public domain) |
AI Open Framework Reference Guide (ai_circus_reference) |
conversational_rag |
N/A — agentic Q&A over this project's own dev/ML/GenAI reference notes | Original content |
How This Framework Is Built — Architecture Tutorial (framework_architecture) |
conversational_rag |
N/A — Q&A over this repository's own documentation (architecture guide, component reference, every ADR and scenario guide, which components each scenario uses), with the Architecture map tab and an MCP door | This repository's docs |
Public Service Request Portal (service_request) |
assisted_form |
N/A — the assistant fills out and classifies a service-request form live, from conversation | Original content |
Sede Electrónica — Official Tax Forms (sede_electronica) |
assisted_form — official multi-model layout, domain public_sector |
N/A — a Spanish-style electronic office (fictional issuer): a general request form + 4 specific models (change of tax address, instalments, refund of undue payments, family situation for withholding); the assistant picks the model, reads uploaded documents, fills the numbered boxes, checks DNI/IBAN and files it with a PDF receipt | Original content (fictional issuer and documents) |
Bank Distress Early Warning (bank_early_warning) |
tabular_ml — classification, domain public_sector |
Whether a US bank is closed by the regulator within 24 months, from its 31 Dec 2008 call report (CAMELS ratios) — a Watchlist tab: every bank scored into supervisory tiers on a US map and a risk landscape, pillar-level SHAP, a backtest reveal · small-data LightGBM, 5-fold CV ROC AUC ≈ 0.97, hold-out 0.94 | FDIC BankFind Suite (US public domain) |
Enron: Follow the Network (enron_fraud_network) |
tabular_ml — classification + network, domain public_sector |
How closely an Enron insider's pay and e-mail-network profile resembles the 18 persons of interest — a Network tab: the real e-mail network (1999-2002) with the Powers Report partnerships as entities, out-of-fold scores, SHAP dossier, path tracing, communities, a month-by-month replay and a public-record reveal · small-data LightGBM, 5-fold CV ROC AUC ≈ 0.83, out-of-fold 0.81 | Enron insider-pay schedule (ud120) · FERC/CMU e-mail corpus · Powers Report (2002) |
Emergency Social Aid — rules, a model and a person (prestaciones_sociales) |
tabular_ml — classification + business rules + a decision policy, free text in Spanish, domain public_sector |
Whether a (synthetic) municipal emergency-aid application deserves a grant, after deterministic rules stop what is incomplete — the same rules and model for everyone, against fraud (undeclared income, repeated claims, aid for what the household can afford) and favouritism (aid approved by hand for acquaintances) — a Mesa de valoración tab: rules → model → grant / manual review / deny trays with live thresholds, an official paper sheet lit by per-box SHAP, scanned-document intake (OCR + LLM), an equity audit · small-data LightGBM + TF-IDF, hold-out ROC AUC 0.89, with a voyage-4-nano challenger | Synthetic, fictional entity |
Follow the Money (aml_money_trail) |
tabular_ml — classification + a bank-consortium network, domain banking_finance |
Which account holders — people and companies — behave like the ones a money-laundering scheme runs through, from ten days of payments at 13 banks in 13 countries — a Money Trail tab with two views — a world map replaying every payment hour by hour (shape = payment format), a ledger, a watchlist, a SHAP dossier per holder, and a force-directed network graph of holders and banks like Enron's — and a reveal of the eight laundering typologies and how many of each the model flags · LightGBM, 5-fold CV ROC AUC ≈ 0.83, out-of-fold 0.84 (≈ 0.81 without the ACH-heavy format mix) | IBM AMLworld HI-Small (synthetic, CDLA-Sharing-1.0) — Altman et al., NeurIPS 2023 |
AML Rulebook Knowledge Graph (aml_regulation_kg) |
conversational_rag + a knowledge graph (GraphRAG), domain banking_finance |
N/A — agentic Q&A over 18 articles of the EU Anti-Money Laundering Regulation through a knowledge graph of obliged entities, obligations, triggers, authorities, records and limits (135 nodes, 144 relations, each citing its article with a verbatim quote); HippoRAG 2-style retrieval (seed linking + Personalized PageRank) and a panel that lights up the subgraph behind each answer | Regulation (EU) 2024/1624 (AMLR), EUR-Lex — © European Union, reuse authorised |
Angel's Surf Co. — Data Platform (surf_retail) |
data_product, domain retail |
N/A — a fictional surf-retail chain (24 shops, web shop, ERP, five years of history) run through the real pipeline: Kafka → bronze → lake → dbt silver/gold → governed data-api, dashboards and assistant tools; includes a web shop and the Surf HQ control room (optional tiers, see Data products) |
Original content (synthetic, simulator-generated) |
Angel's Surf Co. — Models (surf_ml) |
tabular_ml — several models, domain retail |
Units sold next week per shop and rider group (regression); whether a loyalty customer buys a board in 90 days (classification, pseudonymised keys only); what goes with a product (two recommenders) | Synthetic, from surf_retail's gold marts |
Insurance Retention & Next Best Offer (insurance_portfolio) |
tabular_ml — several models, domain insurance |
Whether a policyholder lapses at renewal (classification); whether they add a product after a campaign (classification); which products are held together (two recommenders) — a Retention watchlist whose selected policyholder gets a next best offer from the other two models, and a Cross-sell leads watchlist · LightGBM, hold-out ROC AUC 0.78 (lapse) and 0.82 (cross-sell), on 5,000 synthetic policyholders | Synthetic (scripts/generate_insurance_portfolio.py) |
Payment Fraud & Financial Crime (financial_crime_desk) |
tabular_ml — several models, free text, business rules, domain banking_finance |
Whether an outgoing cross-border transfer (MT103 / pacs.008-style message) should be escalated as suspicious — fields and free-text purpose, a sentence-embedding challenger and an LLM analyst reading the message against a red-flag rubric, in a Message screening tab; whether a customer payment is fraud, after mule-list, sanctions, verification-of-payee and step-up rules, in a Payment stream tab; whether an account is a money mule, from behaviour over 60 days of transfers, on a Mule network tab with shared devices and addresses; an AML Regulation document tool | Synthetic (scripts/generate_financial_crime.py, scripts/generate_financial_crime_mules.py); AMLR articles, EUR-Lex — © European Union |
Reservoirs & Drought Watch (water_reservoirs_drought) |
tabular_ml — forecast (quantiles), domain public_sector |
Water stored in nine reservoirs and four supply systems of a fictional basin, 7 to 180 days ahead with a p10-p90 band — a Storage forecast tab with a map of the basin, the state against an illustrative drought plan, and assistant tools for what-if, measure comparison, data-quality flags and a weekly bulletin · backtested by year against persistence and seasonal climatology | Synthetic (scripts/generate_water_data.py, a calibrated basin) |
Patient Symptom Triage (NLP) (symptom_triage) |
deep_learning — text |
Likely condition (22 classes) from a patient's own symptom description — fine-tuned BioClinical ModernBERT, word-level explanations, a live Triage Board tab | Hugging Face — gretelai/symptom_to_diagnosis |
Chest X-ray Pneumonia Screening (CV) (chest_xray_pneumonia) |
deep_learning — image |
Pneumonia on a paediatric chest X-ray — fine-tuned ConvNeXt V2, occlusion heatmaps, an AI-prioritized Reading Room tab | MedMNIST — PneumoniaMNIST (Kermany et al.) |
PCB Visual Inspection (CV Anomaly Detection) (pcb_visual_inspection) |
deep_learning — image, task: anomaly_detection |
Defective printed circuit board, learned from good boards only — frozen DINOv2 patch features + PatchCore-style memory bank (AnomalyDINO), anomaly maps vs. ground-truth defect masks, a live Inspection Line tab | Amazon VisA — PCB1 (Zou et al., ECCV 2022) |
Machined Screw Inspection (CV Anomaly Detection — hard) (screw_visual_inspection) |
deep_learning — image, task: anomaly_detection |
Defective machined screw (thread, head, neck, tip) — the same detector as the PCB line on a much harder part (random pose, fine thread texture, defects a few pixels wide), so the Inspection Line shows real escapes and a manual-inspection lane | MVTec AD — Screw (Bergmann et al., CVPR 2019; CC BY-NC-SA 4.0) |
Solar Cell EL Inspection (CV) (solar_cell_inspection) |
deep_learning — image |
Functional vs. defective photovoltaic cell from its electroluminescence image — fine-tuned ConvNeXt V2, occlusion heatmaps, a live Grading Line tab; expert labels include "possibly defective" cells, so it is genuinely hard | ELPV — ZAE Bayern (Buerhop-Lutz et al., 2018; CC BY-NC-SA 4.0) |
Wildfire Smoke Watch (CV) (wildfire_smoke_watch) |
deep_learning — image, frame sequences |
Held-out fire-lookout cameras (fires and no-fire controls, six at a time, swappable with an in-app picker) play side by side, one frame a minute from 40 min before a smoke plume to 40 min after; a fine-tuned ConvNeXt V2 scores every frame live, raises an alert after consecutive smoke frames and reports the minutes it took (or the false alarm) against the recording's ground truth — a Watch Wall tab; tested on 11 lookouts never seen in training | HPWREN FIgLib — UC San Diego (images courtesy of HPWREN; credit reference required) |
Most tabular_ml scenarios above are ported from a real public dataset — full credit/link lives in
each scenarios/<slug>/scenario.yaml's credits field and is surfaced in the Data tab. A few
(cnc_surface_finish and the four luznova_* utility scenarios) are original content instead: a
physically-grounded synthetic generator (real geography/tariff structure, a designed formula, no
real customer data) rather than a ported dataset — each one's scenario.yaml discloses this, and
its generator script lives at scripts/generate_<slug>.py.
One consolidated service instance serves every scenario of a given kind — prediction and
assistant both load every tabular_ml scenario from the same running container, routed by a
{scenario_slug} path segment; rag-agent does the same for every conversational_rag scenario,
and form-agent does the same for every assisted_form scenario.
Most scenarios carry an opt-in showpiece tab (ui_extras in scenario.yaml) — see them all in
the Showcase. Each kind is a generic renderer, so any scenario of the right shape can
reuse it with a few lines of YAML and no UI code:
ui_extras.kind |
Tab | Used by | What it does |
|---|---|---|---|
region_map |
Regional Map | luznova_regional_demand, luznova_gas_prospects |
One shared context batch-predicted for every area of a level (Comunidad / Provincia, Municipio / census area), bubbles on a Spain map, SHAP per bubble |
forecast_board |
Forecast board / Drought control room | energy_building~forecast, luznova_regional_demand~forecast, water_reservoirs_drought |
History, forecast and prediction bands, with levers that shift the assumed future values and re-forecast; an optional schematic map that picks a series. With analysis_toolset: drought_watch it becomes the drought control room: system states, a weekly replay, plan thresholds, what-if and measures, data quality and the bulletin |
fleet_health |
Fleet health | turbofan_rul, electric_motor, luznova_gas_anomaly, luznova_ev_charging |
Real rows replayed unit by unit and scored live; health is the model's score, or actual minus predicted |
row_triage |
Inspection triage / Payment stream | steel_defects, financial_crime_desk~payments |
Rows routed to a person or automatically by a threshold you move, with the real workload and misses, over out-of-fold scores |
message_screening |
Message screening | financial_crime_desk |
An inbox of messages (e.g. credit transfers) by out-of-fold score; the open one drawn as the message, each field tinted by its SHAP push and the free text word by word, next to the transformer challenger and an LLM reading against a red-flag rubric; a typology reveal |
case_tracker |
My cases | service_request, sede_electronica |
The signed-in user's own filed cases: receipt, values and filed PDF |
source_library |
Sources | ai_circus_reference |
The documents the assistant really searches, read back passage by passage from the tenant's collection |
architecture_map |
Architecture | framework_architecture |
The platform map from the architecture catalog, next to the chat: every component by layer and the request flows, step by step |
live_plant |
Live Plant | mpm |
A simulated floor of machines that age every tick, scored by the unmodified /predict/{slug}; client-side-only Shut down / Replace |
process_optimizer |
Optimizer | cnc_surface_finish |
The take-action stage: ~200 candidate recipes scored and costed with a per-part economics model from the YAML, the best in-spec one recommended — then a live line where an auto-pilot re-optimizes as the tool wears, against a static baseline |
voyage_explorer |
Voyage / The Office | titanic (scene: ocean_liner), toxic_leadership (scene: office_tower) |
Every row placed in an illustrated scene, coloured by the model; reveal, surprises, cohort filters, SHAP waterfall, live what-if |
risk_watchlist |
Watchlist | bank_early_warning, churn, insurance_portfolio |
Every entity in risk tiers on a map and a risk landscape, pillar-level SHAP, a backtest reveal; optional next_best_offer from two other models of the scenario |
network_explorer |
Network / Mule network | enron_fraud_network, financial_crime_desk~mules |
The scenario's dataset.graph drawn with d3-force: out-of-fold scores, dossier, paths, communities, replay, an Investigate workspace |
money_trail |
Money Trail | aml_money_trail |
Hourly payment flows on a world map plus a network view, ledger, watchlist and typology reveal |
dispatch_tower |
Dispatch Tower | supply_chain |
Hubs, an ETA isochrone landscape, a carrier × priority race with prediction intervals |
shipment_globe |
Lifeline Globe | global_health_shipments |
Shipments as arcs on a rotating globe, month-by-month replay, a departures board, a one-change re-plan |
case_desk |
Mesa de valoración | prestaciones_sociales |
Rules → model → trays with live thresholds, an official sheet with per-box SHAP, scanned-document intake, an equity panel |
knowledge_graph |
(split RAG view) | aml_regulation_kg |
The regulation's knowledge graph beside the chat, lighting up the subgraph each answer walked |
triage_board |
Triage Board / Inspection Line / Grading Line | symptom_triage, pcb_visual_inspection, screw_visual_inspection, solar_cell_inspection |
Held-out cases replayed into confident lanes and a human-review lane, with a draggable confidence threshold and the automation-vs-safety trade-off |
reading_room |
Reading Room | chest_xray_pneumonia |
An AI-prioritized worklist vs. first-in-first-out on a simulated shift, heatmaps and similar prior studies |
camera_wall |
Watch Wall | wildfire_smoke_watch |
One live tile per held-out camera on a shared clock; every frame is really scored by dl-inference (and labelled replay when it isn't), alerts after N consecutive frames, timed against the recording's ground truth — time to alert, false alarms, a draggable threshold |
A tabular feature can be free text (type: text): TF-IDF runs inside the model pipeline, SHAP
explains predictions word by word (/predict with explain_text), and a scenario can add a
sentence-embedding challenger (model.text_challenger, vectors from llm-gateway's local-embed,
precomputed on the host GPU by make k3s-text-embeddings) and an LLM rubric check
(rubric_check, assistant POST /rubric-check/{slug}).
A scenario can also carry a guided Tutorial tab (tutorial: in scenario.yaml, tabular_ml):
markdown chapters with live charts and data-backed widgets — dataset preview, class balance, the
training leaderboard, the leakage-free hold-out ROC curve and confusion matrix (from
GET /model/{slug}/card, recorded by training before the final refit), global SHAP, and worked
examples scored by /predict. model.cv_folds/model.selection_metric make training rank
candidates by k-fold cross-validated ROC AUC (or accuracy/R²) instead of one hold-out.
Every dataset view shows each row's identity first — the scenario's index_col (e.g.
CustomerId), plus any dataset.display_columns such as a passenger's name — and it is searchable;
neither is ever a model input.
- Kubernetes (recommended) — Docker,
k3d,kubectl,make. - Docker Compose (alternative) — Docker + Docker Compose,
make. - At least one LLM provider, either way — a free API key (Google Gemini's free tier is easiest) or the bundled local Ollama fallback. Chat features simply won't answer without one.
- To contribute (not just run):
git-flow(AVH),uv, Node.js 22 — all installed by step 0.
Already have all that? Skip to step 1. Otherwise step 0 provisions a fresh Ubuntu machine — native, VM, or WSL2 — in a few minutes.
On Windows, first enable WSL2 with an Ubuntu distro — steps 1–6 of
docs/windows-wsl.md, including the .wslconfig RAM/CPU limits — and do
everything below inside that distro (its own filesystem, its own git; the doc explains why).
No Docker Desktop needed or wanted. The doc also covers the one WSL-specific chore that bites
later: the distro's virtual disk grows on the Windows drive and never shrinks by itself.
git is preinstalled on Ubuntu images (sudo apt install -y git if not); the setup scripts
live in the repo, so clone first:
mkdir -p ~/PROJECTS && cd ~/PROJECTS && git clone https://github.com/angelmtenor/ai-circus-framework && cd ai-circus-frameworkTwo idempotent, non-interactive scripts, split by privilege level — the root half (system
update; make, git-flow, curl, compilers, python3, pipx, UTC timezone) and the user
half (uv, nvm + Node.js 22, ~/.local/bin on PATH, git defaults — it warns if
user.name/user.email are unset, so set those first):
sudo ./scripts/setup_sudo.sh./scripts/setup_user.sh && source ~/.bashrcDocker Engine is deliberately not in the scripts — install it from the official
Install Docker Engine on Ubuntu guide (apt
repository method), then the official
post-install step
so every make target here can call docker without sudo:
sudo groupadd docker; sudo usermod -aG docker $USER…and log out and back in (on WSL: wsl --terminate <distro> from PowerShell, then relaunch).
For the Kubernetes (recommended) path, add k3d and
kubectl:
curl -s https://raw.githubusercontent.com/k3d-io/k3d/main/install.sh | bashcurl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" && sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl && rm kubectlConfirm the whole toolchain answers before moving on:
docker run --rm hello-world && docker compose version && make --version | head -1 && git flow version && uv --version && node --version && k3d version && kubectl version --clientgit clone https://github.com/angelmtenor/ai-circus-framework && cd ai-circus-framework # skip if you did step 0
make bootstrap # copies .env.example -> .envOpen the new .env — every setting has a comment explaining it. You don't need to touch most of
it to get a working demo; the two things that matter most (an LLM key, and which deployment path
below) are covered next.
assistant (tabular chat) and rag-agent (document Q&A) won't answer anything until one model
is actually reachable. Pick one of these:
| Option | What to do |
|---|---|
| Cloud provider (recommended) | Get a free API key from GroqCloud (the shipped default, LLM_MODEL=groq-llama) or Google AI Studio (GOOGLE_API_KEY=... + LLM_MODEL=gemini-flash) — or OpenAI/Anthropic/DeepSeek/OpenRouter/Azure — and paste it into .env. See the LLM providers table below for every option and its exact env var. |
| No API key at all | Run make ollama-up — starts a bundled, local, free Ollama container and pulls a small model automatically — and set LLM_MODEL=llama3. |
You can change your mind later from the app itself: Settings → LLM Provider Settings shows
every provider's live status and lets you switch the active model instantly, without a restart
(see the Settings screenshot above) — new keys still require editing .env and
restarting llm-gateway, though. Voice mode needs no key at all out of the box (see
Voice mode).
Two paths get you to the same app — pick one.
A local k3d (k3s-in-Docker) cluster running the exact same stateless services,
via plain Kustomize manifests — see k8s/README.md for the full manifest
reference and design notes.
make k3s-cluster # create the local k3d cluster (port 80, ./scenarios bind-mounted)
make k3s-build # build every service image locally
make k3s-import # import them into the cluster's containerd
make k3s-secrets # generate k8s Secrets from .env/infra
make k3s-up # kubectl apply -k k8s/base
make k3s-wait # wait for every pod to actually be Ready
make k3s-pipeline # REQUIRED on a fresh cluster: etl-tabular -> training Jobs, then restarts prediction
make k3s-verify # curl-check the admin + engineering-demo tenants end-to-endOr run the first six of those (cluster through wait) in one shot: make k3s-all — then
make k3s-pipeline (until it has run, every tabular_ml scenario answers 503 "No trained model
artifacts") and make k3s-verify.
On a 16 GB machine, make k3s-all-lite does the same without the rarely-used MLflow and
agui-voice pods (~1.2 GB less RAM; images are still built, so make k3s-full brings them back).
For a live demo, make k3s-demo also scales Langfuse/ClickHouse and the admin Platform dashboard
to 0 (~2.5 GB) — undo with make k3s-demo-off, and verify meanwhile with
VERIFY_SKIP="langfuse mlflow" make k3s-verify.
Not working the demo? Pause the cluster's containers (frees CPU/RAM, keeps all state) instead of tearing it down:
make k3s-pause # stop the cluster — resume later with `make k3s-resume`
make k3s-resume # start it back up
make k3s-resume-lite # ...or start it back up without MLflow/agui-voiceAfter a code change, rebuild and restart what changed (importing an image under the same tag never restarts its pods):
make k3s-build k3s-import && kubectl -n ai-circus rollout restart deployment/<svc>The browser also needs a standing port-forward to platform-registry (its browser-facing API
isn't reachable through Traefik or k3s-verify's own command-scoped port-forward). make k3s-wait
starts it for you, as a systemd user service wherever systemd runs one (native Linux, WSL with
systemd=true) — so it comes back by itself after a reboot or a platform-registry restart:
make k3s-portforward # (re)start it by hand — only needed without user systemd, after a rebootA missing port-forward shows up as a client-side Failed to fetch right on the login screen even
though every other check passes — see k8s/README.md's "Design notes" for why.
This is dev-parity, single-node only today (no registry — images are built locally and imported
straight into the cluster; no Helm chart, no multi-node/HA) — not yet a drop-in production
manifest set. It's still the recommended path because it's the same manifests you'd adapt for a
real cluster (remote k3s, managed cloud Kubernetes, OpenShift): kubectl apply -k k8s/base
already targets whatever kubeconfig context is active, local or not.
Simplest option for iterating on a single service without rebuilding into a cluster image each time.
make up # every backend service + both UIs
make pipeline # (re)runs the ETL -> training pipeline for the tabular_ml scenarios
docker compose up --build etl-vectorize # vectorizes every conversational_rag scenario's reference docs,
# plus any assisted_form scenario's RAG catalog (e.g. service_request)make all (infra + services + both pipelines + an end-to-end admin-tenant check) runs this whole
compose path in the right order for you, waiting for each container to actually be ready before
moving to the next — safe to re-run any time. If something's clearly broken (stale volumes,
half-applied .env change), make reset-all tears everything down — including data in
postgres/keycloak/qdrant/seaweedfs — and reruns make all from a clean slate.
For a quick look without configuring an identity provider at all, use the login screen's User
dropdown: pick admin and enter the key from .env's ADMIN_API_KEY (angel2026 by
default) as the password — it comes pre-granted access to every scenario. For real
multi-user/multi-tenant login, see "First-time Keycloak setup" further down.
Logged in as admin, the topbar's Platform button opens the Health dashboard of every
service and store (and, on its Capabilities tab, the roadmap and data-platform controls —
see the tour), with links to the
monitors it also watches — Langfuse at
http://langfuse.localhost (sign in with .env's
LANGFUSE_INIT_USER_EMAIL/LANGFUSE_INIT_USER_PASSWORD) and MLflow at
http://mlflow.localhost (the console Basic-Auth user from
make bootstrap, like admin.keycloak.localhost). Out of the box every one of these local
sign-ins shares the same demo password, angel2026 — the admin API key, the Keycloak
bootstrap admin (admin) and realm owner user (KEYCLOAK_OWNER_EMAIL), Langfuse's initial user
(LANGFUSE_INIT_USER_EMAIL, same email) and the console Basic Auth (admin) — one credential to
remember locally, all rotated together for a public deployment. If you
bootstrapped .env before these existed, copy the LANGFUSE_*/CLICKHOUSE_PASSWORD block from
.env.example into it first — see Observability. Langfuse and
Keycloak only apply their *_INIT_*/bootstrap values on a first boot against an empty database,
so changing them in .env afterwards needs a make reset-all (or changing the password inside
that tool's own UI) to take effect.
The dropdown's other option, demo engineering, is the same bypass mechanism scoped to a
narrower demo tenant — entitled to only the three engineering scenarios (Predictive Maintenance,
Electric Motor Speed, Building Energy Forecast), not every scenario. Its key/password is
.env's ENGINEERING_DEMO_API_KEY (ai-circus-engineering-2026 by default; leave it blank to
disable this login option). It's provisioned automatically wherever ADMIN_API_KEY is — no
separate setup step — and make verify (part of make all) checks that it's scoped correctly:
entitled to exactly those three scenarios, and rejected (403) on any other. This is meant as a
template for adding your own narrower demo tenants: pick a name, an env var, and a scenario slug
set in services/platform-registry/src/platform_registry/core/seed.py's
ENGINEERING_DEMO_SCENARIOS.
"Failed to fetch" after logging in? That's the browser's network-level error, not an application error — it means a request never reached a server at all.
On Kubernetes, this almost always means the standing
platform-registryport-forward from step 3 above isn't running (ss -tlnp | grep 8010;make k3s-portforwardrestarts it) — seek8s/README.md's "Design notes".On Docker Compose, run
make verify(or justmake allagain) to pinpoint which service isn't answering; the most common causes are: (1) you tested right aftermake up, before every container was actually ready —make all/make verifywait for that, plaindocker compose up -ddoesn't; (2)postgres-data(or another) volume already existed from an earlier partial run, so its one-time init script never reran —make reset-allfixes this; (3) something else on the machine is already bound to port 80 (Traefik's entrypoint), 8010 (platform-registry), 6333 (Qdrant), or 4000 (llm-gateway) — the latter three are loopback-only, for local non-Docker dev; (4) the app was opened via an origin other thanhttp://aiopen.localhost(e.g. plainhttp://localhost) — every backend's CORS allow-list is keyed to that exact hostname.
Local (non-Docker) development: each generated service under services/*/ has its own
make run — run it directly with uv run from inside that service's directory while the infra
containers stay up via make up-infra.
make bootstrap copies .env.example → .env; every variable is commented inline there, this is
just the map. Each generated service under services/*/ additionally has its own
.env.example for service-specific settings.yaml-derived variables — the root file only covers
the platform-wide containers and cross-service wiring.
| Section | Variables | Notes |
|---|---|---|
| Stores | POSTGRES_*, QDRANT_*_PORT, CACHE_PORT (Valkey), KAFKA_PORT, OBJECT_STORE_ACCESS_KEY/SECRET_KEY (SeaweedFS) |
Ports for Postgres/Qdrant/llm-gateway/platform-registry bind to host loopback only — for non-Docker local dev, never exposed via Traefik. |
| Ingress | TRAEFIK_HTTP_PORT, TRAEFIK_DASHBOARD_PORT, CORS_ALLOWED_ORIGINS |
CORS is keyed to http://aiopen.localhost exactly — opening the app from another origin is the classic "Failed to fetch". |
| Identity | KEYCLOAK_SERVER_URL/REALM/ISSUER/JWKS_URL/AUDIENCE, KEYCLOAK_M2M_CLIENT_ID/SECRET, KEYCLOAK_OWNER_EMAIL/PASSWORD, KEYCLOAK_ADMIN_USERNAME/PASSWORD, VITE_KEYCLOAK_* |
*_OWNER_* is the realm user provision-owner-user creates; *_ADMIN_* is the container's own bootstrap admin (also gates admin.keycloak.localhost). Bootstrap values apply on first boot only. |
| LLM routing | OPENAI_API_KEY, GOOGLE_API_KEY, ANTHROPIC_API_KEY, DEEPSEEK_API_KEY, GROQ_API_KEY, OPENROUTER_API_KEY, AZURE_OPENAI_API_KEY/API_BASE, OLLAMA_API_BASE, LITELLM_MASTER_KEY, LLM_MODEL |
At least one key (or make ollama-up). A new/rotated key needs an llm-gateway restart; the active model is switched live from Settings and only needs LLM_MODEL as the boot-time default (groq-llama if unset). See LLM providers. |
| Embeddings | EMBEDDING_PROVIDER, EMBEDDING_MODEL, VOYAGE_API_KEY |
Must be identical for etl-vectorize and rag-agent, or vector search silently returns nothing. With local (the default), llm-gateway loads and warms the embedding model at start-up — it is only Ready once embeddings are instant; the weights (~670 MB) are downloaded once into the embedding-model-cache volume, so the very first boot of a new cluster takes a few minutes longer. |
| Voice mode | VOICE_STT_PROVIDER, VOICE_TTS_PROVIDER, VOICE_WHISPER_MODEL, VOICE_PIPER_VOICE_ID[_ES], DEEPGRAM_API_KEY, ELEVENLABS_API_KEY/VOICE_ID, CARTESIA_API_KEY/VOICE_ID |
Defaults (whisper/piper) need no key. Cloud engines need their key and the matching pipecat-ai[...] extra inside services/agui-voice; the STT/TTS choice itself is switched live from Settings. |
| Observability | LANGFUSE_INIT_USER_EMAIL/PASSWORD, LANGFUSE_PUBLIC_KEY/SECRET_KEY, LANGFUSE_NEXTAUTH_SECRET/SALT/ENCRYPTION_KEY, CLICKHOUSE_PASSWORD |
*_INIT_* applies on Langfuse's first boot only. Tracing is on whenever the PUBLIC_KEY/SECRET_KEY pair is set (keep the pk-lf-/sk-lf- prefixes). MLflow needs nothing here — it sits behind the console Basic Auth. |
| Credentials & deployment | ADMIN_API_KEY, ENGINEERING_DEMO_API_KEY, DEPLOYMENT_TARGET, AUTH_DISABLED, DEV_MODE |
Every local sign-in ships as angel2026 (see step 4). DEPLOYMENT_TARGET=public makes every service refuse to boot on shipped demo values — see Public deployment. AUTH_DISABLED/DEV_MODE are a dev-only bypass, never beyond local. |
Rule of thumb for when a change applies: anything you can pick in the app (active LLM model,
theme, voice engine) is live and needs no restart; a key or secret needs that container recreated
(docker compose up -d <service> / make k3s-secrets && make k3s-up); a *_INIT_*/bootstrap
value only counts on a first boot against an empty database (make reset-all, or change it in
that tool's own UI).
Both deployment paths bring up Keycloak already bootstrapped: infra/keycloak/realm-export.json
is baked into the pre-built Keycloak image (infra/keycloak/Dockerfile, start --optimized) and
loaded declaratively via --import-realm on first boot, so the ai-circus realm,
the organization/platform-backend client scopes (Organization membership + Audience
mappers), and the ui-react SPA client all exist the moment the container is healthy — no
manual Admin Console click-through. http://keycloak.localhost is the sign-in page,
http://admin.keycloak.localhost the Admin Console (Basic-Auth-gated, same as before).
Two things the static realm export can't do for you:
- One-time, manual, via the Admin Console (redo after any
make reset-all, since it wipes Keycloak's own data): the M2M client (KEYCLOAK_M2M_CLIENT_ID/SECRETin.env) has no admin rights of its own — grant its service-account user themanage-users/manage-organizations/manage-realm/manage-clientsrealm-management client roles, signed in as the container's own bootstrap admin (KEYCLOAK_ADMIN_USERNAME/KEYCLOAK_ADMIN_PASSWORD). Nothing below works until this is done. - Real users, and the
scenario:<slug>realm roles derived fromscenarios/*/scenario.yaml, are one command:Setmake -C services/platform-registry provision-owner-user
KEYCLOAK_OWNER_EMAIL/KEYCLOAK_OWNER_PASSWORDin.envfirst. Idempotent — safe to re-run any time. It createsscenario:<slug>as plain realm roles for every scenario'srole_required(Keycloak's Organizations API has no org-scoped role endpoint, so entitlement roles are assigned per-user, not per-organization-membership — a deliberate simplification, seelibs/shared'sauth.pydocstring), creates (or finds) anownerOrganization and that Keycloak user, adds them to the Organization, assigns everyscenario:*role directly to the user, and syncs the result into localentitlements— so signing in through Keycloak's hosted page with that email lands on every scenario, the same as theADMIN_API_KEYbypass. For any other user/Organization you want scoped differently, do that one by hand in the Admin Console: add them to an Organization and assign only thescenario:*realm role(s) you want them entitled to — that assignment is what grants access to a scenario.
Deploying this as-is to a public VM or behind a public minikube
Ingress is still just make up — there's no separate compose file or up variant — but it
needs a few .env values changed first, since APP_ENVIRONMENT: docker in
docker-compose.yml is identical for local dev and a real deployment and so can't be used to
tell them apart. (The same .env values apply if you adapt k8s/base/ for a real cluster — but
see the Kubernetes step above: today's manifests are dev-parity/single-node only, not yet a
production-ready starting point on their own.)
- Rotate (or blank, to disable the shortcut outright)
ADMIN_API_KEY/ENGINEERING_DEMO_API_KEYaway from their shipped demo values, and confirmAUTH_DISABLED=false. - Regenerate the Basic Auth credential Traefik puts in front of Keycloak's Admin Console and
SeaweedFS's console — both are otherwise purely-administrative UIs, always reachable on the
Traefik entrypoint (Keycloak's Admin Console in particular lets whoever holds the bootstrap
admin credentials fully control the identity system, so it's gated even locally, just with a
shipped demo credential you must rotate here):
(Locally,
make generate-console-auth # prints a one-time random password — save it, it isn't stored anywheremake generate-console-auth CONSOLE_PASSWORD=angel2026reproduces the shipped demo credential instead — never do that for a public deployment.) - Set
DEPLOYMENT_TARGET=publicin.env— this arms every service's boot-time refusal to start if you missed step 1 (seelibs/shared/src/ai_circus_shared/deployment_guard.py), so a mistake here is a startup crash with a clear message, not a silent hole. make check-public-readysanity-checks all three steps above without starting/stopping anything, then deploy with the usualmake up(ormake all).
SeaweedFS's S3 API route (as opposed to its console) is deliberately left without Basic Auth — see
the comment on its Traefik labels in docker-compose.yml for why.
Runs on a local Kubernetes (k3s/k3d) cluster, namespace ai-circus — the recommended path, see
Getting started — and identically via docker compose up: the same stateless,
env-configured microservices either way, just a different orchestrator.
The platform is built in layers, read bottom-up — infrastructure, data, consumption (AI, BI and GenAI), and the
gateways and governance every request passes — with observability alongside. The diagram, the
architecture guide (a tutorial: the layers, one request end to end, how a YAML file becomes
an app), the component reference and the app's Architecture page are all generated
from one catalog, architecture_catalog.yaml; a test fails
when a workload under k8s/ is missing from it. Each scenario's Overview shows the same map with the part it uses lit,
derived from its scenario.yaml.
- Infrastructure. One Kubernetes cluster (k3s, or k3d on a laptop) runs every workload; an optional GPU node serves local models (vLLM) and deep-learning training; the LLM providers are outside the cluster.
- Data — capture, store, transform, serve. SeaweedFS, Postgres, Qdrant, Valkey and ClickHouse; the batch jobs that
clean datasets, train models and index documents; and the optional streaming data platform in four tiers: Kafka,
data-ingest(contracts, quarantine, bronze), the Iceberg lake,data-transform(dbt, Dagster),data-api(the governed door) and OpenMetadata (Data products). - Consumption — AI, interactive dashboards and GenAI. What people use:
ui-react(the scenario gallery, the generic tabs, the showpiece dashboards and the data-product workspace), tabular ML predictions with SHAP (prediction), the chat copilots — the data and MLassistant,rag-agent(RAG and GraphRAG),form-agent(assisted forms) andagui-voice— deep-learning inference (dl-inference), Superset and the optional chat apps. A scenario is a YAML file; one service instance per kind serves every scenario of that kind. - Gateways and governance. What every request and every model call passes through: Traefik, Keycloak (a tenant is
a Keycloak Organization),
platform-registry(entitlements, audit trail, AI-BOM),llm-gateway(routing, rate limits, per-tenant budgets, the policy decision point, the MCP gateway), the MCP server kit, and the admin Platform page (data-platform-manager) with the opt-in governance-ready contracts.
Consumption and data only ever talk to each other through the gateways' checks: every service validates the caller's
token and re-checks the entitlement with platform-registry — never trusting what the UI already filtered — and every
LLM call goes through the gateway. Alongside all of them, observability: Langfuse (a trace per LLM call) and MLflow
(every training run) ship with the framework; the metrics/logs/traces stack — an OpenTelemetry collector, a
Prometheus-compatible metrics store, Loki, Tempo and Grafana — is a prerequisite the cluster provides
(ADR 0015): every service exposes /metrics, exports content-free
traces over OTLP once OTEL_EXPORTER_OTLP_ENDPOINT is set, and logs JSON lines carrying the trace id. The framework ships
only the AI-specific pieces (observability/) plus an optional lab bundle for clusters with
no stack (make k3s-obs-up, off by default, ~1 GiB).
data-platform-manager's Platform → Capabilities → Capability roadmap is the live, machine-readable list of which
capabilities are live, partial or still planned (see core/roadmap.py).
A tenant (Keycloak Organization, or the shared admin credential) only sees the scenarios its
members have been granted the matching scenario:<slug> role for — enforced both in the UI (what's
shown) and at each backend service's API (what's allowed).
These are in place from day one — not deferred — because they're cheap to build correctly now and expensive to retrofit once single-tenant assumptions are baked in.
- Tenancy: Keycloak Organizations model tenants;
scenario:*entitlement roles are plain realm roles assigned per-user (Keycloak's Organizations API has no org-scoped role endpoint). - Object storage: all datasets/models/documents live in SeaweedFS (S3-compatible), never on a service's local disk — keeps services stateless and horizontally scalable.
- Scenario/entitlement registry:
platform-registryowns a Postgres schema (tenants/scenarios/entitlements);scenarios/*.yamlis only the human-editable seed format, not read directly by any other service. - Ingress: Traefik is the only container reachable from outside the host — a 1:1 mapping
onto a Kubernetes Ingress later. A few services additionally publish a loopback-only port
(
platform-registry,qdrant,llm-gateway) purely so services running outside Docker (local, non-container dev) can still reach them directly; none of those three has auth strong enough to be safe on Traefik's public entrypoint, so they must never gain atraefik.enable=truelabel. infra/: per-component config —postgres/(multi-database init script),keycloak/(pre-built image + the declarativerealm-export.jsonbootstrap),seaweedfs/(generated S3 gateway credentials),clickhouse/(low-memory config),mlflow/(image),traefik/(Basic Auth file),k3s-gpu/(GPU node image). Qdrant/Valkey config stays inline indocker-compose.yml/k8s/base.- Admin credential:
ADMIN_API_KEY(defaultangel2026— rotate before any real deployment) is a shared bearer token resolving to a fixedadmintenant, auto-granted access to every scenarioplatform-registryseeds — a real, auditable entitlement row, not a bypass of the entitlement check.ENGINEERING_DEMO_API_KEYis the same mechanism scoped to a narrowerengineering-demotenant, entitled to only the engineering scenarios — a template for adding more scoped demo tenants without touching Keycloak.
Every backend service is generated via real cookiecutter generation against
ai-circus-template (see
scripts/new_service.sh), so each stays an independent uv project with its own
pyproject.toml/uv.lock/Dockerfile — no monorepo-wide uv workspace. That template is itself
built on the conventions from ai-circus, my
Python best-practices reference repo. Common code (Keycloak token validation, SeaweedFS client,
entitlement-check client, scenario schema, cache/document-store/event-streaming helpers) lives in
libs/shared (ai-circus-shared), added to each service as a local non-editable uv path
dependency.
Six scenarios are kind: deep_learning, all on public data and Hugging Face models. In
healthcare, two fine-tunes: thomas-sounack/BioClinical-ModernBERT-base (150M, 2025 clinical
encoder) on patient symptom texts and facebook/convnextv2-nano-22k-224 (15.6M) on PneumoniaMNIST
chest X-rays; the same ConvNeXt V2 is fine-tuned in manufacturing_industry on electroluminescence
images of solar cells (solar_cell_inspection, ELPV). There, pcb_visual_inspection uses the other deep_learning
task, task: anomaly_detection: it learns from good printed circuit boards only (Amazon
VisA, PCB1) — a frozen facebook/dinov2-with-registers-small (22M) describes every 14×14-px patch,
a greedy coreset keeps a memory bank of normal patches (PatchCore), and a board's patches are scored
by their distance to the nearest normal one (AnomalyDINO); backbone, bank and kNN export as one
ONNX graph whose anomaly_map output is the explanation. screw_visual_inspection is the same
detector on a deliberately harder part (MVTec AD Screw: machined screws in random poses, fine
thread texture, defects a few pixels wide) — no code of its own, only a YAML, and an Inspection
Line where the model can no longer work alone. The sixth, wildfire_smoke_watch (public safety), classifies
frames of fixed fire-lookout cameras (HPWREN FIgLib, the same ConvNeXt V2) and plays six held-out recordings
at once on a Watch Wall: every frame is scored live, alerts are timed against the ground-truth moment the
plume appeared, and some feeds are no-fire controls — see its page.
No data file is committed: each
scenario.yaml pins its public source (Hugging Face commit + SHA-256 — JSON Lines text or Parquet
images; a Hub folder of one-file-per-image classes + one manifest SHA-256, huggingface_image_folder;
per-camera .tgz frame sequences, one SHA-256 each, http_frame_sequences; or Zenodo + MD5) and dl-training downloads, verifies and stores it in SeaweedFS on first
run (make dl-data does only that).
dl-training(one-shot job): device auto-detect — the host/cluster GPU gets each scenario's fulltraining.gpubudget, a CPU its reducedtraining.cpuone (subset / fewer epochs / only the top encoder blocks). Label smoothing + post-hoc temperature scaling keep the probabilities calibrated; the model is exported to ONNX (the text model int8-quantized) and every reported metric is measured on that exported artifact. Never part ofmake all—make dl-train-nlp/make dl-train-cv/make dl-train-anomaly(this host's GPU),make k3s-dl-train-*or the admin console.dl-inference(optional overlay,make k3s-dl-up): onnxruntime only, no torch. Predictions, explanations (Banzhaf word attributions / occlusion heatmaps / anomaly maps), similar training cases, published held-out samples/images and ground-truth defect masks; tenant-scoped and entitlement-checked like every other service.- UI: a generic
DeepLearningView(Scenario, Texts/Images with click-to-enlarge, Try the model, Model insights with learning curves/confusion matrix/calibration/ROC) plus two opt-inui_extrastabs —triage_board(text or images: a patient-message board, or the PCB/screw inspection and solar-cell grading lines' pass / reject / manual-inspection lanes) andreading_room. Admins see GPU availability, each model's card and an in-cluster Train button under Platform → Deep Learning. For a GPU inside the k3d cluster see k8s/README.md.
All five are demonstrations — the healthcare ones are not medical devices and not clinically validated; the inspection models are not validated for production use.
Two more storage kinds — Valkey (cache/key-value; Redis itself is no longer OSI-licensed) and
a document store (Postgres JSONB, via ai_circus_shared.document_store) — round out the
tenant-scoped data layer and are on by default, same footprint class as Postgres/Qdrant.
A heavier tier sits behind its own optional profile, off by default so the base platform stays
laptop-sized: real-time event streaming (Apache Kafka, KRaft mode, no Zookeeper) plus a new
admin-only service, data-platform-manager, that exposes it —
make data-platform-up # docker compose --profile data-platform up -d kafka
make k3s-data-platform-up # = make k3s-data-core-up (Kafka + the data product services, see below)data-platform-manager (gated on ADMIN_API_KEY, never a Keycloak end-user token) is reachable
both as an API and from Platform → Capabilities in ui-react once logged in as admin (its
GET /platform/status also feeds the Health tab — see Observability):
- Capability roadmap — every capability across all three pillars (Architecture above), grouped by Data / AI-BI-ML / Governance, live/partial/planned, read from the running service, not a static doc.
- Pipeline job status/trigger for
etl-tabular/training/etl-vectorize— via the real Kubernetes Jobs API (RBAC-scoped tobatch/v1Jobs only), so k3s only; in docker-compose, runmake pipelinedirectly. - AI Gateway rate limits — a read-only report of
litellm_config.yaml's per-modelrpm/tpmceilings. - AI Gateway per-tenant budgets — monthly spend caps per tenant (
org_id), enforced insidellm-gatewayitself on every completion:PUT /gateway/budgets/{org_id}(body{"monthly_cap_usd": ...}) stores the cap durably in this service's document store and mirrors it into Valkey, wherellm_gateway.budget_hook(a stock LiteLLMCustomLogger) reads it on the hot path and increments that org's spend after each real call;GET /gateway/budgetslists every capped org with its current-month spend,DELETEmakes it unlimited again. Orgs without a cap are unlimited, and the month rolls over by key naming, so nothing needs resetting. API-only today (no UI yet). LiteLLM's own budgets weren't usable — its DB-backed proxy mode depends on an archived Prisma client that doesn't run on this repo's Python baseline (see the hook's docstring). - Recent events — every pipeline trigger is published to Kafka as well as recorded durably (Postgres); this panel reads the topic directly, proving the stream is real.
- Change-Data-Capture — a genuine Postgres logical-replication read (the built-in
test_decodingoutput plugin, no extra extension/image needed — seeai_circus_shared.cdc) over the document store's own table, forwarded to Kafka on demand (POST /cdc/poll); this is a real WAL read, not the application re-publishing its own writes. On-demand rather than a background loop — see Reserved for later. - Lakehouse Table Format — real, versioned Apache Iceberg tables (
PyIceberg) over the existing object store, no new stateful container: the catalog (table/schema/snapshot metadata) is aSqlCatalogin this service's own Postgres database, and the data files (Parquet + Iceberg JSON metadata) land in a new SeaweedFS bucket via Iceberg's ownS3FileIO.POST /lakehouse/ingestsnapshots the document store's demo collection into a table — every call appends a new snapshot rather than overwriting, so row/snapshot counts genuinely grow run over run (seecore/lakehouse.py). - Semantic Modeling & Query Federation — a small named catalog of business-friendly queries
(
GET /semantic/views), each run (POST /semantic/views/{name}/query) through an embedded DuckDB engine that federates two genuinely separate sources in one SQL statement, without copying either into a new store: the lakehouse's own Iceberg table (handed to DuckDB directly as an Arrow table) andplatform-registry's realentitlements/scenariostables (a different service's Postgres database, reached over the same shared cluster credentials every service already has).tenant_activity_360is the one that actually federates both — per-tenant pipeline activity next to how many scenarios that tenant is entitled to, joined byorg_idin a single query (seecore/semantic.py).
Try it (k3s; see Getting started > Kubernetes): make k3s-data-platform-up,
then trigger the churn reference scenario's etl-tabular job from Platform → Capabilities —
the run shows up under Pipeline jobs, as a real Kafka message under Recent events, and
(once you click Poll now) as a captured row-level change under Change-Data-Capture. Click
Ingest now under Lakehouse Table Format to snapshot that same data into a real Iceberg
table — repeat it and watch the snapshot count climb. Then run any query under Semantic Modeling
& Query Federation to see it joined live against platform-registry's real tenant data.
The roadmap panel above is the live source of truth for exactly what's built versus planned.
A fifth scenario kind, data_product, turns the platform into a governed data platform:
events and files captured, landed raw, transformed as code into marts, and served through one
governed API, dashboards, a metadata catalogue and the assistant — all open source, on the same
k3s cluster, switched on tier by tier. The first data product is Angel's Surf Co.
(surf_retail): a fictional chain of surf, SUP and kite shops — invented by the author, a surf
enthusiast — with 24 shops on Europe's coasts, a web shop, an ERP and five years of history. On
top of it: a fictional web shop with a recommender (association rules over every basket)
whose orders travel the real pipeline, Surf HQ (five years of seasons and a live forecast
board) and ML models trained on gold feature marts (the surf_ml scenario) that the assistant can call. The services are generic — a new data
product is a scenario folder (contracts, simulator, dbt project, dashboards), not code. Design and decisions: docs/data-platform
and docs/adr.
Four tiers, each switched on by its own command (none is part of make k3s-all; every one is off until you ask).
Core is the base — the others add to it, and each has a matching …-down. Memory is the measured working set of the
tier's own pods (a 16 GB laptop gives WSL/k3s about 11.7 GiB):
| Tier | Start it | Memory | What it adds | What you can demo |
|---|---|---|---|---|
| core | make k3s-data-core-up |
≈ 0.8 GiB | Kafka (a topic per tenant) · CDC · file landing + reconciliation · JSON Schema contracts + quarantine · bronze by key · Iceberg lake · dbt silver/gold + tests · data-api (metrics, records, governed SQL, lineage, live events) |
The whole workspace: guided tour, Surf HQ, live flow, dashboards, explore, quality & lineage, web shop, the assistant with data tools, view as a store manager |
| analytics | make k3s-data-analytics-up |
≈ 1.3 GiB | ClickHouse marts · Dagster (sensors on new bronze, asset checks, lineage) | The same dashboards served from columnar marts, and Dagster's runs and asset checks |
| bi | make k3s-data-bi-up |
≈ 0.2 GiB | Apache Superset, dashboards as code with row-level security | Superset dashboards, scoped per role |
| governance | make k3s-data-governance-up |
≈ 1.8 GiB | OpenMetadata: catalogue, contracts, end-to-end lineage, a Domain + Data Product | The catalogue at openmetadata.localhost, lineage from topic to dashboard |
| demo without governance | make k3s-data-demo |
≈ 8.8 of 11.7 GiB measured on the node | scenarios of every kind (tabular, RAG, forms, data) plus core, analytics and bi; MLflow, voice and governance off | The usual multi-scenario demo with the data platform; make k3s-data-demo-off undoes it |
| all four | make k3s-data-showcase |
≈ 4.1 GiB on top of the platform | frees RAM first (scales the AI-only pods to 0), then starts every tier | The full storyline; make k3s-data-showcase-off undoes it |
First run: start a tier, then make k3s-data-seed (history through the real pipeline; k3s-data-seed-lite loads one
year) and make k3s-data-ml for the two models.
The one to use for a typical demo: make k3s-data-demo (on a running cluster). It keeps every scenario kind and the
core, analytics and bi tiers, and switches off only governance, MLflow and voice — measured at 8.8 of 11.7 GiB on the
node, about 3 GiB of headroom. Deep-learning scenarios are separate (make k3s-dl-up).
Does everything fit? Not with every microservice and every tier at once on a 16 GB laptop. The full base
platform needs about 5.9 GiB and the four tiers about 4.1 GiB more, which together with the node's own overhead
exceeds the ≈ 11.7 GiB available — hence k3s-data-showcase, which turns off what a data demo doesn't use
(MLflow, Langfuse, voice, RAG and form agents, Qdrant, deep learning). Measured with that trade-off: all four tiers
plus prediction and the assistant use 8.7 of 11.7 GiB. On a machine with 32 GB or a larger WSL allowance everything
can run together. Pick what a demo needs: core alone is light enough to sit next to the whole AI platform.
make k3s-data-showcase runs all four on a 16 GB laptop (AI-only pods scaled to 0);
make k3s-data-seed generates the history through the real pipeline (five years; k3s-data-seed-lite
loads one) and make k3s-data-ml trains the models on the feature marts once a transform has run. In the workspace: the
live flow of every record (simulate sales, malformed receipts, legacy files with a missing
receipt, ERP price changes), governed dashboards, explore (records with their processing
trail, datasets, SQL, quarantine), quality & lineage — and view as a store manager to see
every door (API, SQL, dashboards, the assistant) restricted to one store.
The framework can be governed by an external AI-governance tool without depending on any product: it exposes what a governance programme needs through open contracts and enforces the decisions a tool sends back. It supports an ISO/IEC 42001 / EU AI Act management system and provides evidence for it — it is not one, and risk categories are declared by the owner, never inferred. Everything is off by default and changes nothing when off.
| Capability | Contract / where | Switch |
|---|---|---|
Declared AI-system metadata per scenario, stable ai_system_id |
governance: block in scenario.yaml (ai_circus_shared.governance) |
– |
Pluggable policy decision point, enforced at llm-gateway (noop / static / OPA / HTTP; allow, deny, degrade + obligations) |
JSON Schema in docs/governance/schemas/; HMAC POST /governance/policy/invalidate |
POLICY_DECIDER, POLICY_FAIL_MODE |
| Content-free CloudEvents (policy decisions, budget exhaustion, model trained, admin changes…) | log line or HMAC-signed webhook with a retrying outbox | GOVERNANCE_EVENTS_ENABLED |
| Hash-chained admin audit trail | GET /governance/audit, /audit/verify (platform-registry is the single writer) |
GOVERNANCE_AUDIT_ENABLED |
| Decision records for non-LLM predictions, with enforced retention | prediction.recorded events + decision_records |
GOVERNANCE_RECORD_STORE |
| GenAI trace attributes | OpenTelemetry gen_ai.* (semconv v1.37.0) + aicf.* on every model call |
– |
| AI-BOM inventory | CycloneDX 1.6 at GET /governance/inventory |
GOVERNANCE_INVENTORY_ENABLED |
The admin Platform → Governance tab shows it at a glance — which switches are on, the AI systems and what their owners
declared, whether the audit chain verifies, and a download of the AI-BOM. It works while everything is off (the default).
It is read-only, served by platform-registry's GET /governance/overview.
Events, audit and records carry ids, metrics and decisions — never prompts or personal data. Full
guide, switches and the standards crosswalk: docs/governance; design
reasoning: ADR 0011. (The data platform's own
catalogue and lineage — OpenMetadata — is the separate governance tier of the
data products above.)
Three admin-only monitors, always on (k8s/base and docker-compose.yml alike) and sized for a
single laptop — every new container carries resources.limits, and the stack reuses the Postgres,
Valkey and SeaweedFS the platform already runs instead of bringing its own:
| Monitor | What it shows | Where | Backed by |
|---|---|---|---|
| Platform dashboard | Health of every microservice / store / monitor: up, degraded, down, stopped, not deployed; probe latency; on-demand Ping; on k3s also pod readiness + restarts and Start/Stop for the optional services | ui-react → Platform → Health (admin) |
data-platform-manager's admin-gated GET /platform/status (core/platform_status.py) probing each component over the cluster network, plus read-only pod/replica listing via RBAC; Start/Stop scales only the allowlisted workloads (core/workloads.py, mirrored by the Role's resourceNames) |
| Resource monitor | CPU / memory of the node and of every workload (vs. its memory limit); GPU utilization, memory, temperature and power | ui-react → Platform → Monitor (admin, k3s) |
GET /platform/resources (core/resources.py): the Kubernetes Metrics API (k3s' bundled metrics-server) and NVML — on a GPU cluster make k3s-up gives data-platform-manager read-only GPU access (k8s/gpu/, never a nvidia.com/gpu request) |
| GenAI monitor — Langfuse v4 | A trace per LLM call (prompt, completion, tokens, cost, latency), grouped into sessions per conversation, filterable by tenant (org:<id>), scenario (scenario:<slug>) and service |
http://langfuse.localhost (Langfuse's own sign-in; user/password from .env's LANGFUSE_INIT_USER_*) |
llm-gateway's LiteLLM langfuse_otel callback — switched on at start-up when LANGFUSE_PUBLIC_KEY/LANGFUSE_SECRET_KEY are set (app.py); the agent services attach tenant/scenario/thread as request metadata (ai_circus_shared.observability.langfuse_request_metadata). Stores: the shared Postgres (langfuse db), Valkey (langfuse: keys), SeaweedFS (langfuse bucket) and one new ClickHouse container (k8s/base/langfuse.yaml) |
| MLOps monitor — MLflow | One experiment per scenario, one run per tenant × training: every candidate's held-out score, the selected model, dataset size, metadata.json, and the SeaweedFS keys + checksums of the served artifacts |
http://mlflow.localhost (behind the same admin-basicauth gate as the Keycloak/SeaweedFS consoles — MLflow has no auth of its own) |
training mirrors each run when MLFLOW_TRACKING_URI is set (core/mlflow_tracking.py, never fails the job); the server is infra/mlflow/Dockerfile (official MLflow + Postgres driver + boto3), run metadata in the shared Postgres (mlflow db), artifacts in SeaweedFS (mlflow bucket) |
Because every LLM call in the system — assistant, rag-agent, form-agent, and voice
through agui-voice — goes through llm-gateway, one callback there covers every scenario kind;
no service links a Langfuse SDK. Langfuse v2's Postgres-only mode is end-of-life (Q1 2025), so
v4's ClickHouse is the one genuinely new store; it runs with a low-memory config.d
(infra/clickhouse/, mirrored in the k8s ConfigMap) and a 1 GiB cap. Existing Postgres volumes
get the two new databases created on first start by an idempotent init container, so a cluster
created before this needs no make reset-all.
Keycloak SSO for Langfuse and prediction-time drift monitoring (Langfuse and MLflow both see training/inference events, not live feature distributions) are the natural next steps — see Reserved for later.
A chat UI where each person signs in with Keycloak and uses MCP tools as themselves: every MCP server sees the
signed-in user's own token, lists only the tools that user's role is granted, and calls its API with a token valid for
that API alone. The AI gateway is llm-gateway (open-source LiteLLM: models at /v1, MCP servers at /mcp/<server>),
and one file, mcp/catalog.yaml, decides which servers exist and who may run what.
| What | Where |
|---|---|
| Two chat UIs with Keycloak-only sign-in: Open WebUI and LibreChat (MIT) | make k3s-chat-ui-up · make k3s-librechat-up |
MCP servers in front of existing APIs, built with libs/mcp-kit (token checks, policy, per-API token exchange, audit); example crm-mcp → crm-api |
make k3s-mcp-examples-up |
| One catalog: generates the gateway routes, both chat UIs' connections, each server's policy and the Keycloak clients; CI fails on drift | make mcp-catalog · make mcp-catalog-portal |
| Level 3 for regulated servers: DPoP-bound per-API tokens, live token checks, mutual TLS | level: 3 in the catalog · make k3s-mcp-tls |
| One trace from the chat UI to the API, masked logs (no token or email stored), an MCP dashboard | make k3s-obs-up |
| Each API sees a pseudonym of the user, never the Keycloak id; an identity admin can map it back | make k3s-mcp-pseudonym |
| The whole stack alone on its own k3d cluster (~3 GB), with a check that needs no model | make k3s-mcp-lite · make k3s-mcp-lite-verify |
The same question as the analyst and as the S012 store manager: the analyst's answer runs top_customers; the store
manager's role is not granted it, so the model searches instead. Full guide — architecture, security levels, how to
add an API, operations, known limits: docs/mcp; decisions: ADR 0019 to 0029 in
docs/adr.
llm-gateway execs the real LiteLLM proxy — every consumer (assistant, rag-agent,
ui-react) calls its OpenAI-compatible API by model_name, never a provider SDK directly (see
services/llm-gateway/litellm_config.yaml for the routing table).
model_name |
Provider | Key needed | Notes |
|---|---|---|---|
groq-llama |
GroqCloud (gpt-oss-120b) |
GROQ_API_KEY |
Shipped default (LLM_MODEL unset) — free tier, very low latency, accurate |
groq-oss-20b |
GroqCloud (gpt-oss-20b) |
GROQ_API_KEY |
Same key — faster, higher free-tier quota |
groq-qwen |
GroqCloud (qwen3.8-27b) |
GROQ_API_KEY |
Same key |
gemini-flash |
Google Gemini (gemini-3.1-flash-lite) |
GOOGLE_API_KEY |
Free tier, vision-capable |
gemini-3.8-flash |
Google Gemini | GOOGLE_API_KEY |
Google's recommended default, vision-capable |
gemini-3.1-pro |
Google Gemini (gemini-3.1-pro-preview) |
GOOGLE_API_KEY |
Most capable Gemini, vision-capable |
gpt-4o-mini |
OpenAI | OPENAI_API_KEY |
Legacy, vision-capable |
gpt-5.6-sol / gpt-5.6-terra / gpt-5.6-luna |
OpenAI | OPENAI_API_KEY |
Flagship / balanced / fast-cheap, vision-capable |
claude-haiku |
Anthropic (claude-haiku-4-5) |
ANTHROPIC_API_KEY |
Fast/cheap Claude tier, vision-capable |
claude-sonnet-5.5 |
Anthropic | ANTHROPIC_API_KEY |
Balanced, vision-capable (price pinned in the config) |
claude-opus-5.5 |
Anthropic | ANTHROPIC_API_KEY |
Frontier, vision-capable |
claude-fable-5.1 |
Anthropic | ANTHROPIC_API_KEY |
Most capable and priciest, vision-capable |
deepseek-v4-flash / deepseek-v4-pro |
DeepSeek | DEEPSEEK_API_KEY |
Replace the retired deepseek-chat |
openrouter |
OpenRouter | OPENROUTER_API_KEY |
One key, many vendors |
azure-gpt4o |
Azure OpenAI | AZURE_OPENAI_API_KEY + AZURE_OPENAI_API_BASE |
Also edit the azure/<deployment> line in litellm_config.yaml |
llama3 |
Ollama (local) | none | Optional, off by default — see below |
vllm-qwen |
vLLM (local GPU) | none | Optional, off by default, needs an NVIDIA GPU — see below |
ollama is not started by make up — it's a real container with real RAM/disk cost, gated
behind the ollama compose profile. make ollama-up starts it and pulls a small model
automatically on first run.
vllm is the same idea for a machine with a GPU: make k3s-vllm-up on k3s, or the vllm compose
profile. It holds the whole GPU while it runs, and the first start takes about 33 GB of disk for the
image and 3.1 GB for the weights. The default is a small 1.5B model, because under WSL an 8 GB GPU can
only use about 5.5 GiB. See ADR 0017.
Runtime key rotation from the browser isn't possible (this deployment doesn't run LiteLLM's
DB-backed proxy mode) — a new key always means edit .env, then
docker compose up -d llm-gateway. Switching which already-configured provider is active,
though, is instant from Settings → LLM Provider Settings. Usage controls live in the gateway
too: static per-model rpm/tpm ceilings in litellm_config.yaml, and per-tenant monthly spend
budgets enforced by llm_gateway.budget_hook (see Data Platform);
every call is also traced to Langfuse (see Observability).
- New backend service:
make new-service NAME=my-service— wraps real cookiecutter generation fromai-circus-template, wires inlibs/shared, and adapts the Dockerfile for this repo's build-context conventions. Then add it todocker-compose.yml. - New scenario: add
scenarios/<slug>/scenario.yaml(seechurn/mpmfortabular_ml,ai_circus_referenceforconversational_rag,service_requestforassisted_form) with achat:block (context+sample_questions), restartplatform-registry(it seeds on startup), and create the matchingscenario:<slug>Keycloak realm role. No new container, no UI code — the existingprediction/assistant,rag-agent, orform-agentinstance picks it up automatically, andui-reactrenders its form/chat generically. Anassisted_formscenario additionally needs aform:block (field catalog + validation rules) and, if it's RAG-classified likeservice_request, adocuments:/vector_store:block foretl-vectorizeto index.
Every backend service is an independent ai-circus-template project with its own QA stack — from
inside services/<name>/:
make check # pre-commit (ruff, pyrefly, gitleaks, checkmake) + settings.yaml/data_model.py drift check + pytestmake check-all (from the repo root) runs this for every service in sequence. ui-react has its
own npm run build (type-checks via tsc -b then builds via Vite).
.github/workflows/ci.yml runs the same checks per service as a matrix job, builds ui-react,
and validates docker-compose.yml, on every push/PR to main/develop.
A Helm chart (plain YAML + Kustomize exists instead — see
Getting started > Kubernetes and k8s/README.md — for local
dev-parity; Helm would only matter for a real multi-environment/production rollout), a
task queue for on-demand tenant-triggered jobs, cross-service distributed
tracing/OpenTelemetry beyond the LLM calls Langfuse already traces (see
Observability), Keycloak SSO into Langfuse (today it has its own
seeded admin sign-in), prediction-time data/model drift monitoring (Evidently-style — prediction
doesn't log inference rows yet, so there is nothing to compare against training), evaluation
tooling (Opik/Giskard), a UI for the per-tenant AI Gateway budgets (the enforcement and the admin
API are built — see Data Platform — only the Platform page
panel is missing) and actual billing/invoicing on top of them, a background CDC loop (today's POST /cdc/poll is a real,
on-demand Postgres-to-Kafka change read — see Data Platform —
continuous polling is the natural next step, not a redesign), and (optional) extracting embedded
images out of uploaded PDFs in the chat attachment flow — today
platform_registry.core.document_extraction only pulls text/OCR out of a PDF, so a figure or
diagram embedded in an otherwise text-native page never reaches a vision-capable model. (The
AG-UI/CopilotKit runtime bridge for ui-react's chat, a custom in-app admin screen, a shared cache
for multi-replica deployments, a real Postgres-to-Kafka change-data-capture feed, a lakehouse table
format over the object store, a semantic-modeling/query-federation layer over both the lakehouse
and platform-registry's own Postgres tables, voice/multimodal agents (Pipecat), and per-tenant AI
Gateway budgets, previously listed here, are built — see ChatPanel.tsx/chatGenerativeUi.tsx,
the admin Platform page,
ai_circus_shared.cache, Data Platform, Voice mode
and llm_gateway.budget_hook respectively.)
I'm Angel Martinez-Tenor (github.com/angelmtenor) — for the last decade I've worked as a tech lead on data, analytics, ETL, ML, and GenAI projects across many clients and industries. This repo is my attempt to distill that experience into something open, reusable, and free for anyone to learn from or build on — the same way open source has given a huge amount back to me over the years.
It's also an experiment in applying vibe coding to a methodology I've been refining and teaching for a long time, not a methodology invented for this repo:
- 2017 — my first "agnostic" data-science project: one set of ML templates, reused across a wide variety of business scenarios instead of one-off notebooks per client.
- Later — building blocks for AI ethics: explainability (SHAP/LIME) and interval/uncertainty predictions as first-class citizens, not an afterthought bolted on at the end.
- Later — GenAI layered on top, with interactive dashboards for exploring models and data.
- Now — taking that same agnostic-scenario philosophy into agentic, tool-calling GenAI, with
AG-UI (via CopilotKit) now wired end to end for
ui-react's chat — streaming replies and real generative UI (the chatbot renders live charts/tables, not just prose).
The constant across all of it: build vendor-agnostic, scenario-driven foundations, keep them
open source, and let the plumbing (auth, storage, ingress, entitlements) be boring and correct so
the interesting part — the ML/GenAI scenario itself — can be swapped freely. ai-circus-framework
is one concrete example of what that foundation looks like today: mostly Python on the backend,
and — new for this project — vibe-coded microservices for everything around it (identity
provider wiring, the React frontend, infra).
- AGENTS.md — mandates for AI-assisted and human contributions alike.
- styleguide.md — commit message conventions (Conventional Commits).
- CHANGELOG.md — release history.
- docs/windows-wsl.md — contributing (or just running the platform) from Windows via WSL2.
The flow, in short — git-flow per AGENTS.md §5:
- Fork the repo, clone your fork (step 0 above provisions the toolchain), then once per
clone:
git flow init -d— it refuses on unstaged changes to tracked files, so run it before editing anything (on a fresh clone alsogit branch --track develop origin/developfirst, or it createsdevelopfrommain). git flow feature start <name>— branches fromdevelop; commit with Conventional Commits.- Before opening a PR:
make checkinside every service you touched (make check-allfrom the root for cross-service changes),npm run buildinui-react/for frontend changes, and an actualdocker compose upsmoke test of the affected service(s) — CI'scompose-validatenever boots containers. - Push
feature/<name>to your fork and open a pull request againstdevelop(nevermain).
Created and maintained by Angel Martinez-Tenor —
github.com/angelmtenor — and built largely with the help of
Anthropic's Claude (via Claude Code). It grows out of my earlier
ai-circus (Python best practices) and
ai-circus-template (the cookiecutter every
service is generated from).
Licensed under the MIT License.
Disclaimer: I am currently Head of Data & AI at Getronics. A separate, Getronics-branded fork of this framework is being developed there for production-grade use.















































