How it works
- Draw. Start from a template or a blank canvas. Add questions: a ready-made template (moderation, spam, intent, routing, sentiment, priority, language) or your own choice, yes/no or score question. Every answer is an output; drag it to the next step or to an outcome.
- Test. Paste real texts in the editor and watch the path light up, with the probability of each answer. Adjust thresholds, add an “unsure” branch that sends borderline cases to a person.
- Call it. Send the text to
/v1/flows/{flow}/runand branch onoutcome. Change the flow in the editor later; your code stays the same.
curl https://layahost.com/v1/flows/support-inbox/run \
-H "Authorization: Bearer $LAYAHOST_API_KEY" \
-H "Content-Type: application/json" \
-d '{"text": "Hi, I was charged twice this month, please refund one payment."}'
# → {"outcome": "billing-queue", "steps": [{"label": "Spam?", "answer": "legit", ...}, ...],
# "usage": {"decisions": 2, "cost_usd": 0.00001}}
Why a flow and not one big prompt
- Narrow questions are more reliable. The Laya model answers best when a question has a few well-described options. A flow asks several small questions instead of one with every label at once.
- You pay for the path, not the whole tree. Spam stops after one question. A billing ticket takes two. Each question is one decision: a million tickets through the support flow are one to three million decisions, depending on how far each one goes. On the Pro plan that's 10M decisions a month for $49.
- Typed, predictable output. The outcome is always one of the values you drew. No parsing of generated text, no answers you did not plan for.
- Every step is explained. The response lists each question, its answer and probability, and the logs keep them, so you can see why a ticket went where it did.
Templates, with real runs
These flows are in the console, ready to copy and change. The runs below are real answers from our API, misses included. Accuracy depends on your texts: test with your own before you rely on a flow.
Comment moderation
Publishes clean comments, hides toxic ones and spam, and sends the ones the model is unsure about to a moderator. 2 questions, 3 outcomes:
- Toxic? toxic → Hide; unsure → Moderator queue; safe → Spam?
- Spam? spam → Hide; legit → Publish
| Text | Path | Outcome |
|---|---|---|
| Great article, but you got the release date wrong: it shipped in March. | safe (87%) → legit (92%) | publish |
| You are a clueless idiot and should never write again. | toxic (82%) | hide |
| Buy cheap followers now at insta-boost.biz, 10k for 5 dollars! | safe (85%) → spam (99%) | hide |
Lead qualification
Spots sales enquiries in a contact form and scores how ready the person is to buy, so hot leads reach a salesperson first. 2 questions, 4 outcomes:
- Sales enquiry? no → Send to support; yes → Buying intent
- Buying intent browsing → Newsletter; interested → Sales rep follows up; ready → Call today
| Text | Path | Outcome |
|---|---|---|
| Hi, we are a team of 40 and would like a quote for the annual plan. Can we get a demo this week? | yes (74%) → ready (72%) | call-today |
| My password reset email never arrives. | no (100%) | support |
| Just curious, do you have a free plan? | no (65%) Arguably a sales question. Lower the yes threshold or reword the question to catch it. |
support |
Support inbox triage
Drops spam, works out what the customer wants, and sends each ticket to the right queue, with outages paged straight away. 3 questions, 8 outcomes:
- Spam? spam → discard; legit → What do they want?
- What do they want? refund → Billing team; cancellation → Billing team; bug_report → How urgent is the bug?; question → Answer from help centre; feature_request → Product board; other → Human review; unsure → Human review; praise → Thank-you reply
- How urgent is the bug? urgent → Page on-call; high → Page on-call; normal → Engineering queue; low → Engineering queue
| Text | Path | Outcome |
|---|---|---|
| Our whole checkout has been down for an hour and customers cannot pay! | legit (56%) → bug_report (98%) → urgent (97%) | page-on-call |
| Hi, I was charged twice this month, please refund one payment. | legit (88%) → refund (100%) | billing-queue |
| Congratulations! You have won a free iPhone, claim it at bit.ly/prize-now | spam (95%) | discard |
| The dashboard loads slowly on Mondays, not urgent but annoying. | legit (88%) → bug_report (75%) → normal (78%) | engineering-queue |
Use it from anywhere
- Your code: one HTTP call from any language. See the flows docs.
- n8n, Zapier, Make: an HTTP request step with your key; branch on
outcomein the next step. - Coding agents: the MCP server has
list_flowsandrun_flow.
FAQ
Is this a workflow automation tool like n8n?
No. A flow only decides: it reads a text and returns an outcome. Sending emails, creating tickets or paging people stays in your code or your automation tool, which calls the flow.
How accurate is it?
As accurate as each question. Well-worded questions with described options do best; the runs above show typical answers and some misses. For decisions where a mistake is costly, add an unsure branch to a human, or ask us about a custom model trained on your data.
What does it cost?
One decision per question asked, the same as a single call: from your plan's included decisions, or $15 per million from prepaid credit (see pricing). The editor's test runs are billed the same way. New accounts get $1 of credit after email verification.
Can I change a flow without redeploying?
Yes. Runs use the last saved version, and the response carries its version number so you can tell which one answered.