Agents as the last mile: matching classic-car listings without letting the LLM drive
Every classic-car listing has to end up on exactly one taxonomy id: make, model, family, generation, variant. The input looks like this: porsche, 991 SPEEDSTER 4.0 CARBO-LIFTING-NAVI, 2019. The answer should be 911 991 Speedster. Multiply that by dozens of sources, thousands of models, and sellers who write whatever they like.
An LLM could probably guess most of these. But guessing is the problem. A wrong match quietly corrupts price statistics, and nobody notices until a client does. So the design rule was: deterministic where possible, agents only where the information is in free text, and a human for whatever is left.
The pipeline, cheapest step first
- Similarity matcher. The neural network only knows model names from training. A new string has to be mapped to a known one first. Fuzzy and Jaccard scores plus hand-written rules pick the closest training name and mark whether the match is confident.
- Hierarchical neural network. Trained per make. It predicts model, then family, generation, and variant. Each level only allows values that are valid under the level above, because a Porsche cannot have a BMW model. Combining the probabilities gives a score for every valid taxonomy id.
- Agent steps. If one candidate clearly wins, done. If not, the remaining candidates go to the agents.
Most listings never reach an LLM. That keeps cost down and makes the bulk of the decisions explainable with numbers.
Why I did not use an agent framework here
The orchestration is mostly a fixed sequence with a few branches. LangGraph or a similar framework would have added a dependency and a second mental model without solving anything. Instead each agent step is a Python class with a typed input, a typed Pydantic output, a small set of tool functions, and a loop limit. The orchestrator is a function that calls stages in order and branches on confidence.
This also made testing simple. Every stage runs standalone from the command line, and the deploy script runs the inference tests first and stops on failure.
The agent steps
Description agent. It gets the listing description and the remaining taxonomy candidates. Its tools: look up a candidate's details, check whether the listing year fits a candidate's production range, and compare two candidates on their distinguishing features. It returns a winner, a confidence, its reasoning, and the evidence from the text. Some taxonomies are marked "year not meaningful", and the tool respects that instead of rejecting good matches.
Verifier agent. A second, cheaper model checks the decision against hard rules: the year range, the make/model hierarchy, and whether the cited evidence actually appears in the description. If it disagrees, the listing is not forced through. It goes to review.
Escalation. Not-confident listings land in a review table with the reason attached. In Retool a reviewer accepts, corrects, or parks them. Accepted reviews become training data, so the next training run learns from them.
The inspector: an agent that explains failure
The hardest questions came after launch: why is this make suddenly not confident? Why does Chevrolet get no LLM matches at all?
The inspector agent runs outside the inference path. It reads the not-confident predictions and the training data, groups them by model and year, and classifies the cause: too much noise in the model name, a wrong year, an under-represented model, two taxonomies conflicting for the same model and year, or a failure in the description step. For each cluster it proposes the action: generate synthetic data for under-represented models, send a batch to review, or flag a conflict for someone to resolve.
That is how the Chevrolet case was found. The problem was not the LLM at all. It was the component that created synthetic training data. Without the inspector it would have looked like a model problem.
Keeping quality
- Strict structured outputs. A response that does not parse is treated as no answer, never as a guess.
- Every AI decision is traced with its input candidates, its reasoning, and its verdict.
- Confidence ratios per make are tracked in Looker, so a drop shows up before a client sees it.
- Human review closes the loop: corrections go back into training.
- The pipeline also runs as an API on Cloud Run, so a single listing can get a fast prediction for internal use. Slow components are pre-loaded or pre-calculated for that path.
Takeaway
Agents were the last mile, not the engine. The numbers do the bulk of the work. Agents read the text the numbers cannot. A human handles the rest. Keeping the orchestration in plain code made each of those boundaries visible.