# What this system does
# How the loop is structured
Four stages run across Databricks and Amazon Quick:
- Forecast (Databricks): Many Model Forecasting (MMF) serves Chronos-2 to produce 7-day demand predictions for every SKU.
- Detect (Databricks Genie Agent): A Genie Agent surfaces SKUs in surge using a simple numeric rule: the next-7-day average demand must be at least 1.5 times the prior-14-day average, and the prior-14-day average must be at least 1 to filter low-volume noise.
- Act (Amazon Quick Flows): For routine cases Quick Flows calls a Supplier Order API through an OpenAPI connector to place the purchase order. If no single supplier can fully cover the surge, the flow raises a human-review ticket.
# Why this split matters
# What you need to run it
Required local tools and utilities: Databricks CLI (0.299.0+), AWS CLI (2.36.2+), jq (1.7), and uv or Python 3.11 for the supplier-feed loader. The walkthrough uses aws quicksight subcommands (create-flow, create-data-source, create-space) and two scripts in the repository that cover the CLI-automatable steps.
Two account-level prerequisites are mandatory before console steps: your Amazon Quick user must have an Author or Author Pro role (Quick Flows and connectors need it), and your Databricks identity must have CREATE CATALOG on the metastore or an admin must pre-create the mmf catalog.
# Files and automation provided
The companion repository contains the end-to-end artifacts. Important files include:
- genie/genie_space.json — Genie Agent definition that surfaces surging SKUs.
- flow/flow_definition.json — Amazon Quick Flow that reconciles supply and places orders or raises exceptions.
- scripts/setup_databricks.sh — notebooks, Genie Agent, OAuth app setup.
- scripts/setup_aws.sh — Order API, S3 feed, Quick account, data source, space, flow.
- cleanup/cleanup.sh — teardown steps.
Both setup scripts pause at four console-only steps: creating the two action connectors, granting S3 Tables access, and configuring the dataset.
# Operational constraints and design choices
- Region: deploy in an AWS Region that supports Amazon Quick agentic capabilities (action connectors, spaces, flows).
- Decision-time joins: supplier selection happens at decision time by joining on retailer_product_id rather than copying forecasts into an operational store, reducing data movement.
- Escalation policy: the system places routine orders unattended but raises tickets when no single supplier can cover the surge.
# Practical next steps for implementation
Clone the repository provided with the walkthrough, create and source the.supply-chain-automation-env file with your account values, authenticate Databricks (databricks auth login), verify the workspace user shown by databricks auth describe, then run the setup scripts and complete the four console steps referenced in the README.