Routing ~50 tools for a local agent: three failed approaches and a GBNF fix

paulqq · reddit · 2026-09-09

The author built a hobby local-first agent in Rust (llama.cpp, runs on a 14B model, Obsidian vault as memory). The hardest part wasn't the model — it was deciding which of 50 tools the model may call each turn. Three phases, each wrong at first:

Key lesson for small local models: feed the same offered-tools list to both the prompt and the GBNF grammar so they can never disagree on what's callable; when the router isn't confident, hand the grammar a small related set and let the model pick within the constraint. Full writeup includes Rust snippets.

Original post →

More from coding & agent

coding & agent channel →