Fieldwork

Dynamic tool retrieval for vehicle control

In an in-car voice assistant, a single spoken command must be routed to the right API among more than 400 vehicle-control tools—and executed within seconds. I replaced the brute-force approach of loading every tool definition into the prompt with a multi-path dynamic retrieval pipeline, simultaneously slashing context length, latency, and tool-calling errors.

≈1/10Input context length relative to the baseline design
p90 < 5sEnd-to-end response latency
92%Target-tool recall within the 30-tool candidate set
50% → 88%Final tool selection and parameter-filling accuracy

Why full-context dumping failed

The initial baseline stuffed definitions for over 400 tools into a single prompt, exceeding 80,000 input tokens. Time-to-first-token alone often exceeded five seconds, and attention dilution across the massive prompt kept tool-calling accuracy around 50%. Because drivers cannot wait for multi-step reasoning loops, the highest-leverage intervention was shrinking the input before it ever reached the main model.

Multi-path retrieval grounded in spoken commands

Searching tool descriptions alone missed terse commands like "play music," while matching tool names failed when a phrase like "go home" actually mapped to a parameter inside a generic navigation API. I built a three-way retrieval pipeline spanning descriptions, tool names, and parameter schemas—identifying the primary functional domain first, blending in cross-domain candidates, and passing a deduplicated set of 30 tools to the main model.

Separating speed, recall, and execution

Input tokens dropped by roughly 90%, bringing end-to-end p90 latency under five seconds. Target-tool recall reached 92%, and end-to-end execution accuracy climbed from 50% to 88%.

Metric boundaries:Separating recall (92%) from final accuracy (88%) allowed us to isolate retrieval misses from model reasoning errors. Likewise, achieving p90 < 5s met our stage target but does not imply hard real-time guarantees for every tail request. Following this validation phase, the architecture was handed off to the delivery team.

Let’s talk

If you’re exploring an enterprise AI solution, working through an agent deployment problem, or looking for an AI product manager with LLM evaluation and delivery experience, get in touch about your scenario. I also welcome expert interviews and technical discussions in these areas.