Skip to content
Talk to our solutions team

Core Concepts

Every inbound message walks an escalating series of stages. A stage that resolves the message above its confidence threshold stops the cascade; otherwise the message escalates.

Crucially, a cheap stage can resolve both understanding (what the user meant) and response (what to say back). A matched rule carrying a canned answer short-circuits the entire pipeline — no model is invoked at all.

Microseconds, zero model cost. Pattern rules declared in YAML, with a scripting escape hatch for matching too awkward to express declaratively. Handles exact patterns, known commands and structured input, and can carry canned responses.

Fast and cheap. A lightweight model generated from your stage-1 rule corpus during the build. It generalises past the literal patterns, catching the near-misses the regex does not quite match — the bridge between brittle rules and a real classifier.

Milliseconds, tiny cost. An intent classifier trained on your taxonomy plus labelled examples during the build. Catches known intents phrased in unfamiliar ways.

Low cost, via the AI Gateway. Handles moderate complexity, genuine ambiguity and multi-intent messages. Produces intent, entities, and often the response itself.

Slow and expensive, via the AI Gateway. A frontier model for anything the cheaper stages cannot handle — novel questions, real reasoning, nuance. Its threshold is 0.0: it is terminal and always resolves.

This is the subtle part, and worth understanding before you tune thresholds.

The five stages produce “confidence” in fundamentally different ways. A regex match is binary. Classifier softmax scores are famously miscalibrated. An LLM’s self-reported confidence is unreliable. A raw 0.85 from stage 3 and a raw 0.85 from stage 5 do not mean the same thing — and the cascade’s entire cost/quality tradeoff depends on those numbers being comparable.

So each stage gets a calibration function that maps its raw score onto a common probability-of-correctness scale. After calibration, 0.85 from any stage means “85% likely this resolution is actually right”, and a threshold becomes a statement about acceptable accuracy rather than an arbitrary knob.

Calibration functions are fitted during the build, not at runtime: the pipeline runs the cascade against labelled examples, measures each stage’s real accuracy at each confidence level, and bundles the result with the bot artifact.

Rules are the special case. A regex has no native confidence, so a rule’s confidence comes from its historical precision — a rule that has been right 99% of the times it fired scores 0.99; one that frequently fires on messages that turn out to need escalation scores lower. Learned from firing history, not declared by you.

Once the cascade produces an intent, the orchestrator picks a path from your orchestrate.handlers mapping:

PathWhat happensCost
cannedFixed response from the rulesNone
skillInvoke a skill — order lookup, account actionSkill-dependent
ragRetrieve from a knowledge collection, generate a grounded answerOne model call
generateOpen-ended generation using conversation contextOne model call
toolDispatch a tool over the platform tool protocolTool-dependent
flowDelegate bounded multi-step autonomous workFlow-dependent
escalateTrigger escalationNone
scriptCustom logic handles the response entirelyYours

There is a real design tension between conversational and task-oriented systems, and plenty of requirements cross it — “the bot should book me a flight”.

The rule this block holds to: AI Bot owns the conversation; AI Flow owns bounded autonomous task execution. When a conversation needs multi-step work — call APIs, reason over results, take actions — the orchestrator routes to a flow via the flow path, hands over the task with conversation context, receives the outcome, and carries on talking.

AI Bot deliberately does not grow agent semantics. It delegates them. That boundary is what keeps the conversational runtime small enough to reason about.

Identity resolves across channels, so the same person on web and on Slack is one user with one history rather than two strangers. Conversations are multi-turn and stateful, with sessions backed by AI Memory for human-facing history.

On channels that support it, generative paths (generate, rag, sometimes flow) stream token by token. Non-generative paths (canned, a fast skill) return immediately, with typing indicators where the channel has them. Streams are accumulated into conversation history on completion, so a streamed answer is stored the same as a non-streamed one.