Agent tool selection from labelled options
Selects the next tool from tools supplied as labelled options with descriptions. Can also indicate that the agent should answer directly or ask the user for missing information.
Example
Context
- agent
- A travel desk assistant for a consulting firm that books trains and hotels for staff and checks the travel policy.
- conversation
- - {"role":"user","text":"I'm going to the Leeds workshop next week."} - {"role":"assistant","text":"Great. Do you need travel or a hotel booked?"}
Input
Yes, please book me a hotel in Leeds for Tuesday and Wednesday night.
Labels (the options)
- book_train
- Books a train ticket for a traveller, given the route, date and time.
- book_hotel
- Books a hotel room for a traveller, given the city or address and the nights.
- check_policy
- Looks up what the firm's travel policy allows (classes of travel, nightly hotel limits).
- cancel_booking
- Cancels an existing booking by its reference.
- Answer (JSON)
- value book_hotel, confidence 0.889
- Top options
- book_hotel 0.889
- ask_user 0.109
- check_policy 0.001
The user asks for a hotel to be booked, so the tool to call next is book_hotel.
import os import jeff with jeff.Jeff.remote("https://api.jeffhub.ai", token=os.environ["JEFF_API_KEY"], timeout_s=30) as client: decide = client.function("jeff.routing.tools.tool", context={ "agent": "A travel desk assistant for a consulting firm that books trains and hotels for staff and checks the travel policy.", "conversation": [ { "role": "user", "text": "I'm going to the Leeds workshop next week.", }, { "role": "assistant", "text": "Great. Do you need travel or a hotel booked?", }, ], }, labels={ "book_train": "Books a train ticket for a traveller, given the route, date and time.", "book_hotel": "Books a hotel room for a traveller, given the city or address and the nights.", "check_policy": "Looks up what the firm's travel policy allows (classes of travel, nightly hotel limits).", "cancel_booking": "Cancels an existing booking by its reference.", }) decision = decide("Yes, please book me a hotel in Leeds for Tuesday and Wednesday night.") print(decision.value, decision.confidence)
More examples
Book the 7:10 train to Leedsanswer book_train · confidence 0.992
Context
- agent
- A travel desk assistant for a consulting firm that books trains and hotels for staff and checks the travel policy.
- conversation
Input
Please book me the 7:10 train from London to Leeds next Tuesday, returning on the 18:30 on Wednesday.
Labels (the options)
- book_train
- Books a train ticket for a traveller, given the route, date and time.
- book_hotel
- Books a hotel room for a traveller, given the city or address and the nights.
- check_policy
- Looks up what the firm's travel policy allows (classes of travel, nightly hotel limits).
- cancel_booking
- Cancels an existing booking by its reference.
- Answer (JSON)
- value book_train, confidence 0.992
- Top options
- book_train 0.992
- ask_user 0.007
- answer_directly 0
The user gives the route, the day and both train times, so the tool to call is
book_train.import os import jeff with jeff.Jeff.remote("https://api.jeffhub.ai", token=os.environ["JEFF_API_KEY"], timeout_s=30) as client: decide = client.function("jeff.routing.tools.tool", context={ "agent": "A travel desk assistant for a consulting firm that books trains and hotels for staff and checks the travel policy.", "conversation": [], }, labels={ "book_train": "Books a train ticket for a traveller, given the route, date and time.", "book_hotel": "Books a hotel room for a traveller, given the city or address and the nights.", "check_policy": "Looks up what the firm's travel policy allows (classes of travel, nightly hotel limits).", "cancel_booking": "Cancels an existing booking by its reference.", }) decision = decide("Please book me the 7:10 train from London to Leeds next Tuesday, returning on the 18:30 on Wednesday.") print(decision.value, decision.confidence)
May I travel first class?answer check_policy · confidence 0.965
Context
- agent
- A travel desk assistant for a consulting firm that books trains and hotels for staff and checks the travel policy.
- conversation
Input
Am I allowed to travel first class on a trip longer than three hours?
Labels (the options)
- book_train
- Books a train ticket for a traveller, given the route, date and time.
- book_hotel
- Books a hotel room for a traveller, given the city or address and the nights.
- check_policy
- Looks up what the firm's travel policy allows (classes of travel, nightly hotel limits).
- cancel_booking
- Cancels an existing booking by its reference.
- Answer (JSON)
- value check_policy, confidence 0.965
- Top options
- check_policy 0.965
- ask_user 0.028
- answer_directly 0.003
The user asks what the travel policy allows, so the tool to call is
check_policy.import os import jeff with jeff.Jeff.remote("https://api.jeffhub.ai", token=os.environ["JEFF_API_KEY"], timeout_s=30) as client: decide = client.function("jeff.routing.tools.tool", context={ "agent": "A travel desk assistant for a consulting firm that books trains and hotels for staff and checks the travel policy.", "conversation": [], }, labels={ "book_train": "Books a train ticket for a traveller, given the route, date and time.", "book_hotel": "Books a hotel room for a traveller, given the city or address and the nights.", "check_policy": "Looks up what the firm's travel policy allows (classes of travel, nightly hotel limits).", "cancel_booking": "Cancels an existing booking by its reference.", }) decision = decide("Am I allowed to travel first class on a trip longer than three hours?") print(decision.value, decision.confidence)
Cancel a booking with no referenceanswer ask_user · confidence 0.999
Context
- agent
- A travel desk assistant for a consulting firm that books trains and hotels for staff and checks the travel policy.
- conversation
- - {"role":"user","text":"I have three trips booked this month."} - {"role":"assistant","text":"I can see them. What would you like to do?"}
Input
Cancel one of them, please.
Labels (the options)
- book_train
- Books a train ticket for a traveller, given the route, date and time.
- book_hotel
- Books a hotel room for a traveller, given the city or address and the nights.
- check_policy
- Looks up what the firm's travel policy allows (classes of travel, nightly hotel limits).
- cancel_booking
- Cancels an existing booking by its reference.
- Answer (JSON)
- value ask_user, confidence 0.999
- Top options
- ask_user 0.999
- answer_directly 0
- check_policy 0
The user wants one of three trips cancelled without saying which, so the agent must
ask_user.import os import jeff with jeff.Jeff.remote("https://api.jeffhub.ai", token=os.environ["JEFF_API_KEY"], timeout_s=30) as client: decide = client.function("jeff.routing.tools.tool", context={ "agent": "A travel desk assistant for a consulting firm that books trains and hotels for staff and checks the travel policy.", "conversation": [ { "role": "user", "text": "I have three trips booked this month.", }, { "role": "assistant", "text": "I can see them. What would you like to do?", }, ], }, labels={ "book_train": "Books a train ticket for a traveller, given the route, date and time.", "book_hotel": "Books a hotel room for a traveller, given the city or address and the nights.", "check_policy": "Looks up what the firm's travel policy allows (classes of travel, nightly hotel limits).", "cancel_booking": "Cancels an existing booking by its reference.", }) decision = decide("Cancel one of them, please.") print(decision.value, decision.confidence)
Question the conversation already answersanswer answer_directly · confidence 1
Context
- agent
- A travel desk assistant for a consulting firm that books trains and hotels for staff and checks the travel policy.
- conversation
- - {"role":"user","text":"Book me a hotel in Leeds for Tuesday night."} - {"role":"assistant","text":"Done. You are booked at the Canal Wharf Hotel, Leeds, for Tuesday 10 November, reference HB-55102."}
Input
Sorry, what was the name of the hotel again?
Labels (the options)
- book_train
- Books a train ticket for a traveller, given the route, date and time.
- book_hotel
- Books a hotel room for a traveller, given the city or address and the nights.
- check_policy
- Looks up what the firm's travel policy allows (classes of travel, nightly hotel limits).
- cancel_booking
- Cancels an existing booking by its reference.
- Answer (JSON)
- value answer_directly, confidence 1
- Top options
- answer_directly 1
- ask_user 0
- book_hotel 0
The hotel's name is already in the conversation, so no tool is needed and the answer is
answer_directly.import os import jeff with jeff.Jeff.remote("https://api.jeffhub.ai", token=os.environ["JEFF_API_KEY"], timeout_s=30) as client: decide = client.function("jeff.routing.tools.tool", context={ "agent": "A travel desk assistant for a consulting firm that books trains and hotels for staff and checks the travel policy.", "conversation": [ { "role": "user", "text": "Book me a hotel in Leeds for Tuesday night.", }, { "role": "assistant", "text": "Done. You are booked at the Canal Wharf Hotel, Leeds, for Tuesday 10 November, reference HB-55102.", }, ], }, labels={ "book_train": "Books a train ticket for a traveller, given the route, date and time.", "book_hotel": "Books a hotel room for a traveller, given the city or address and the nights.", "check_policy": "Looks up what the firm's travel policy allows (classes of travel, nightly hotel limits).", "cancel_booking": "Cancels an existing booking by its reference.", }) decision = decide("Sorry, what was the name of the hotel again?") print(decision.value, decision.confidence)
Use when
- Your agent supplies its tools as labelled options and needs to choose its next action.
- Low-confidence tool selections should be referred to a larger model.
Avoid when
- You need to generate tool arguments; this adapter selects a tool without constructing the call.
- You need a complete sequence of tool calls; this adapter selects one step at a time.
Context and input
| Field | Kind | Description |
|---|---|---|
user_message | input | The user's latest message, as plain text. |
agent | context | What the agent is for, in one or two sentences (for example a triage assistant that checks entitlements before routing tickets). |
conversation | context | The conversation so far, a list of turns, each {role (user or assistant), text}. |
Functions
| Key | Interface | Instructions | Labels |
|---|---|---|---|
| tool | route | Which tool should the agent call next to handle the user's latest message? Use the conversation for context. If no tool is needed, choose answer directly. If a tool is needed but information it requires is missing, choose ask the user. | from the caller |
How it was measured
Test accuracy: the share of test rows whose top answer was right.
- 97.1% on the in-house test (5,157 rows). in-house: same generator as the training data
When confident
From the calibration set: at or above the threshold confidence, how often the answer is right, and how often the adapter is that confident. Below it, escalate.
| Function | Right when confident | Confident on | Threshold | Calibration rows |
|---|---|---|---|---|
| tool | 97.6% | 100.0% | 0.27 | 2,195 |
Caveats
- This figure does not include public function-calling benchmarks.
Base: Jeff v1.4. Adapter trained: 25 October 2026.
Base
jeff-base v1.4
Call it
jeff.routing.tools.tool, with placeholders for its input and context.
import os import jeff with jeff.Jeff.remote("https://api.jeffhub.ai", token=os.environ["JEFF_API_KEY"], timeout_s=30) as client: decide = client.function("jeff.routing.tools.tool", context={ "agent": "<agent>", "conversation": "<conversation>", }) decision = decide("<user_message>") print(decision.value, decision.confidence)
Download
Weights: mstrasser/jeff-adapter-tools (v1.4)
Licence: Apache-2.0