cookbook · Decider 1 · Support inbox triage
Route a support email in one call
Routing a support email usually needs several separate calls, one per field, which adds latency and cost. This recipe routes the email with a single Decider 1 call that asks three typed questions: which team (choice), how urgent (score, 4 levels), and whether a refund is requested (noul).
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": {
"channel": "email",
"messages": [
{
"from": "customer",
"text": "Hi, the export button has been greyed out since yesterday'\''s update and I have a board meeting at 3pm where I need this report. Can someone look at it now?"
}
]
},
"questions": {
"team": {
"type": "choice",
"instructions": "Which team should handle this?",
"criteria": {
"billing": "Charges, invoices, payments and refunds.",
"technical": "The product is not working as expected.",
"account": "Login, plan changes and access."
}
},
"urgency": {
"type": "score",
"instructions": "How urgent is this?",
"criteria": [
"Can wait a week",
"Within a few days",
"Today",
"Immediately"
]
},
"refund_requested": {
"type": "noul",
"instructions": "Is the customer asking for money back?"
}
}
}'What came back
The real output from running this recipe, unedited.
{
"answers": {
"team": {
"type": "choice",
"choice": "technical",
"confidence": 0.8969,
"probabilities": {
"billing": 0.017,
"technical": 0.8969,
"account": 0.0862
}
},
"urgency": {
"type": "score",
"score": 2.1852,
"confidence": 0.4393,
"legend": {
"0": "Can wait a week",
"1": "Within a few days",
"2": "Today",
"3": "Immediately"
},
"probabilities": {
"0": 0.0343,
"1": 0.1854,
"2": 0.341,
"3": 0.4393
}
},
"refund_requested": {
"type": "noul",
"noul": 0.0975
}
}
}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": {
"channel": "email",
"messages": [
{
"from": "customer",
"text": "Hi, the export button has been greyed out since yesterday's update and I have a board meeting at 3pm where I need this report. Can someone look at it now?"
}
]
},
"questions": {
"team": {
"type": "choice",
"instructions": "Which team should handle this?",
"criteria": {
"billing": "Charges, invoices, payments and refunds.",
"technical": "The product is not working as expected.",
"account": "Login, plan changes and access."
}
},
"urgency": {
"type": "score",
"instructions": "How urgent is this?",
"criteria": [
"Can wait a week",
"Within a few days",
"Today",
"Immediately"
]
},
"refund_requested": {
"type": "noul",
"instructions": "Is the customer asking for money back?"
}
}
}).json()
answers = r["answers"]
team = answers["team"]
if team["confidence"] >= 0.8:
print("route to", team["choice"])
else:
print("send to the shared queue")
print("urgency levels:", answers["urgency"]["probabilities"])
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": {
"channel": "email",
"messages": [
{
"from": "customer",
"text": "Hi, the export button has been greyed out since yesterday's update and I have a board meeting at 3pm where I need this report. Can someone look at it now?"
}
]
},
"questions": {
"team": {
"type": "choice",
"instructions": "Which team should handle this?",
"criteria": {
"billing": "Charges, invoices, payments and refunds.",
"technical": "The product is not working as expected.",
"account": "Login, plan changes and access."
}
},
"urgency": {
"type": "score",
"instructions": "How urgent is this?",
"criteria": [
"Can wait a week",
"Within a few days",
"Today",
"Immediately"
]
},
"refund_requested": {
"type": "noul",
"instructions": "Is the customer asking for money back?"
}
}
}),
}).then((res) => res.json());
const team = r.answers.team;
console.log(team.confidence >= 0.8 ? `route to ${team.choice}` : "send to the shared queue");
When to trust it
Route on the team when its probability is high, as in the example where technical scored 0.90. The urgency score is a spread, so read the top two levels rather than just the argmax; here 'Immediately' was 0.44 and 'Today' was 0.34, giving an expected level of 2.19 on the 0-3 scale.
Try it without code in the playground, or see more Decider 1 recipes: act only when the model is sure, flag a phishing email, drop retrieved passages that do not help, hold a reply that promises money, pick an agent's first tool, ask many questions in one call.