perf(reply): v2 turns with one one-step tool skip the planner
When the router's only pick is a tool that does its job in one call (getWeather, logMeal, fetchMeals, screenView) and the chat model calls tools natively, the planner no longer runs: on Strata it averaged 2.5 s per tool turn (2026-11-16 16:45-16:58 engine log, 9 calls) before the answer could start. Search, browsers, schedule, notes, chat channels and picks of two or more tools still plan. The rule reads the router's pick, not the words, so it is language-agnostic. Without a plan the skipped-tool guard has nothing to run, so these turns get one nudge instead: an answer given before any tool ran is dropped and the model is asked to call the tool (or ask for a missing detail). Evals (qwen3:8b, EVAL_COMPACT_PROMPT=1 EVAL_INTENT_JUDGE=1, 3 runs of tool_skip_confabulation, weather_autoderive_location, screen_view_tool, followup_supplies_missing_tool_arg, tool_router_implicit): 71/84 before, 72/84 after, same known failures; planner calls 14 -> 3. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -222,6 +222,26 @@ needs the planner to name the channel); its every-turn offer, added after the ro
|
||||
to its answer with one LLM call before it; a tool turn keeps the planner's ordered steps, which
|
||||
multi-step asks need ("who directed Possessor, and what else did they make").
|
||||
|
||||
**One-step turns.** When the router's only pick (sentinels aside) is a tool that does its job in one
|
||||
call, `_ONE_STEP_TOOLS` in `engine.py` (`getWeather`, `logMeal`, `fetchMeals`, `screenView`), and the
|
||||
chat model calls tools natively, the planner does not run: its steps would only repeat the one call
|
||||
the chat model makes itself. The rule reads the router's pick, never the words, so it is language-
|
||||
agnostic. Tools a request may use several times or chain stay planned: search and page fetches,
|
||||
the browsers, `schedule` and `personalNotes` (a list before a change), `chatChannels`. Two or more
|
||||
picked tools are planned as before. Text-tool mode (small non-native models) always plans, since its
|
||||
direct execution runs the plan.
|
||||
|
||||
Without a plan the skipped-tool guard above has nothing to run, so these turns get a nudge instead:
|
||||
when the chat model answers in words before any tool ran in this reply, the answer is dropped (no
|
||||
later turn sees it) and a note asks the model to call that tool first, or to ask the user for a
|
||||
missing detail. The nudge is sent at most once per reply; a second answer without the tool (a
|
||||
question back to the user, say) is delivered.
|
||||
|
||||
Measured on Strata (Qwen3.6, 2026-11-16 16:45-16:58, the engine log): the planner averaged 2.5 s
|
||||
(9 calls), one after the other before the answer on every tool turn, while the router runs during
|
||||
speech (`prepare_intent`). A planner call that does not run also leaves the engine's second session
|
||||
to the chat model, whose prompt read is the largest cost.
|
||||
|
||||
Measured on Strata (Qwen3.6, 2026-11-12): the router took 0.42 s and the planner 0.49-0.94 s, one
|
||||
after the other, before every answer; each call costs at least one full prompt read. Tried first
|
||||
and dropped: the planner alone over the whole catalogue (one call) planned "reply with the
|
||||
|
||||
Reference in New Issue
Block a user