Streaming data is where the mission-critical decisions live. One statement of Flink SQL forecasts, flags and finds the setpoint, inside the stream, with no training.
Every event scored in flight. Poke it.
A pump caught drifting today is a work order, next week it is an outage. The model that forecasts the series is also a model of the plant, so an optimizer can search the setpoints inside the guardrails.
Two knobs, three objectives: quality, energy, margin. The model forecasts what every setting does. The optimizer searches, respects the limits, and the operator approves.
| Before | After | |
|---|---|---|
| Feed | 196 t/h | – |
| Temperature | 1,418 °C | – |
| Quality | 94.8% | – |
| Energy | 89 kWh/t | – |
| Margin | baseline | – |
The model has never seen your signal. Sketch one and watch it forecast.
Drag across the canvas, or start from a shape.
An agent reads the forecast and the flag, reasons, and writes the decision to a topic. Experts set the gates.
One event, five hops, under a second.
-- 1. wrap the model as a tool
CREATE TOOL forecast_sku AS
AI_FORECAST(units_sold, event_time,
JSON_OBJECT('model' VALUE 'ttm', 'horizon' VALUE 7));
-- 2. bind a model, a prompt and tools
CREATE AGENT replenisher WITH (
model = 'granite-llm',
prompt = 'Keep service level at P90. Raise a PO when projected stock falls under lead time demand. Explain in one line.',
tools = ['forecast_sku', 'stock_lookup', 'raise_po']
);
-- 3. run it per event, write decisions back
INSERT INTO purchase_orders
SELECT store_id, sku, AI_RUN_AGENT('replenisher', ROW(store_id, sku, units_sold, event_time))
FROM pos_sales;Streaming Agents syntax as previewed by Confluent. Names and clauses can change before GA.
Flink runs the models on every event. Decisions land as topics, tables, alerts and agent calls.
Pick one. Every simulation follows.
Slide the moment you act. Watch what is left of the decision.
A cement producer, one mill. Flip it.
8 to 10 regression models per cement grade, 3 grades, retrained in batch. 6 months for one mill.
5 to 10× productivity. Every point of accuracy worth millions. Client identities withheld.
A cement line on Confluent. Sensor to setpoint and back.
Pick a story, or click the kiln, the mill or the preheater.
Free lime is trending up. The quality forecast says 97.1% in 40 minutes, below the 98.5% target.
One Flink SQL function each. Real models on real data in the playground.
28 days with quantiles. The purchase order comes from the band.
Daily sales against the band, no labels. Inject a cause.
Amounts scored per card at authorization. Inject an attack.
Embed the stream, search by shape. Sketch a pattern or pick one.
Three moves. The first takes a minute.
Any topic with a value and a timestamp.
SELECT event_time, value,
AI_FORECAST(value, event_time,
JSON_OBJECT('model' VALUE 'ttm', 'horizon' VALUE 12))
OVER (PARTITION BY series_id ORDER BY event_time
RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) AS f
FROM your_topic;
Models hosted by Confluent. AI_FORECAST and AI_DETECT_ANOMALIES today, TS_EMBED, TS_SEARCH and TS_OPTIMIZE next.
Watch the walkthroughFour lines. Copy it into an email to your IBM or Confluent contact.
SELECT event_time, load_kw,
AI_FORECAST(load_kw, event_time,
JSON_OBJECT('model' VALUE 'ttm', 'horizon' VALUE 12))
OVER (PARTITION BY meter_id ORDER BY event_time
RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) AS forecast
FROM meter_readings;SELECT event_time, response_ms,
AI_DETECT_ANOMALIES(response_ms, event_time,
JSON_OBJECT('model' VALUE 'flowstate',
'minContextSize' VALUE 20, 'maxContextSize' VALUE 512,
'confidencePercentage' VALUE 99.0))
OVER (PARTITION BY host_id ORDER BY event_time
RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) AS anomaly
FROM server_metrics;CREATE TABLE card_alerts AS
SELECT card_id, event_time, amount,
anomaly.forecast_value AS expected, anomaly.lower_bound, anomaly.upper_bound, anomaly.rmse
FROM (
SELECT card_id, event_time, amount,
AI_DETECT_ANOMALIES(amount, event_time,
JSON_OBJECT('model' VALUE 'ttm', 'confidencePercentage' VALUE 99.5))
OVER (PARTITION BY card_id ORDER BY event_time
RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) AS anomaly
FROM card_payments)
WHERE anomaly.is_anomaly = TRUE;SELECT s.sku, s.event_time AS as_of,
step.`timestamp` AS forecast_day, step.q10 AS floor, step.q50 AS expected, step.q90 AS reorder_point
FROM (
SELECT sku, event_time,
AI_FORECAST(units_sold, event_time,
JSON_OBJECT('model' VALUE 'patchtstfm', 'horizon' VALUE 7, 'maxContextSize' VALUE 730))
OVER (PARTITION BY sku ORDER BY event_time
RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) AS f
FROM daily_sales) AS s
CROSS JOIN UNNEST(s.f.forecast) AS step (`timestamp`, mean, q10, q50, q90);SELECT event_time, vibration_mm_s,
AI_DETECT_ANOMALIES(vibration_mm_s, event_time,
JSON_OBJECT('model' VALUE 'patchtstfm', 'maxContextSize' VALUE 2048,
'upperBoundConfidencePercentage' VALUE 90.0,
'lowerBoundConfidencePercentage' VALUE 99.9))
OVER (PARTITION BY asset_id ORDER BY event_time
RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) AS anomaly
FROM motor_telemetry;| Parameter | Default | Meaning |
|---|---|---|
model | ttm | ttm, flowstate, patchtstfm or timesfm-2.5. Hosted by Confluent. Both functions. |
horizon | 5 | Future steps to forecast. AI_FORECAST only. |
minContextSize | 20 | Points required before output starts. Fields are null until then. |
maxContextSize | 512 | Most recent points used. Older points are truncated. |
confidencePercentage | 99.0 | Symmetric prediction interval. AI_DETECT_ANOMALIES only. |
upperBoundConfidencePercentage / lowerBound… | null | Asymmetric overrides for one side of the interval. |
rmseWindowSize | 5 | Rolling window for the RMSE of predictions. |
| Model | Horizon | Context | Notes |
|---|---|---|---|
ttm | up to 96 | 52 to 512 | Picks the TTM variant that matches horizon and context. Fast default. |
flowstate | over 6 | up to 4,096 | Context plus horizon under 4,102. Seconds-level and hourly data alike. |
patchtstfm | up to 8,176 | 16 to 8,064 | Context plus horizon up to 8,192. Long horizons, full distributions. |
timesfm-2.5 | model limit | multiple of 32 | Google Research model, also available in both functions. |
Output of AI_FORECAST: forecast ARRAY<ROW<timestamp, mean, q10, q50, q90>> and metadata. Output of AI_DETECT_ANOMALIES: is_anomaly, forecast_value, lower_bound, upper_bound, actual_value, timestamp, rmse. Inputs: value DOUBLE, timestamp TIMESTAMP(3), evenly spaced for best results. Billed as Flink compute.
The official demo: IBM Granite Time Series models called from the Flink SQL workspace on live Kafka data.
'model' option. Same statement, three models, lower cost on fully managed Confluent Cloud.