Skip to content

DocsStart

4 min read · updated

Call it from a framework

Point LangChain, the Vercel AI SDK, n8n, TanStack AI or Pipecat at decisio and get a probability for every option. Each program below was checked against a running server.

Pick your framework below, set its base URL, and run the program. Each one asks two questions about one ticket and prints the answers. For plain HTTP, see Call it from your code.

LangChain

pip install langchain-typesafe==0.0.1a3 (checked at that version; it prints a beta warning).

python
from langchain_typesafe import Choice, Noul, NoulCriteria, TypeSafeClassifier
clf = TypeSafeClassifier(base_url="http://127.0.0.1:8000", api_key="not-used")
result = clf.invoke(
{
"state": {"message": "My card was charged twice."},
"questions": {
"queue": Choice(instructions="Which queue?", criteria={"billing": "Payments", "access": "Login problems"}),
"urgent": Noul(instructions="Is it urgent?", criteria=NoulCriteria(true="needs an answer today", false="can wait")),
},
}
)
print(result.answers["queue"].choice, result.answers["urgent"].noul)

With langchain-typesafe 0.0.1a3.

Output: billing 0.43047947436151557 (the stand-in's numbers). result.answers[name] is a ChoiceAnswer (choice, probabilities, confidence) or a NoulAnswer (noul); a malformed question is refused by the client before it reaches the server, and a 422 from the server is raised as TypeSafeUnprocessableEntityError.

Vercel AI SDK

npm install ai@7.0.131 @ai-sdk/typesafe-ai@3.0.15 (Node 22). experimental_decide is the current name; experimental_evaluate is a deprecated alias of it.

js
import { experimental_decide as decide } from "ai";
import { createTypeSafeAi } from "@ai-sdk/typesafe-ai";
const typesafe = createTypeSafeAi({ baseURL: "http://127.0.0.1:8000/v1", apiKey: "not-used" });
const result = await decide({
model: typesafe.decisionModel("decisio"),
state: { message: "My card was charged twice." },
questions: {
queue: { type: "choice", instructions: "Which queue?", criteria: { billing: "Payments", access: "Login problems" } },
urgent: { type: "boolean", instructions: "Is it urgent?", criteria: { true: "needs an answer today", false: "can wait" } },
},
});
console.log(result.answers.queue, result.answers.urgent);

Needs Node 22 with ai 7.0.131 and @ai-sdk/typesafe-ai 3.0.15.

Output: the choice answer { type: 'choice', choice: 'billing', probabilities: {...} } and { type: 'boolean', probability: 0.43047947436151557 }. confidence is under result.providerMetadata.typesafe.confidence.

n8n

n8n's built-in HTTP Request node posts the request to the server; no community node is needed. Import this workflow (Workflows, Import from File; or n8n import:workflow --input=workflow.json with the workflow wrapped in a list and given an id), change the URL if the server is not on port 8000, and press Execute. Checked in n8n 2.35.7: the workflow ran to success and the node's output held queue.choice: "billing" and urgent.noul: 0.43....

json
{
"name": "decisio: ask a question about a text",
"nodes": [
{
"parameters": {},
"id": "11111111-1111-4111-8111-111111111111",
"name": "Manual trigger",
"type": "n8n-nodes-base.manualTrigger",
"typeVersion": 1,
"position": [0, 0]
},
{
"parameters": {
"method": "POST",
"url": "http://127.0.0.1:8000/v1/systemone",
"sendBody": true,
"specifyBody": "json",
"jsonBody": "{\n \"model\": \"decisio\",\n \"state\": {\"message\": \"My card was charged twice.\"},\n \"questions\": {\n \"queue\": {\"type\": \"choice\", \"instructions\": \"Which queue?\", \"criteria\": {\"billing\": \"Payments\", \"access\": \"Login problems\"}},\n \"urgent\": {\"type\": \"noul\", \"instructions\": \"Is it urgent?\", \"criteria\": {\"true\": \"needs an answer today\", \"false\": \"can wait\"}}\n }\n}",
"options": {}
},
"id": "22222222-2222-4222-8222-222222222222",
"name": "Ask decisio",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [240, 0]
}
],
"connections": {
"Manual trigger": {"main": [[{"node": "Ask decisio", "type": "main", "index": 0}]]}
},
"active": false,
"settings": {}
}

Needs n8n 2.35.7.

The community node n8n-nodes-jev 0.2.3 also works against decisio (its credential's Base URL is the server's, without /v1); the HTTP Request node is shown because it needs nothing installed and its request body is the wire format itself.

TanStack AI

npm install @tanstack/ai@0.65.1 @tanstack/ai-typesafe@0.1.8 (Node 22).

js
import { boolean, choice, decide } from "@tanstack/ai";
import { createTypesafeDecider } from "@tanstack/ai-typesafe";
const adapter = createTypesafeDecider("decisio", "not-used", { baseURL: "http://127.0.0.1:8000" });
const result = await decide({
adapter,
state: { message: "My card was charged twice." },
questions: {
queue: choice({ instructions: "Which queue?", options: { billing: "Payments", access: "Login problems" } }),
urgent: boolean({ instructions: "Is it urgent?", criteria: { true: "needs an answer today", false: "can wait" } }),
},
});
console.log(result.queue.value, result.urgent.probability);

Needs Node 22 with @tanstack/ai 0.65.1 and @tanstack/ai-typesafe 0.1.8.

Output: billing 0.43047947436151557. Each result carries value, probability, confidence and probabilities; meta.usage maps the server's usage. typesafeDecider(model) reads the key from TYPESAFE_API_KEY and has no base-URL variable, so use createTypesafeDecider with baseURL as above.

Pipecat

pip install "pipecat-ai[jev]==1.12.0" (it installs without the audio extras).

python
import asyncio
from pipecat.classifiers.base_classifier import ChoiceQuestion, YesNoQuestion
from pipecat.classifiers.jev.classifier import JevClassifier
async def main():
clf = JevClassifier(api_key="not-used", base_url="http://127.0.0.1:8000")
state = {"message": "My card was charged twice."}
queue = await clf.choice(state, {"queue": ChoiceQuestion(instructions="Which queue?", options={"billing": "Payments", "access": "Login problems"})})
urgent = await clf.yes_no(state, {"urgent": YesNoQuestion(instructions="Is it urgent?", yes="needs an answer today", no="can wait")})
print(queue["queue"], urgent["urgent"])
await clf.cleanup()
asyncio.run(main())

With pipecat-ai 1.12.0.

Output: choice='billing' probabilities={...} confidence=... and the yes/no result. A 422 from the server is reported as HTTP 422 and the server's detail is dropped by the client; the default timeout is 10 seconds, which the first question after a start can exceed on a slow card.

Five frameworks that speak TypeSafe’s format work with decisio once they point at the server. Each was checked against a running server, and every check passed.

Framework, as checkedBase URLTimeout and retries
LangChain
langchain-typesafe 0.0.1a3; 42 of 42 checks passed
http://127.0.0.1:800030 seconds, no retries
Vercel AI SDK
ai 7.0.131, @ai-sdk/typesafe-ai 3.0.15; 42 of 42 checks passed
http://127.0.0.1:8000/v1none set (Node's fetch defaults apply); maxRetries 2 for retryable failures
n8n
n8n 2.35.7, n8n-nodes-jev 0.2.3; 44 of 44 checks passed
http://127.0.0.1:8000none unless added under Options; retries only on 429 and 529
TanStack AI
@tanstack/ai 0.65.1, @tanstack/ai-typesafe 0.1.8; 39 of 39 checks passed
http://127.0.0.1:8000none set (Node's fetch defaults apply); no retries
Pipecat
pipecat-ai 1.12.0; 39 of 39 checks passed
http://127.0.0.1:800010 seconds; 3 retries, on 429 and 529 only

Checked on the CPU stand-in of decisio 0.56.0 on 2026-11-23, and against Gemma 4 31B on decisio 0.9.0, 2026-10-08. The stand-in's answers are not the default model's: the checks test the paths, fields, parsing and errors. The programs below ran on the stand-in on 2026-10-14.

  • Every one needs an API key; any string works.
  • Only the Vercel AI SDK wants /v1 at the end of the base URL; the others add it themselves.
  • Tasks and certified answers are decisio’s own routes: none of these frameworks calls them, so call those routes directly.