[ Guide ]
Jev speculative fan-out
Published By Jev Hub
[ Sponsors ]Launch price
These products help keep Jev Hub updated. Want yours up here?
- Speculative fan-out means sending every question your system might need to Jev in one request, then using only the answers that apply.
- In TypeSafe's support ticket example, one request asks five questions: category, bug severity, reproducible steps, refund and frustration.
- Your code follows the branch that matches: bugs read the severity, billing reads the refund answer.
- TypeSafe says extra questions usually barely affect response time, and each answer does not depend on the others.
- One request cost 12.2 times less than 13 separate ones in TypeSafe's test, but every question adds some input.
- Our read: if a question needs an earlier answer written into it, make a second call.
One ticket, five questions
| Feature | The question | When your code uses it |
|---|---|---|
| What kind of ticket is it? | A Choice: bug report, billing or feature request. | Always. It decides which branch your code follows. |
| How severe is the bug? | A Score of how severe the bug is. | Only for bug reports. Ignored for every other ticket. |
| Are there steps to reproduce it? | A Noul (yes/no), answered as a probability. | Only for bug reports, together with the severity. |
| Is a refund being asked for? | A Noul (yes/no), answered as a probability. | Only for billing tickets. |
| How frustrated is the customer? | A Score of how frustrated the customer is. | On every ticket, whatever the category. |
From TypeSafe's documentation page on speculative fan-out, read on 21 October 2026. The questions and cutoffs are TypeSafe's illustration, not a recommendation for your business.
What do the words in this guide mean?
A few terms come up again and again. None of them needs a technical background.
- Fan-out. Sending many questions to Jev in a single request, instead of one request per question.
- Speculative question. A question you ask in case it turns out to matter. If it does not, your code ignores the answer.
- Request. One message from your software to Jev, which comes back with the answers. TypeSafe also calls it a call.
- Round trip. One request and its reply. A follow-up question means a second round trip.
- Question types. A Choice picks one option from a list you write. A Score rates something on a scale you define. A Noul is a yes/no question, answered as a probability: 0.7 means a 70% chance of yes.
- Your code. The software you write around Jev. Jev only answers; your code decides which answers to use.
What is speculative fan-out?
Think of a clinic's intake form. The nurse asks every question in one visit: age, symptoms, allergies, medication. Some answers will turn out not to matter for this patient. That is fine, because the alternative is to make the patient come back for each question one at a time.
Speculative fan-out is the same idea for Jev. Instead of asking for the category first and the details in a follow-up, you send all of the questions together, and your code picks out what is relevant once the answers arrive. TypeSafe recommends putting all the questions your system needs into a single request.
How does TypeSafe's support ticket example work?
A support system has to sort each ticket into a category. If it is a bug report, it also needs to know how severe the bug is. Rather than asking the category first and the severity second, TypeSafe's example sends one request with the ticket and five questions, which are in the table above. The five answers come back together, each with its probability.
Then your code decides what matters, using cutoffs that are TypeSafe's illustration:
- Bug report: if the severity score is above 1.5 and the chance of reproducible steps is above 0.6 (60%), escalate to engineering. Otherwise add it to the bug backlog.
- Billing: if the chance of a refund request is above 0.7 (70%), send it to billing with a flag. Otherwise send it to billing as normal.
- Feature request: log it. The bug and refund answers are simply ignored.
- Any ticket: if the frustration score is above 1.5, flag it for a priority reply.
Why ask questions you might not use?
TypeSafe gives two reasons. The first is that it saves a round trip: when the extra answer turns out to matter, you already have it, and when it does not, you ignore it.
The second is speed. TypeSafe says all the questions in a request are evaluated in parallel, so adding more of them usually has little effect on response time. That is the company's own claim, and the figures below are from its own cookbook.
Does asking more questions change the other answers?
TypeSafe says no. Each question is scored on its own against the input, so an answer does not depend on what else is in the request. Its cookbook checked this with 13 questions about one long document, asking each one several times in one request and again as 13 separate requests.
The answers matched. The choices, the scores and six of the eight yes/no questions came back identical every time. The other two moved slightly from one repeat to the next, by the same small amount either way. So adding speculative questions does not disturb the ones you care about.
What does it cost?
In TypeSafe's cookbook, the one request with all 13 questions cost $0.000497, against $0.006090 for 13 separate requests. That is 12.2 times cheaper, mainly because the long document was sent once instead of 13 times. The time figure, 0.27 seconds against 2.71 seconds, adds up the 13 separate requests as if they ran one after another. Sent at the same time, that gap shrinks, but the cost saving stays. This was a TypeSafe test on jev-1.12.
Our read: speculative questions are cheap but not free. Every question, and every option in a Choice, adds some input to the request, so keep them short. For how the number of options affects cost, see our support ticket routing page.
When is fan-out the wrong choice?
TypeSafe does not list exceptions, so this is our read. Fan-out works when the questions are independent: each can be answered from the input alone. If a later question needs an earlier answer written into it, for example, you must first learn the product the customer named and then ask something about that product, you need a second request.
Also be selective. A question that your code will never use under any branch is not speculative, it is just a cost.
How do you set it up for your own business?
TypeSafe does not publish a step list for this. The steps below are our read of how to apply the pattern.
- Write down what happens after the first sort. For each kind of ticket or request, what else do you need to know?
- Turn each of those into a question. A Choice for the sort, then a Score or a yes/no for each detail.
- Send them all in one request. Let your code read the Choice first, then use only the answers for that branch.
- Set the cutoffs from real cases. TypeSafe's numbers, such as 1.5 and 0.6, are examples. Our guide on confidence routing covers how to set them.
Our read: write the whole decision tree as questions first
Our read is that fan-out changes how you design, more than how you code. Before writing any code, draw every decision the system makes, and turn each one into a question. Once the tree is on paper, putting all of it in one request is easy, and gaps show up early.
It pairs naturally with sorting requests to the right handler, which our guide on intent routing covers.
Common questions
Sending all the questions your system might need to Jev in one request, including ones that may not matter, and letting your code use only the answers that apply.
It saves a follow-up request when the answer does matter, and TypeSafe says extra questions usually have little effect on response time. When an answer is irrelevant, your code ignores it.
TypeSafe says no: each question is scored on its own against the input. In its 13-question test the choices, scores and most yes/no answers came back identical either way.
In TypeSafe's test, one request with 13 questions cost 12.2 times less than 13 separate requests, mainly because the long document was sent once. Every question still adds some input, so keep them short.
When a later question needs an earlier answer written into it. This is our read, not a TypeSafe rule.
Sources
Written by Jev Hub from the sources below and checked against them on . Where a figure is a company's own claim, the article says so.
Related content
- Read the article
Guide
Updated
How to write Jev questions
Pick the question type, write criteria and turn probabilities into actions.
- Read the article
Guide
Published
Jev on GitHub
Jev's model is closed, but its code ecosystem is huge. Start here.
- Read the article
Guide
Published
Jev API access
Five ways to call Jev, with the model ID, address and key for each.