Check it out in action
How it works
Speculative fan-out
The chief pattern demonstrated here is speculative fan-out. Each user request is evaluated against a long list of questions, including many that will end up irrelevant for most requests. To carry out “Turn off all of the lights in the house”, the code needs only four answers:- “What category of request is this?” (smarthome command)
- “What domain is this request targeting?” (whole house)
- “What type of device is this request targeting?” (lights)
- “What action should be taken on the lights?” (turn off)
The wrong way: sequential API calls
The slower way is to split the questions across several API calls, and ask each one only once an earlier answer shows it’s needed:- “What category of request is this?” (smarthome command)
- “What domain is this request targeting?” (whole house)
- “What type of device is this request targeting?” (lights)
- “What action should be taken on the lights?” (turn off)

