Vibe Engines is free, interactive AI engineering & system design — runs in your browser. Pick a learning path →
The control tower that started as a shared inbox
Ridgeway Freight, a fictional third-party logistics provider, asks for an AI control tower that predicts every late shipment. Twelve weeks later it has something less glamorous that works: carrier signals turned into confirmed actions on a shift lead’s tablet in under an hour. The dominant challenge is not the model: it is 211 carrier codes for 140 carriers, an ERP that only takes batches, a replay storm that broke the first idempotency key, and a night shift that never looks at a screen.
The customer, the ask, and how to read this page
One of five worked cases, each in a different industry with a different dominant problem. This one is about plumbing, and about people standing on a loading dock.
This is an authored, synthetic engagement. The customer, the people and every number are invented for teaching and are internally consistent; none comes from a real customer, and every figure on this page is illustrative unless a source is named next to it. Regulatory facts are real and are stated as rules, not as outcomes.
“Our customers find out about late shipments before we do. We want an AI control tower: something that watches every load and predicts which ones will be late. Peak season is ten weeks out.” — Ridgeway’s COO, at kickoff.
Ridgeway (illustrative) runs six distribution centres and ships about 4,200 outbound loads a week for retail and industrial clients, using roughly 140 carriers. Thirty-eight of them exchange EDI; the rest send status by email, by carrier portal, or by phone call to a customer service rep. About 9% of loads hit an exception — a late or missed pickup, a short shipment, a missed delivery appointment, a refusal — which is around 380 exceptions a week.
Terms used below. X12 is the North American EDI standard; each document is a numbered transaction set: 204 load tender, 990 the carrier’s accept or decline, 214 shipment status, 210 freight invoice, 856 advance ship notice. A 997 functional acknowledgment confirms a group of documents arrived and parsed — not that anyone agreed with them. Documents travel over AS2 (signed, encrypted HTTP with receipts) or a VAN (value-added network mailboxes), wrapped in envelopes with control numbers.
Discovery: who was in the room, and what they actually needed
Ten interviews, four shifts on the dock, and a time study of 200 exceptions. Nobody on the floor asked for a prediction.
| Person / role | Goal | Pain | Influence |
|---|---|---|---|
| COO | Stop customers hearing bad news first | Two large clients cited late notification in quarterly reviews | Sponsor; owns budget |
| Customer service lead | Fewer angry calls | Seven reps triage a shared inbox of carrier email by hand | Champion; owns the inbox |
| DC shift leads (day) | Know about a missed pickup before the trailer door is reassigned | Hear about problems by radio, hours late | Decide whether anything changes on the dock |
| DC shift leads (night) | Get through the shift | One lead covers two buildings; no desk, no mounted screen | Informal veto, exercised by ignoring things |
| EDI analysts (2) | Stop being paged for partner mapping errors | Every carrier implements the 214 slightly differently | Own the translator and, later, the system |
| ERP owner | No customisation that breaks the next upgrade | A past integration wrote directly to tables and corrupted a quarter-end | Hard gate on how anything writes to the ERP |
| Union steward, DC-North | No new surveillance of warehouse workers | A previous scanner rollout was used for discipline | Can stall a rollout on the floor |
Where the 5.5 hours go (time study, 200 exceptions)
| Stage between carrier signal and warehouse action | Share of elapsed time |
|---|---|
| Signal sitting unread in the shared inbox or the portal | 52% |
| Working out which load the message is about | 23% |
| Telling the right DC (phone, then radio) | 14% |
| Re-keying status into the ERP | 11% |
Illustrative baseline: median 330 minutes from carrier signal to warehouse action; in 31% of exceptions the client called Ridgeway before Ridgeway called the client; 8% of inbox messages were first matched to the wrong load and corrected later.
What they asked for versus what they needed
- Asked: prediction. Found: the carrier usually already said the load would be late; the signal sat unread for half the elapsed time.
- Asked: AI everywhere. Found: 56% of signals are structured 214s a rule reads exactly; only the 44% in free text needs a model.
- Assumed: the carrier list is clean. Found: 211 carrier codes in the ERP for 140 real carriers. One national carrier appeared under three codes, including a retired SCAC (Standard Carrier Alpha Code) from before an acquisition.
The FDE asked for every carrier email from one Tuesday, unedited: 214 of them. Reading them in one sitting showed the real distribution — reply chains, three loads in one message, Spanish notes from a cross-border carrier — and they became the seed of the golden set.
The scoped first delivery
End of week 2. The COO signed it after one question: “If we knew about every exception within the hour, would you still need a prediction this quarter?”
Problem. Carrier exception signals take a median 330 minutes to reach a warehouse action, mostly because they sit unread and must be matched to a load by hand; clients call first in 31% of exceptions.
First delivery. At DC-North and DC-South, every carrier signal — 214, email or portal note — becomes a typed exception matched to one ERP load with a playbook action for the shift lead to confirm; confirmed actions write through the ERP’s batch interface.
Success. Median signal-to-action ≤60 minutes for signals through the system; client-called-first ≤15%; measured with the week-2 method in weeks 10–11.
Guardrails. No ERP write without a lead’s confirmation. Wrong-load matches at or under 0.5% of messages. No status in the ERP ever moves backwards. No per-worker performance data collected.
| In scope | Out of scope, with the reason |
|---|---|
| Rules over 214 status codes for the 38 EDI carriers | Late-load prediction. Revisit after peak: the existing signals were not being read, so prediction would add a second unread signal |
| LLM classification and reference extraction for free-text email and portal notes | Automatic carrier rebooking. Rates and relationships live with the carrier desk |
| Carrier alias table: 211 codes collapsed to 140 carriers | 210 freight invoice audit. Real money, different owner, next engagement |
| Lead confirmation on a tablet, writes via the ERP batch API | Any ERP customisation or table write. The ERP owner’s veto, and the upgrade path |
Prediction was not called a bad idea; the argument was ordering. If nobody reads the carrier’s own late notice for five hours, nobody will read a prediction either. Prediction went in the charter as phase 2, dated after peak, with the week-11 numbers as its entry ticket.
Architecture: an event layer beside a legacy core
Weeks 3–7. Two constraints decided most of the design: the ERP may not be modified, and every carrier message may arrive twice, late, or out of order.
As found: 38 carriers send 214s through a VAN mailbox or AS2, in bursts, and a VAN holds messages during an outage, so arrival order is not event order. An existing EDI translator parses X12 and sends 997s; it is reused, not replaced. The ERP takes status updates through a SOAP service in batches every 15 minutes, up to 500 rows (illustrative). The shared inbox is free text with PRO numbers, bills of lading and client POs mixed together: the only place a language model earns its keep.
Options considered
| Option | For | Against | Verdict |
|---|---|---|---|
| A. Replace the VAN with direct carrier APIs | Fresher data, modern formats | 140 carriers, a few with APIs; would take years, not weeks | Rejected |
| B. Custom module inside the ERP | One system of record | The ERP owner’s veto; breaks on upgrade; quarterly change window | Rejected |
| C. Event layer beside the ERP: consume the translator’s output and the inbox, keep canonical events, write back only through the batch API | No ERP change; reuses EDI investment; every write is replayable | A second store to operate; the 15-minute batch is a floor on latency | Chosen |
Data flow
- Normaliser maps each message to a canonical event: carrier (via the alias table), load reference, status, reason, event time, location. Unknown codes go to review, never to a guess.
- Event store applies two layers of deduplication and a state machine (detailed in section 06 after the incident rewrote it) so that a load’s current state only moves forward.
- Exception engine. Deterministic rules over structured status (for example, arrived at pickup with no departure within the appointment window). For free text, the LLM returns an exception type from a fixed list plus the references it found; a deterministic matcher then looks those references up in the ERP. If they do not resolve to exactly one open load, the message goes to a rep as “unmatched”.
- Lead tablet. Exception, source text and a playbook action (re-tender, hold the door, notify the client); confirming writes to the ERP batch.
Threats and mitigations
| Threat | Mitigation |
|---|---|
| Model attaches a message to the wrong load | Model extracts references; a lookup matches; ambiguity goes to a human |
| Duplicate or replayed messages | Idempotency on the envelope. Written in week 4 as sufficient. See section 05. |
| System becomes a worker-monitoring tool | Confirmations logged by role and shift; written agreement with HR and the steward: no per-worker metric |
Break an integration on purpose
The reliability lab replays duplicates, timeouts and out-of-order deliveries against your design.
The hard moment: a week of 214s, replayed out of order
Week 8, Monday, six weeks before peak. A national carrier’s VAN connection had been down since Friday evening. When it came back, the carrier re-sent everything.
| When | What happened |
|---|---|
| Mon 04:10 | The carrier’s VAN link reconnects. Its operations team, unsure what had been delivered, re-sends seven days of 214s, each re-wrapped in a new envelope with a new interchange control number. |
| 04:50 | 18,400 messages received in 40 minutes; a normal Monday brings about 2,600 all day. Of the 18,400, about 6,100 are genuinely new (held during the outage) and 12,300 are re-sends of events already processed. |
| 05:30 | The envelope-level dedupe sees new control numbers and lets the re-sends through. Older “arrived at pickup” events are applied after “delivered”. ERP batch 1 sends 480 status rows; 312 of them move a delivered load back to “at pickup”. Clients’ tracking pages now show delivered freight as not yet collected. |
| 06:00 | Day shift starts at DC-North. 212 “missed pickup” exceptions sit on the lead’s tablet, because the regressed loads now look stuck at the dock. The lead radios the ops manager: “the AI is broken, I’m ignoring it.” |
| 06:08 | Exception-rate alert (over three times normal) pages the FDE. |
| 06:15 | FDE pauses the ERP write adapter (batches queue, nothing is lost) and sets the exception engine to shadow for that one carrier. Other carriers and the email path continue. |
| 06:40 | Cause: dedupe keyed on the envelope, and the state machine trusted newer-arriving over newer-happening. |
| 07:30 | A reconciliation query restores the 312 regressed loads via a correction batch; customer service notes the two affected clients. |
| 09:00 | Fix deployed to staging and the quarantined 18,400 replayed in event-time order: 0 regressions, 6 real exceptions found among the genuinely new events. |
| 11:30 | Production replay complete; the carrier’s exceptions back on. Carrier relations asks the carrier to notify Ridgeway before any future bulk re-send. |
Three problems at once: the ERP clients see was wrong about their freight, 212 false exceptions could have got a door reassigned, and a new user had just told an open radio channel he was ignoring the tool.
How it was handled
The fix took two hours. The four design changes behind it are the part worth repeating in an interview.
- Stop the writes, keep the data. Pausing the ERP adapter protected the system of record while messages kept landing in the event store. Switching everything off would have blinded the other 37 EDI carriers too.
- Dedupe on two identities, not one. The envelope key, (trading partner, interchange control number), still catches exact retransmissions and tracks 997s. A second key, (trading partner, load reference, status code, event time), identifies the business event; a re-wrapped copy of an event already seen is recorded as a duplicate and does nothing.
- Order by when it happened, not when it arrived. A forward-only state machine: older events go to history and never overwrite a later state, and the ERP writer only sends forward transitions, so “status never moves backwards” is a property of the code.
- Treat bulk replays as a mode. Over five times a partner’s normal hourly volume quarantines that feed; quarantined messages replay in event-time order, and events older than six hours raise no dock exception — they go to a reconciliation report, because nobody can act on Thursday’s pickup.
The FDE went to DC-North at 13:00, before the afternoon shift, and showed the day lead the 212 false exceptions next to the replay graph. The system had believed old news; nothing older than six hours would reach the tablet again. Then the FDE asked what else would make the lead ignore it. His answer (“when it tells me about loads in the other building”) became a per-building filter the same week.
An idempotency key is a claim about what counts as the same thing. The envelope is the transport’s idea of sameness; the business event is the customer’s. In any integration fed by retries, queues or third parties, write both down and ask which one a replay will change.
What was measured, and its honest limits
Two evaluations: a golden set that gates the free-text path, and a pilot measured with the week-2 method. The structured path is tested by replaying real traffic, not scored by a model.
Golden set for free-text messages
600 carrier emails and portal notes, seeded from that Tuesday, labelled by two reps with their lead as tie-break. Two outcomes are kept apart:
- Wrong-load match: the message is attached to a load it is not about. Someone may hold a door, re-tender or call a client about the wrong freight. Gate: ≤0.5% overall, ≤2% on any slice.
- Unmatched: references do not resolve to exactly one open load, so a rep matches it by hand. This costs minutes, not mistakes. Tracked, with a target to reduce.
| Slice | Messages | Exception type correct | Wrong-load match | Unmatched (to a rep) |
|---|---|---|---|---|
| Template emails, large carriers | 220 | 214 (97.3%) | 0 | 6 (2.7%) |
| Free text, small carriers | 160 | 142 (88.8%) | 1 (0.6%) | 19 (11.9%) |
| Forwarded reply threads | 90 | 74 (82.2%) | 1 (1.1%) | 14 (15.6%) |
| Multi-shipment emails | 60 | 47 (78.3%) | 1 (1.7%) | 12 (20.0%) |
| Spanish notes, cross-border | 40 | 35 (87.5%) | 0 | 5 (12.5%) |
| Portal note snippets | 30 | 27 (90.0%) | 0 | 2 (6.7%) |
| Total | 600 | 539 (89.8%) | 3 (0.5%) | 58 (9.7%) |
All three wrong-load matches hit a closed load from another client with the same PRO number; the matcher now considers only the sending carrier’s open loads. The structured path was tested by replaying two weeks of production 214s plus the incident’s 18,400 messages through staging after every change: zero backward transitions is a release condition.
Pilot outcome (weeks 10–11, DC-North and DC-South, illustrative)
| Measure | Baseline (wk 2) | Target | Through the system |
|---|---|---|---|
| Median signal-to-action | 330 min | ≤60 min | 48 min |
| Client called first | 31% | ≤15% | 12% |
| Inbox messages matched to the wrong load | 8% | ≤0.5% | 0.4% (sampled) |
| Confirmations on the tablet, day shift | — | — | 92% |
| Confirmations on the tablet, night shift | — | — | 41%, then 74% by week 12 |
The night-shift number
Night shift at 41% was not resistance to AI. One lead covered two buildings on foot with a radio; the tablet lived in an office she passed twice a shift. A rugged tablet at each shipping office door and an hourly three-line digest read out on the radio moved it to 74%.
Run cost: roughly 1,100 free-text messages a week at the two DCs, at about a cent each, is around $11 a week, illustrative. In this case the model is the cheapest component; the integration and the clean-up are the cost.
The limits, stated before anyone asked
- Pre-peak traffic. Weeks 10–11 ran at normal volume. Peak behaviour, when carriers are late in bulk, is unmeasured.
- Signal-to-action uses the lead’s tap as “action”. A lead may act on the radio and tap later, or tap and act later. The number is consistent with the baseline method, not a stopwatch.
- Phone-in exceptions (about one in ten) are outside the system.
Handoff
Week 12. Ridgeway’s two EDI analysts own the system; the FDE leaves before peak, deliberately.
- Owner: the senior EDI analyst. Alias table owner: carrier relations — a new carrier code is a commercial fact, not an engineering one.
- Partner replay runbook: confirm quarantine; ask the carrier what it re-sent; replay in event-time order on staging (zero backward transitions); replay to production; send the reconciliation report.
- Gate: any change runs the golden set and the 14-day replay; it fails on wrong-load above 0.5% (2% per slice) or any backward transition.
- Controls: ERP write pause, per-carrier shadow, email-path off; each rehearsed by the analyst.
- Open items with owners: multi-shipment splitting (EDI analysts), the four remaining DCs (ops), phone-in exceptions (customer service), phase 2 prediction (COO, after peak).
The handoff drill seeded 2,000 duplicated 214s; the analyst replayed them cleanly in 22 minutes and found one gap — telling a replay from a real spike of delays — now covered by a rule of thumb (mostly events older than six hours means replay) and its query.
What an interviewer would probe
Logistics stories invite deep questions on integration mechanics. Have the mechanics ready.
| Probe | Weak answer | Strong answer |
|---|---|---|
| “They asked for prediction. Why didn’t you build it?” | “There wasn’t enough data.” | The carrier already said the load was late; we read it five hours later. I fixed that first and dated prediction for after peak. |
| “What was your idempotency key?” | “The message ID.” | Two: the envelope (partner, interchange control number) for exact retransmits, and the business event (partner, load, status, event time) for re-wrapped copies. The first version only had the envelope, which is why the incident happened. |
| “Why not let the LLM pick the load?” | “It’s accurate enough.” | The model extracts references; a lookup decides. Matching to the wrong load is the harmful error, so it belongs to deterministic code with a human fallback. |
| “Night shift used it 41% of the time. Whose fault?” | “They needed more training.” | Mine: I designed for a desk. A mounted tablet and a radio digest got it to 74%. |
Use this in your interview
Two shapes: a behavioural story and a decomposition answer. Both should leave room for the interviewer to dig into the integration.
As a behavioural story (“Tell me about a production issue you owned”)
Situation. A 3PL, six weeks before peak; I had built an event layer turning carrier EDI and email into exceptions for warehouse leads. A carrier came back from a VAN outage and re-sent a week of status messages, re-enveloped and out of order.
Task. Stop delivered loads showing as not collected in the ERP and on clients’ portals, clear 212 false exceptions, and keep the other 37 EDI carriers flowing.
Action. Paused ERP writes and shadowed that one carrier in seven minutes. Found that my dedupe keyed on the envelope, not the business event, and my state machine trusted arrival order. Restored 312 regressed loads with a correction batch, added an event-level key and forward-only state, quarantined and replayed in event-time order. Went to the dock that afternoon to explain it to the lead who had said “I’m ignoring it” on the radio.
Result. Clean replay with zero regressions by 11:30; the lead kept using it; the pilot hit its targets (illustrative: 330 to 48 minutes signal-to-action).
Reflection. An idempotency key is a definition of sameness. I now ask what each partner does after an outage before I choose one.
As a decomposition answer (“Design exception handling for a 3PL with 140 carriers”)
- Find where the time goes. Propose a time study from carrier signal to warehouse action; hypothesise the signal exists but sits unread.
- Split structured from unstructured. Rules for 214 status codes; a model only for free text.
- Fix master data first. Carrier aliases and SCACs; unknown codes stop at review.
- Design for replay. Envelope and business-event keys; event-time ordering; forward-only state; quarantine on volume spikes.
- Keep the harmful decision deterministic. The model extracts references; a lookup matches; ambiguity goes to a person.
- Design for the floor. Who stands where, on which shift, with what device; radio before dashboard.
Common mistakes when candidates tell a logistics story
- One idempotency key. Interviewers will ask what happens on a re-enveloped replay.
- Accuracy without the harmful error. “90% classification” says nothing about wrong-load matches.
- Blaming adoption on users. Low use on one shift is a design finding about that shift.
Rehearse the loop
Run the decomposition outline in the simulator, map the story onto the behavioural bank, then do the take-home spec closest to this case under its time box.
Pattern recognition across the five cases
The same FDE moves recur in every industry; the dominant risk changes. Compare this one with the insurance case, which met a smaller cousin of the same idempotency bug.
| Case | Fictional customer | Dominant FDE challenge |
|---|---|---|
| Insurance | Northstar Mutual | Scope down a vague “agent” ask; idempotent ingest; honest ROI |
| Healthcare (payer) | Cedarline Health Plan | PHI boundaries, BAAs, clinician trust, edge-case evals |
| Banking (AML) | Harborview Bank | Model risk management, auditability, false-negative cost, in-VPC |
| Logistics (this page) | Ridgeway Freight | EDI and legacy APIs, messy data, idempotency, warehouse adoption |
| Retail support | Lumen & Loom | Agent tool use, escalation, cost per conversation, honest deflection |
| Public sector | Federal benefits office | Procurement, Section 508, data residency, change management |
Specific to logistics: third parties you do not control send the same fact many times in different envelopes, the system of record cannot be touched, and the users are on their feet, across several shifts.
Check yourself
Five questions. Open one to see the answer.
A carrier re-sends a week of 214s, each in a new envelope. Why did the first dedupe miss them?
- The translator rejected them
- It keyed on (partner, interchange control number), and every re-sent copy had a new control number
- The 997s failed
- The ERP batch was full
Answer: B. The envelope identity changed while the business event did not; the fix added a key on (partner, load, status, event time).
What does an X12 997 functional acknowledgment tell you?
- The partner accepted the business content
- The functional group was received and parsed
- The load was delivered
- The invoice is approved
Answer: B. A 997 reports receipt and syntax; business validity still has to be checked downstream.
Why does the LLM extract references but not choose the load?
- LLMs cannot read PRO numbers
- A wrong-load match is the harmful error, so a deterministic lookup decides and ambiguity goes to a person
- It is cheaper
- The ERP forbids it
Answer: B. The model handles the language; the matching that can cause harm stays deterministic and auditable.
How does the system guarantee that an ERP status never moves backwards?
- By trusting arrival order
- A forward-only state machine ordered by event time; older events go to history, and the writer only sends forward transitions
- By manual review of every write
- By deleting old messages
Answer: B. Making it a property of the code means a replay cannot regress a load.
Night-shift confirmations were 41%. What moved them to 74%?
- A mandate from the COO
- Fitting the radio culture: a mounted tablet at the office door and an hourly radio digest
- A better model
- Removing the confirmation step
Answer: B. One lead covered two buildings on foot; the design met her where she already listened.
Quick answers
Is Ridgeway Freight a real company?
No. This is an authored, synthetic engagement. The customer, people and numbers are invented and reconciled with each other; the X12 transaction sets (204, 990, 214, 210, 856, 997), AS2 and VAN behaviours described are real conventions.
How do you make EDI 214 processing idempotent?
Use two identities. The envelope key, such as trading partner plus interchange control number, catches exact retransmissions. A business-event key, such as partner, load reference, status code and event time, catches the same event re-sent in a new envelope. Then order by event time and only allow forward state transitions, so a late or replayed message cannot regress a load.
Where does an LLM help in logistics exception handling?
On free text: carrier emails, portal notes and reply threads. Structured status messages suit rules, and attaching a message to a specific load is safer as a deterministic lookup with a human fallback.
What is the hardest part of an FDE engagement in logistics?
Usually not the model: duplicate carrier codes, partners that resend data in new envelopes and out of order, a core ERP you may not change, and warehouse users who work by radio rather than at a desk.
Explore the topic
See this alongside everything else on the same subject — handbooks, system designs, challenges and tools, in one place.
More Handbooks
- The Agent Evaluations HandbookA self-contained handbook on evaluating AI agents — theory, interactive widgets, and practical guidance. Trajectory evals, tool-use scoring, LLM-as-judge, observability, and reliability for PMs, engineers, and founders.Read →
- The Agent Patterns HandbookThe design patterns behind every LLM agent — the ReAct Thought–Action–Observation loop, tool/function calling, plan-and-execute, reflection, memory, multi-agent orchestration, and the failure modes (loops, hallucinated tools, recovery, human-in-the-loop) that break agents in production.Read →
- The Kubernetes HandbookThe one idea under all the YAML — declare desired state, and a control loop makes reality match. Covers the orchestration problem, pods, deployments and replicasets, services and networking, the reconciliation loop and self-healing, the scheduler, config/secrets and health probes, autoscaling, and when you actually need Kubernetes.Read →
- The Observability HandbookSeeing inside production — monitoring vs observability, the three pillars (metrics, logs, traces) and what each answers, structured logging, metric types and the cardinality trap, distributed tracing, the golden signals and SLIs/SLOs/error budgets, alerting on symptoms not causes, and correlating all three during an incident.Read →
- The AI Security HandbookYour app now reads the internet and believes it. Why prompt injection is a design problem filters cannot solve, the lethal trifecta (private data + untrusted content + exfiltration), defense in depth from least privilege to output validation, where PII actually leaks (logs, embeddings, weights), MCP/model supply-chain trust, and the red-team eval suite that gates CI.Read →
- The Docker HandbookA container is a lie told by the kernel — namespaces (what a process sees) plus cgroups (what it uses), not a VM. Image layers and the cache-ordering rule that halves build times, multi-stage Dockerfiles that ship small, volumes vs bind mounts, name-based networking, Compose, and the handoff to Kubernetes.Read →