How it works
After every model reply and every tool result, harness code tests a list of rules. A finish tool, such as post_invoice, is one rule. A step budget is another. So is the same action repeated, a streak of tool errors, or a token budget on the whole run. The first matching rule ends the loop and records which rule fired. The model is not born knowing these rules. It hears them only when the harness copies them into the prompt or into a tool result, and even then the code, not the model, enforces them.
On supplier invoices the finish tool is post_invoice. A successful suggest_codes result is not a stop, because coding without posting leaves the invoice open. A second suggest_codes with the same invoice id can match the repeated-action rule and stop the loop even though the model wanted another try. A token budget can stop the run while the step count is still low. Those are different rules, and the trace should name the one that fired rather than a vague end of turn.
A worked example
Supplier invoice coding
A clerk asks the agent to code and post supplier invoice INV-4401 from Northmill Paper.
The model calls fetch_invoice with INV-4401. The tool returns a net of 860 pounds, VAT and a PDF already stored. The stop check does not fire.
The model calls suggest_codes. The tool returns nominal 5010 and cost centre LEEDS. That result is appended. The finish-tool rule still does not match, because nothing has been posted.
The model calls post_invoice with INV-4401, nominal 5010 and cost centre LEEDS. The tool returns posted and journal J-4401.
The finish-tool rule matches. The loop ends. The reply quotes J-4401. A token counter and a step counter are both still under their caps, so the trace shows the finish tool as the rule that stopped the run.
Illustrative example, not a production trace and not a measured result.
What goes wrong
- The model says the invoice is posted, the harness has no finish-tool rule, and the loop keeps calling suggest_codes until the step budget cuts it off with the invoice still open.
- The repeated-action rule compares raw argument strings, so suggest_codes with a trailing space looks new, and the same coding suggestion is fetched until the token budget ends the run.
- Three post_invoice errors in a row should match the error-streak rule, but the rule is not configured, and the model keeps posting INV-4401 until a duplicate journal appears.
How to measure it
On every stopped invoice run, record the rule name that ended it: finish tool, step budget, repeated action, tool-error streak or token budget. A run the model called done, with no post_invoice success, is not a finish-tool stop.
Read the message list at the stop and note whether the rule text was ever shown to the model. If the model was never told, a late surprise stop is the harness enforcing a rule the model could not see.
Further reading
How Abracadabra helps
The clerk says the supplier invoice is still unposted, or asks why coding stopped halfway, after the assistant had already said the journal was written.
Abracadabra reads each conversation and labels the task, the step where it stopped, and signals such as repeated intents, user corrections and abandonment, pinned to the turn. After you change this part of the harness, compare task success for that task and cohort with the previous period. Experimentation and guarded rollouts are in early access.
Request access to read this on your own agent.