Case study · AI agents & prediction

Predicting delivery appointments, and letting an agent improve the predictor.

AI scheduling agents book warehouse appointments for cross-border freight, and they are only as good as the date they ask for. I took over an early predictor and, with engineering partners, built the production system around it: prediction service, accuracy framework, go-live readiness gates, and decision logging.

The questionHow do you know a model change is actually better, and when is it ready to act on its own?

BeforeAn early predictor with no reliable way to tell whether a change helped, so nobody could safely let it drive automation, and no measure of how often the scheduling agents chose the right tool.
AfterPrediction error fell 39% on a frozen offline replay set, most of it from the research loop’s first 17 experiments, and the system reached 94% same-day accuracy for the highest-priority shippers at go-live. The evaluation framework for five scheduling agents became the company’s standard for judging AI. Its first tool-calling check found the agents picked the correct tool 86.6% of the time, an early snapshot that gave the team a baseline to improve against.

The problem

Delivery appointments are negotiated with receiving warehouses by phone and email. A good prediction of when a shipment can be delivered decides whether a scheduling agent can book with confidence or should hand the conversation to a person.

The early predictor worked, but there was no reliable way to tell whether a change made it better or only looked better on a convenient sample. Without that, nobody could safely let it drive automation.

From business problem to technical problem

The first job is translation. Here is how the ask changed shape before any code was written.

  1. Business askCan AI agents book delivery appointments without a person on every call?
  2. Technical questionPredict the appointment a warehouse will accept for each shipment, and know when that prediction is reliable enough to act on.
  3. What success looks likeError measured on a fixed replay set, plus per-shipper readiness gates that say when automation can switch on.

Paths I weighed

There was more than one reasonable way to do this. These are the options I compared and why I picked one.

Considered

Hand-tune the rules

Upside. Fast and easy to explain to operations.

Cost. Slow iteration, and no evidence that a change helps everywhere it applies.

Considered

Replace it with a new model

Upside. Could capture more signal.

Cost. Harder to explain, needs new training infrastructure, and still needs an evaluation harness to prove it is better.

Chosen

Build the harness, then let an agent iterate

Upside. Many experiments, each one evidenced and reviewable, and the logic stays legible.

Cost. Upfront investment in replay data and guardrails.

What I built

  1. Frozen replay casesHistorical shipments prepared as fixed evaluation sets
  2. Research loopA coding agent edits logic, replays, keeps only gains
  3. Prediction serviceProduction predictions with decision logging
  4. Go-live gatesReadiness checks before automation turns on
  5. Scheduling agentsVoice and email agents act; outcomes feed evaluation

I designed an autonomous research loop: a coding agent edits the prediction logic, runs replay evaluation against the frozen cases, and keeps a change only when it beats the baseline. Most of the improvement in prediction error came from the loop’s first run.

Alongside the predictor, I built the evaluation system for the voice and email scheduling agents from scratch: transcript parsing, scenario classification, and LLM-as-judge grading across five specialized agents. It became the company’s standard for measuring AI performance.

Two loops. Offline, a coding agent edits the prediction logic, every frozen replay case is rerun, and a fixed acceptance rule keeps only changes that beat the baseline. Live, shipment events reach the prediction service, decisions are logged before they are acted on, and a per-shipper go-live gate lets voice and email scheduling agents act or leaves scheduling to people. Agent conversations feed an evaluation pipeline.
The agent may change the logic, never the replay set or the acceptance rule. Go-live is decided shipper by shipper.

How it got built, scaled, and fixed

  1. Build

    I took over an early predictor and first built frozen replay cases, so any change could be scored the same way.

  2. Scale

    Wrapped it in a production service with decision logging, and added readiness gates so automation could expand shipper by shipper.

  3. Fix

    Logged decisions and the replay set make a bad prediction reproducible, so a fix goes through the same evidence as an improvement.

Decisions that mattered

Replay before rollout

Every candidate is scored on the same frozen historical cases, so a difference in error reflects the change, not a different sample.

Let the agent experiment, not decide

The coding agent may edit prediction logic, but the replay harness and the acceptance rule stay fixed. Only measured improvements are kept, and every change stays reviewable.

Gate go-live by shipper

Accuracy differs by shipper. Readiness gates turn automation on where the evidence is strong and keep people in the loop elsewhere.

Log decisions before acting on them

Decision logging shows what the system would do before it is allowed to do it, which makes rollout auditable.

What transfers

Autonomy is safe when the judge is fixed. A coding agent can explore far more ideas than a person, as long as it cannot touch the evaluation it answers to. I would use the same structure for any system that should keep improving after launch.

Methods

Offline replayCoding agentsLLM-as-judgeRelease gatesDecision logging

Collaborative work with product and engineering partners; this page describes my contribution. Diagrams are simplified.