Built-in tools
builtin__rank
Ranks a whole list against a question in one decision-model call.
Behavior
- The items become the options of one
choicequestion,stateis the context they're judged against, andinstructionsis the question. - Each option shows the item's
describefield, or the whole item whendescribeis absent. itemsis the list sorted by probability, highest first, andrankedpairs each item with its probability. Both are cut totop_k.- Options are shown in a shuffled order seeded from the items, since decision models lean toward the first options. The same list ranks the same way on a rerun.
noneadds a "nothing fits" option. Its probability comes back asnone, andno_fitis true when it beats every item.- Lists over 254 items are ranked in chunks sent together, and each chunk's best meet in a final choice. Items that don't reach the final choice follow the finalists with a
nullprobability. - Needs a decision model role,
deciderby default.
When to use it
- Reranking search results, candidates or options against a question: one call instead of one per item, and no LLM.
- Keep
stateto what the question needs: the question and its context, not the items. - For an absolute yes or no per item rather than an order, use a
filterstep with adecidegate.
| Available to | Effect |
|---|---|
| Any agent or plan step | Read-only |
Input
describestring
Dot path into each item to show as the option, e.g. url or meta.date
The choice question
The list, usually a template like {{E1.results}}
modelstring
The decision model role; default decider
nonestring
Text of a 'nothing fits' option
The context the items are judged against, e.g. {"question": "{{input.question}}"}
top_kinteger
Keep only the best k
Output
no_fitboolean
nonenumber
- id: E1
tool_name: builtin__rank
input:
state: "{{input.state}}"
items: "{{input.items}}"
instructions: "{{input.instructions}}"