Loading...

Rank Delivery Failure Causes

When a region shows a sudden spike in failed deliveries, the last-mile route planner has to explain what changed before the next operations review. This workflow detects the cluster, ranks the likely causes, and produces an evidence-backed narrative with recommended follow-up actions.

The planner still decides what to escalate, who to challenge, and which intervention fits the region; the workflow removes the cross-checking, evidence assembly, and write-up work. The estimated impact is 50% compression in time spent producing root-cause narratives per failure cluster event.

Interactive Demo

See the Decision Intelligence Workflow in Action

This workflow handles a compound operational analysis task: first confirming that a delivery failure pattern is materially outside normal regional performance, then testing the most relevant contributing signals, then turning that evidence into a usable explanation. The work is repetitive but time-sensitive because planners are expected to brief managers quickly and with evidence they can defend.

👤
Designed for line-of-business leaders — specifically the Last-Mile Route Planner responsible for explaining delivery failure spikes to regional operations and carrier stakeholders. It addresses the recurring execution work of pulling signals together fast enough to support a defensible response. Why this matters: What line-of-business leaders actually need from decision workflows →
Decision Intelligence Playground · Delivery Failure Root Cause Narratives
KWF Runtime
Start with an example
Want to see how this would work for your delivery operations team?
We will walk through the workflow against your delivery failure use case, the signals it needs, and the narrative output your team would review. We will also map the manual steps your planners and analysts handle today to the execution work the workflow can absorb. If you are operating on Databricks, we'll show you this workflow running on your Databricks environment.
Schedule a Databricks Session
How It Works

What the Decision Intelligence Workflow Does

This workflow handles a compound operational analysis task: first confirming that a delivery failure pattern is materially outside normal regional performance, then testing the most relevant contributing signals, then turning that evidence into a usable explanation. The work is repetitive but time-sensitive because planners are expected to brief managers quickly and with evidence they can defend.

Click any step below to see the business logic, data query, and sample output for that step of the workflow.

Pre-specified logic, not runtime guessing — Most AI agent frameworks work by figuring things out on the fly. These Decision Intelligence workflows work differently. The Knowledge Work Foundry analyzes the cognitive labor pattern before deployment and encodes the decision logic directly into the configuration — which tables to query, which thresholds define a breach, how signals are ranked, and what the output artifact should contain. That analysis happens once. By the time the workflow runs, there is nothing left to figure out.
1
Detect Spike
Compares recent delivery failures in a region against the prior period to determine whether a failure cluster exists.
2
Rank Drivers
Pulls operational, external, and customer signals for the peak failure date and ranks the most likely causes by weighted contribution.
3
Write Narrative
Assembles the detected spike, ranked causes, and supporting evidence into a plain-language explanation with recommended follow-up actions.
↑ click a step to explore the logic, query, and output
1
Step Detail

                      

                    

It produces a ranked root-cause narrative for a defined region and time window, including the size of the failure spike, the supporting evidence for each likely driver, and suggested areas for operational follow-up. The output can be used in regional ops briefings, carrier reviews, and incident post-mortems.

What this workflow does NOT do: It does not decide whether to escalate a carrier issue into a contract or performance review, choose which remediation action to run first in the region, adjust staffing schedules or route design, or determine how regional leadership should communicate accountability to carriers and field teams.
Under the Hood

Data Warehouse Integration

The workflow depends on operational history plus adjacent signals that usually sit in separate reporting domains. It brings those records together so the planner does not have to manually reconcile whether the failure spike aligns with carrier degradation, route disruption, or customer availability issues.

The analysis is cross-domain by design, combining delivery status trends with carrier performance, road closure activity, and customer no-show behavior for the same region and date range.

Source system: Last-mile delivery operations records  ·  Domain: Operations
Role in this workflow: This table is the starting point for determining whether a region is experiencing an abnormal delivery failure cluster. It provides daily delivery volume and failure counts across the analysis window, which the workflow uses to compare the current period to the immediately prior period and identify the peak failure date.
CREATE TABLE retail_dev.last_mile_ops.delivery_status_daily (
  delivery_id VARCHAR,
  region_id VARCHAR,
  delivery_date DATE,
  status VARCHAR
);

