views 'Use Cases / Backend' { dynamic view anomaly_detection { title 'Anomaly Detection (Single-Tenant)' description ' Detecting anomalies for a single store. AI agent queries Redshift tenant database serving views directly. ' kdsai.aibackend -> kdsai.aibackend 'Scheduler triggers anomaly detection process' kdsai.aibackend -> kdsai.operationalDb 'Get Monitor Spec' kdsai.aibackend <- kdsai.operationalDb 'Returns monitor spec' parallel { kdsai.aibackend -> kdsai.bedrock 'Agent orchestrates anomaly detection process using LLMs' kdsai.aibackend <- kdsai.bedrock 'Tool call request' kdsai.aibackend -> kdsai.warehouseDb 'Execute SQL in the selected tenant database serving views' kdsai.aibackend <- kdsai.warehouseDb 'Returns tenant-scoped data for anomaly detection' kdsai.aibackend -> kdsai.bedrock 'Send data to LLM for anomaly detection' kdsai.aibackend <- kdsai.bedrock 'Returns anomaly detection results' } kdsai.aibackend -> kdsai.operationalDb 'Store anomaly detection results' kdsai.aibackend -> user 'Alert notifications if anomalies detected' user -> kdsai.frontend 'Checks dashboard for anomaly detection results' kdsai.frontend -> kdsai.aibackend 'Polls for anomaly detection results to display on dashboard' kdsai.frontend <- kdsai.aibackend 'Returns anomaly detection results for dashboard' user <- kdsai.frontend 'Views anomaly detection results on dashboard' // This is required to have user at the start of the flow diagram include user, kdsai.frontend } dynamic view anomaly_detection_crosstenant { title 'Anomaly Detection (Cross-Tenant)' description ' Detecting anomalies across multiple stores (chain/district manager scenario). AI agent queries Athena over curated S3 Parquet instead of a single Redshift database. Platform injects WHERE tenant_id IN (...) based on user_tenant_access. ' kdsai.aibackend -> kdsai.aibackend 'Scheduler triggers cross-tenant anomaly detection' kdsai.aibackend -> kdsai.operationalDb 'Get Monitor Spec and resolve user tenant access' kdsai.aibackend <- kdsai.operationalDb 'Returns monitor spec and authorized tenant list' parallel { kdsai.aibackend -> kdsai.bedrock 'Agent orchestrates cross-tenant anomaly detection using LLMs' kdsai.aibackend <- kdsai.bedrock 'Tool call request' kdsai.aibackend -> kdsai.athena 'Execute SQL with platform-injected tenant_id filter' kdsai.athena -> kdsai.glueCatalog 'Resolves table schemas and partitions' kdsai.athena -> kdsai.etl.curatedStorage 'Reads curated Parquet from S3' kdsai.aibackend <- kdsai.athena 'Returns cross-tenant data for anomaly detection' kdsai.aibackend -> kdsai.bedrock 'Send cross-tenant data to LLM for anomaly detection' kdsai.aibackend <- kdsai.bedrock 'Returns anomaly detection results' } kdsai.aibackend -> kdsai.operationalDb 'Store anomaly detection results' kdsai.aibackend -> user 'Alert notifications if anomalies detected across stores' user -> kdsai.frontend 'Checks dashboard for cross-store anomaly results' kdsai.frontend -> kdsai.aibackend 'Polls for cross-store anomaly results' kdsai.frontend <- kdsai.aibackend 'Returns cross-store anomaly results for dashboard' user <- kdsai.frontend 'Views cross-store anomaly results on dashboard' include user, kdsai.frontend } }