← Back to services & tools

handoff active

A customer writes in: "it arrived broken". To answer them, someone has to look at the order, the shipment, how many times that customer has claimed before, and whatever the warehouse wrote down (four reads against an old system), and only then decide. handoff makes those four reads and decides, in two seconds. It sends a replacement, refunds, asks for a photo, or hands the case to a person with the four reads already done and the reason it stopped.

TypeScriptNodeHono ZodOllamavitest GitHub Actions

What it is for

An e-commerce operation takes claims all day. The work is repetitive: each claim means looking at four screens, and takes as long as opening them does. handoff takes the claims over HTTP and returns the decision together with the facts behind it. In eight out of ten the decision is the right one, counting the cases where the right call was not to decide. When the facts fall short, the case reaches a person with everything already gathered.

the system fails · it asks again Claim from a customer Gathers the facts 4 reads order shipment history notes the company's own system · one, and old proposes · does not execute The model picks an action 11 rules review it Resolved on its own refund · replacement · ask for a photo A person looks at it when the facts fall short or the amount is high,or the customer has claimed three times
The model picks what to do and the eleven rules decide whether it executes. The ones guarding money, refunds and replacements, are strict. Asking the customer for a photo costs nothing and does not need them. Across 96 test cases, the rules stopped all 19 proposals to move money without enough backing.

How it’s used

It runs as an HTTP service. A claim comes in through POST /api/triage with three things: an order number, what happened (arrived broken, arrived late, never arrived) and what the customer wrote. It returns the decision, the facts it used and a trace of everything it read.

From those three it looks up four things in the company’s system:

Then it picks one of four exits: send a replacement, refund, ask the customer for a photo or hand it to a person.

The first two move money or goods and cannot be taken back. The last two cost nothing. The rules further down are built on that difference.

Results

83%of cases, the right decision
2sto make the four reads and decide
0refunds without enough backing

The two seconds are the 95th percentile: nineteen out of twenty claims come back resolved faster than that, with the model running locally on an ordinary graphics card.

The zero means that money was never refunded on a case that needed a person. There are eleven rules between the model’s proposal and its execution, and any one of them is enough to stop it. The rules stopped all nineteen times, out of ninety-six, that the model proposed a refund on one of those cases.

19 proposals to move money on cases that needed a person across 96 test runs 11 rules 19 stopped by the rules and handed to a person
The strict rules cover refunds and replacements, which move money and goods. Asking the customer for a photo does not need them, because a question can always be taken back.

The rules that check the model

The model picks what to do. Eleven rules review that pick before it is executed. They check whether the amount is high, whether the customer has already claimed three times, whether the shipment is still moving, whether the last update is more than three days old, and whether any of the four facts is missing.

If the company’s system does not answer when asked for a customer’s history, handoff marks that fact as missing and the rule stops the decision. A history that could not be read counts as a missing fact, never as a customer with no previous claims.

The strict rules apply only to what is irreversible. The agent needs no certainty to ask the customer a question, so when it is unsure it can ask for a photo without handing the case to a person.

An ERP that answers badly

The ERP it runs against is simulated, and it is built to misbehave in ten specific ways, all taken from real integrations: it answers XML on one endpoint and JSON on the rest, expires the session halfway through a batch, cuts a response off at 60% and still reports it as successful, writes “no value” in five different ways, and has a status code whose meaning depends on a field that lives in a different call.

handoff resolves all ten before the model sees anything. Code handles whatever has exactly one correct answer, such as converting an amount, resolving a code or reading a date. Only what takes judgement reaches the model. When the system genuinely does not answer, the fact is marked missing and the rules treat it as a hole.

How it’s measured

The agent runs against 36 hand-written situations: 16 that must end with a person and 20 it should resolve on its own. Each one describes what happened. The correct answer lives in a separate file the agent has no way of reaching. Several sit right at the edge of a limit: an order of 149,900 against a ceiling of 150,000, a shipment 71 hours without news against a limit of 72, a customer with two claims against a rule that fires at three.

The model’s answers are recorded, and each recording is filed under a fingerprint of everything that was sent to it. A change that cannot affect the decision (a rename, a reordering) replays the recordings and costs nothing. A change that can affect it, even one word of the text sent to the model, invalidates them and forces a fresh measurement before it can be merged. This was verified both ways. Adding a single line to that text invalidated all 96 recordings and blocked the merge, and removing it turned them green again.

The two figures are published separately: 83% for the whole system, 67% for the model before the rules. The difference between them is what the rules contribute.