WITH current_window AS (
  SELECT
    region_id,
    COUNT(*) AS deliveries_current,
    SUM(CASE WHEN status = string">'Failed' THEN 1 ELSE 0 END) AS failures_current
  FROM retail_dev.last_mile_ops.delivery_status_daily
  WHERE region_id = string">'{region_id}'
    AND delivery_date BETWEEN string">'{start_date}' AND string">'{end_date}'
  GROUP BY region_id
),
prior_window AS (
  SELECT
    region_id,
    COUNT(*) AS deliveries_prior,
    SUM(CASE WHEN status = string">'Failed' THEN 1 ELSE 0 END) AS failures_prior
  FROM retail_dev.last_mile_ops.delivery_status_daily
  WHERE region_id = string">'{region_id}'
    AND delivery_date BETWEEN (CAST(string">'{start_date}' AS DATE) - {time_window_days}) AND (CAST(string">'{start_date}' AS DATE) - 1)
  GROUP BY region_id
)
SELECT
  c.region_id,
  c.deliveries_current,
  c.failures_current,
  CASE WHEN c.deliveries_current = 0 THEN NULL ELSE CAST(c.failures_current AS DOUBLE) / c.deliveries_current END AS failure_rate_current,
  p.deliveries_prior,
  p.failures_prior,
  CASE WHEN p.deliveries_prior = 0 THEN NULL ELSE CAST(p.failures_prior AS DOUBLE) / p.deliveries_prior END AS failure_rate_prior,
  CASE
    WHEN p.deliveries_prior = 0 OR p.failures_prior = 0 THEN NULL
    ELSE CAST(c.failures_current AS DOUBLE) / p.failures_prior - 1
  END AS failure_count_wow_change
FROM current_window c
LEFT JOIN prior_window p
  ON c.region_id = p.region_id;
Source system: Carrier performance monitoring data  ·  Domain: Transportation Operations
Role in this workflow: This table provides the carrier reliability signal used in root cause ranking. It contributes when a carrier's on-time rate on the peak failure date drops below the business threshold, indicating that execution issues from a specific carrier may be the primary driver of failed deliveries.
CREATE TABLE retail_dev.last_mile_ops.carrier_performance_daily (
  carrier_id VARCHAR,
  region_id VARCHAR,
  perf_date DATE,
  on_time_rate DOUBLE
);

WITH daily_failures AS (
  SELECT
    region_id,
    delivery_date AS d,
    SUM(CASE WHEN status = string">'Failed' THEN 1 ELSE 0 END) AS failures
  FROM retail_dev.last_mile_ops.delivery_status_daily
  WHERE region_id = string">'{region_id}'
    AND delivery_date BETWEEN string">'{start_date}' AND string">'{end_date}'
  GROUP BY region_id, delivery_date
),
peak_day AS (
  SELECT region_id, d AS peak_date, failures
  FROM daily_failures
  QUALIFY ROW_NUMBER() OVER (PARTITION BY region_id ORDER BY failures DESC, d DESC) = 1
)
SELECT
  p.carrier_id,
  p.region_id,
  p.perf_date AS date,
  p.on_time_rate
FROM retail_dev.last_mile_ops.carrier_performance_daily p
JOIN peak_day pk
  ON p.region_id = pk.region_id
 AND p.perf_date = pk.peak_date
ORDER BY p.on_time_rate ASC;
Source system: Road condition and closure logs  ·  Domain: External Conditions
Role in this workflow: This table adds the external disruption signal for the peak failure date. When closure counts exceed the threshold, the workflow treats route interference as a contributing cause and includes it in the ranked explanation with traceable evidence.
CREATE TABLE retail_dev.last_mile_ops.road_closures_daily (
  region_id VARCHAR,
  closure_date DATE,
  closure_count INTEGER
);

WITH daily_failures AS (
  SELECT
    region_id,
    delivery_date AS d,
    SUM(CASE WHEN status = string">'Failed' THEN 1 ELSE 0 END) AS failures
  FROM retail_dev.last_mile_ops.delivery_status_daily
  WHERE region_id = string">'{region_id}'
    AND delivery_date BETWEEN string">'{start_date}' AND string">'{end_date}'
  GROUP BY region_id, delivery_date
),
peak_day AS (
  SELECT region_id, d AS peak_date, failures
  FROM daily_failures
  QUALIFY ROW_NUMBER() OVER (PARTITION BY region_id ORDER BY failures DESC, d DESC) = 1
)
SELECT
  r.region_id,
  r.closure_date AS date,
  r.closure_count
FROM retail_dev.last_mile_ops.road_closures_daily r
JOIN peak_day pk
  ON r.region_id = pk.region_id
 AND r.closure_date = pk.peak_date;
Source system: Customer delivery availability logs  ·  Domain: Customer Operations
Role in this workflow: This table captures failed-delivery pressure from customer no-shows or missed availability windows. It contributes to the ranked narrative when no-show rates exceed the defined threshold, helping separate customer-side issues from carrier or road-related causes.
CREATE TABLE retail_dev.last_mile_ops.customer_availability_daily (
  region_id VARCHAR,
  availability_date DATE,
  no_show_rate DOUBLE
);

WITH daily_failures AS (
  SELECT
    region_id,
    delivery_date AS d,
    SUM(CASE WHEN status = string">'Failed' THEN 1 ELSE 0 END) AS failures
  FROM retail_dev.last_mile_ops.delivery_status_daily
  WHERE region_id = string">'{region_id}'
    AND delivery_date BETWEEN string">'{start_date}' AND string">'{end_date}'
  GROUP BY region_id, delivery_date
),
peak_day AS (
  SELECT region_id, d AS peak_date, failures
  FROM daily_failures
  QUALIFY ROW_NUMBER() OVER (PARTITION BY region_id ORDER BY failures DESC, d DESC) = 1
)
SELECT
  a.region_id,
  a.availability_date AS date,
  a.no_show_rate
FROM retail_dev.last_mile_ops.customer_availability_daily a
JOIN peak_day pk
  ON a.region_id = pk.region_id
 AND a.availability_date = pk.peak_date;
Cognitive Labor Analysis

Where the Work Sits in the Labor Stack

Not all cognitive labor is equally automatable. The KWF analysis breaks the workflow into three layers — execution, judgment, and strategic — and maps each step to the layer it belongs to. Execution-layer work is automatable. Judgment and strategic work stays with the manager.

Execution 50% Judgment 35% Strategic 15%
Execution Layer
50%
The execution layer retrieves the relevant operating signals, evaluates threshold deviations, ranks likely drivers, and formats the evidence into a narrative artifact.
Judgment Layer
35%
The manager or planner still interprets the findings in local context, decides what action to take, and communicates the implications to operations and carrier stakeholders.
Strategic Layer
15%
Leadership retains decisions about carrier management policy, network design changes, staffing models, and broader service recovery investments.
Value Model

The Business Case for Automation

Time Recovered
6 hrs / month
A team of 2 analysts and 1 regional manager currently spends about 2 hours per failure cluster event across 2 events each month.
Annual Savings
$6,480 / yr
At a blended labor rate of $90 per hour, 50% time compression yields an estimated $6,480 in annual hard savings.
Strategic Upside
Faster Interventions
Timelier, evidence-backed explanations reduce the risk of recurring delivery failures by helping teams act before the same pattern repeats.
Kill Question: Without this workflow, the team relies on manual dashboard review, ad-hoc analyst requests, and subjective explanations that vary by person and often arrive late.

Primary Valuation Metric: Reduction in average time to produce root-cause narratives per delivery failure cluster event.

Next Step

Run your own value estimate for delivery failure analysis — or talk to us about your last-mile route planning team.

The Cognitive Labor Value Calculator models team size, role cost, and automation coverage for this workflow so you can estimate labor impact quickly. It takes under two minutes to complete.