layahost

Decision flows

Draw the logic.
Call one endpoint.

Chain typed decisions into a flow: is it spam, what does the customer want, how urgent is it. Each answer leads to the next question or to an outcome your code acts on. You draw it on a canvas and run it with POST /v1/flows/{flow}/run. Only the questions on the path are asked, and billed.

The layahost flow editor: a support inbox flow on a canvas. A test ticket about a checkout outage went legit, bug report, urgent, and ended at page-on-call; the path is highlighted.

The editor with a test run: the path the text took is highlighted, each step shows its answer and probability.

How it works

  1. 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.
  2. 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.
  3. Call it. Send the text to /v1/flows/{flow}/run and branch on outcome. Change the flow in the editor later; your code stays the same.
curl
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

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:

TextPathOutcome
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:

TextPathOutcome
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:

TextPathOutcome
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

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.