Project lab
Intent routing, AZMDR style (conceptual)
Sort each incoming request into a bucket. Then send it to plain code, a specialist step, or a human. This is a learning example only. Do not touch AZMDR repos.
curl
bash
curl -X POST https://api.typesafe.ai/v1/systemone \
-H "Authorization: Bearer $TYPESAFE_API_KEY" \
-H "Content-Type: application/json" \
-d @- <<'EOF'
{
"state": {
"channel": "web_form",
"message": "I need my monthly report regenerated for last quarter and emailed to finance."
},
"model": "jev-latest",
"questions": {
"intent": {
"type": "choice",
"instructions": "What is the primary request type?",
"criteria": {
"report": "Generate or regenerate a report",
"access": "Account or permission change",
"bug": "Something is broken",
"other": "Does not fit the above"
}
},
"needs_human": {
"type": "noul",
"instructions": "Should a human review before acting?"
}
}
}
EOFJavaScript
js
const key = process.env.TYPESAFE_API_KEY;
if (!key) throw new Error("TYPESAFE_API_KEY is not set");
const state = {
channel: "web_form",
message:
"I need my monthly report regenerated for last quarter and emailed to finance.",
};
const res = await fetch("https://api.typesafe.ai/v1/systemone", {
method: "POST",
headers: {
Authorization: `Bearer ${key}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
state,
model: "jev-latest",
questions: {
intent: {
type: "choice",
instructions: "What is the primary request type?",
criteria: {
report: "Generate or regenerate a report",
access: "Account or permission change",
bug: "Something is broken",
other: "Does not fit the above",
},
},
needs_human: {
type: "noul",
instructions: "Should a human review before acting?",
},
},
}),
});
if (!res.ok) throw new Error(`HTTP ${res.status}`);
const { answers } = await res.json();
const intent = answers.intent.choice;
const conf = answers.intent.confidence;
const human = answers.needs_human.noul;
if (human > 0.6 || conf < 0.55) console.log("route: human_queue", { intent, conf, human });
else if (intent === "report") console.log("route: report_pipeline", { intent });
else console.log("route: specialist", { intent });Notes
- This is a concept lab only. It uses AZMDR-style request routing as a learning example.
- The pattern is intent routing: classify first, then hand off to code, an LLM, or a human.