mirror of
https://github.com/HKUDS/DeepTutor.git
synced 2026-12-02 09:13:43 +08:00
A capability that makes several different LLM calls cannot be described by one max_tokens: the step emitting a whole JSON plan and the step writing one paragraph need different room. `chat` has said so since it grew `exploring`/`responding`. `question` and `research` said the same thing in module constants instead, where no user could reach them. The cost of that was not theoretical. `capabilities.question.max_tokens` governed exactly one of question's six LLM calls — the follow-up agent — while the pipeline's five steps used constants that ignored it. The plan step's constant sat below the capability's own ceiling, which is how #1318 shipped a step that could spend its whole allowance thinking and emit zero templates without an error. `EXPLORE_FINISH_MAX_TOKENS` had been dead since it was written. Generalises the seam that already worked rather than adding a parallel one: `get_chat_params` becomes `get_capability_params(capability)` over a table of per-stage defaults, and `question`, `research` and `explore_context` get tables of their own holding the numbers they already ran on. The pipelines resolve once in `__init__` beside the budget they already cached. Unknown keys are dropped, so a misspelled stage cannot become a silent no-op that reads like a setting. The rule this establishes, stated in the tables: **agents.yaml owns every LLM budget** (temperature, max_tokens, per stage); **main.yaml owns runtime behaviour** (iteration caps, timeouts, retry policy, modes). A budget in main.yaml is a bug. `tool_summarizer.max_tokens` still reads its main.yaml value first so nobody's existing configuration moves; new installs reach the same number through agents.yaml like everything else. GraphRAG's reachability probe is the one documented exemption — tuning it could only make a health check lie. Seeds are derived from the same tables the pipelines read, because two lists of the same numbers is how a default and its seed drift apart — the shape of #1316. Tests pin both halves: the shipped values, and that every stage in code is present in the seeded file. No behaviour change: every default is the constant it replaced. 6902 passed, 24 skipped.