cookbook · Decider 1 · Agent routing and skill selection
Pick an agent's first tool
Routing an agent's first tool call usually requires an LLM call, adding latency and cost to every request. This recipe replaces that step with a choice question, letting the model score candidate tools directly. For example, "Move my 3pm with Dana to tomorrow morning and let her know" returns calendar_update 0.83, send_email 0.09, none 0.06, crm_lookup 0.02, web_search 0.005.
Request
POST /v1/systemone, documented in the Decider 1 reference.
curl https://meragpt.com/v1/systemone \
-H "Authorization: Bearer $MERAGPT_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "sd-1",
"state": {
"user_request": "Move my 3pm with Dana to tomorrow morning and let her know."
},
"questions": {
"tool": {
"type": "choice",
"instructions": "Which tool should the agent call first?",
"criteria": {
"calendar_update": "Create, move or cancel calendar events.",
"send_email": "Send an email to someone.",
"web_search": "Look something up on the web.",
"crm_lookup": "Find a customer or contact record.",
"none": "No tool is needed."
}
}
}
}'What came back
The real output from running this recipe, unedited.
{
"answers": {
"tool": {
"type": "choice",
"choice": "calendar_update",
"confidence": 0.8287,
"probabilities": {
"calendar_update": 0.8287,
"send_email": 0.0852,
"web_search": 0.0046,
"crm_lookup": 0.0214,
"none": 0.0601
}
}
}
}Python
import os, requests
API = "https://meragpt.com/v1"
HEADERS = {"Authorization": f"Bearer {os.environ['MERAGPT_API_KEY']}"}
r = requests.post(f"{API}/systemone", headers=HEADERS, json={
"model": "sd-1",
"state": {
"user_request": "Move my 3pm with Dana to tomorrow morning and let her know."
},
"questions": {
"tool": {
"type": "choice",
"instructions": "Which tool should the agent call first?",
"criteria": {
"calendar_update": "Create, move or cancel calendar events.",
"send_email": "Send an email to someone.",
"web_search": "Look something up on the web.",
"crm_lookup": "Find a customer or contact record.",
"none": "No tool is needed."
}
}
}
}).json()
tool = r["answers"]["tool"]
if tool["confidence"] >= 0.7:
print("call", tool["choice"])
else:
print("fall back to the LLM planner")
TypeScript
const API = "https://meragpt.com/v1";
const headers = {
Authorization: `Bearer ${process.env.MERAGPT_API_KEY}`,
"Content-Type": "application/json",
};
const r = await fetch(`${API}/systemone`, {
method: "POST",
headers,
body: JSON.stringify({
"model": "sd-1",
"state": {
"user_request": "Move my 3pm with Dana to tomorrow morning and let her know."
},
"questions": {
"tool": {
"type": "choice",
"instructions": "Which tool should the agent call first?",
"criteria": {
"calendar_update": "Create, move or cancel calendar events.",
"send_email": "Send an email to someone.",
"web_search": "Look something up on the web.",
"crm_lookup": "Find a customer or contact record.",
"none": "No tool is needed."
}
}
}
}),
}).then((res) => res.json());
const tool = r.answers.tool;
console.log(tool.confidence >= 0.7 ? `call ${tool.choice}` : "fall back to the LLM planner");
When to trust it
Use up to 10 options per question and describe each tool in one plain sentence. When the top option falls below your threshold, fall back to your LLM planner.
Try it without code in the playground, or see more Decider 1 recipes: route a support email in one call, act only when the model is sure, flag a phishing email, drop retrieved passages that do not help, hold a reply that promises money, ask many questions in one call.