Decision Model
Last updated
A fast classifier model, served by TypeSafe or OpenRouter, that answers typed questions for dispatch, watch checks and content filtering.
The decision model (
internal/agents/decision) is not a chat model: it receives a JSON state plus a set of multiple-choice questions and returns one choice per question with a confidence. It has two providers, typesafe and openrouter. The choices are listed live: TypeSafe from its own models API, OpenRouter from the models that report a decisions output modality, minus five OpenRouter models Agenvoy excludes because their input format differs. Each provider's list is cached for 15 minutes (TTL_MODELS_CACHE_SEC) and dropped when that provider's key is saved, its OAuth completes or its login is cleared. The selection is stored as decision_model in config.json as <provider>@<model>; empty or off means off.Set it up in two steps. First store a key: TypeSafe is a row in the API Key tab of
/model add (o opens https://console.typesafe.ai/keys); saving its key stores TYPESAFE_API_KEY and stops there, with no model list to pick from. OpenRouter uses the same OPENROUTER_API_KEY as its chat models. Over HTTP, POST /v1/provider/typesafe/key stores the key. Then pick the model in /model → decision (disable is listed first and clears it), in the web model settings under Decision, or with POST /v1/model {decision}; a value not in decision_options returns 400.Each call has 3 seconds (
TIMEOUT_DECISION_CALL). The request text is cut at 2,048 runes (MAX_DECISION_RUNES); questions over many items are split into batches of at most 120 questions (MAX_DECISION_QUESTIONS) and about 20,000 runes of state (MAX_DECISION_STATE_RUNES). Except for the skill filter, a judgment takes effect only when its confidence is at least 0.7 (DECISION_MIN_CONFIDENCE, watch checks included); a failed or timed-out call leaves the content as it was.What uses it
| Use | What the decision model decides |
|---|---|
| Dispatch | Work kind, a model named in the request, and whether the subject continues (see Decision Model Dispatch) |
| Watch checks | Whether background_command output flagged by an error keyword shows a real error, and whether it only repeats the last report; a benign or repeated hit is not reported, and a failed call reports it unchecked with a note. Without a decision model every hit is reported. The interval/prompt watch of run_command_background and run_websocket was Removed in v1.3.2 |
search_web | Drops results that do not bear on the request; when none is left, the tool says so and asks for a better query |
fetch_page | Removes noise blocks from a fetched markdown page (up to 1 MiB, not fetched with keep_links) before it is cached. Since v1.3.17 it filters every delivery, fresh or cached, against the request: a page that fits in one call is judged whole and withheld when it does not bear on the request, a longer markdown or json page keeps only its related blocks (at most 8 batches judged at once, MAX_DECISION_PARALLEL), and a page over 1 MiB keeps only blocks from its first 1 MiB that state the answer. Measured on fetch_page Filtering Benchmark |
read_files / chat_history | Since v1.3.21, read_files judges a result under 16,384 runes whole and withholds it when it does not bear on the request; a longer result is checked block by block, each unrelated run replaced by a row-range marker, and withheld when no block is related. full: true bypasses the check, and write_file refuses content that still carries a marker. Measured results: read_files Filtering Benchmark. chat_history in mode=read checks the whole result at 16,384 runes or more and withholds the same task at most once per session |
| Turn context | Adds a tool-gap hint pointing to reasoning_guide(topics=["tool_generate"]) when no tool covers the request, and hides skills it does not judge relevant from the skill list |
| Session summary | Drops noise exchanges and outdated key_decisions / past_discussions entries before the summary is merged; since v1.3.7 it also keeps only the key_decisions / past_discussions / current_discussion entries relevant to the request (general rules on language, format or workflow count as relevant) when the summary is injected into the turn context, keeping every entry when the call fails and leaving the summary out when none is relevant |
| Context overflow | Before the oldest-first trim, prunes tool steps the request no longer needs |