Patterns

Six ways to wire typed decisions into a system, and the problem each one removes.

A capability returns one decision. A pattern turns that decision into behaviour in your code.

Each page below states the problem, the wiring, and the numbers you branch on. Every page carries curl, Python and TypeScript.

Pick a pattern by the problem

PatternThe problem it removesWhat it buys
Confidence routingOne threshold decides everything, so cheap actions block and risky actions slip through.A band per action: act, confirm, review, escalate.
LLM guardrailsPrompt-based safety checks cost a full LLM call on every message.One batched yes-no call on the way in, and one on the way out.
Extract, then verifyExtracted fields land in your database with nothing to back them.A second opinion per field, plus the spans that support it.
Cascade to an LLMEvery input pays large-model latency, even the obvious ones.The cheap decision first, the large model only for uncertain cases.
Composite scoringOne broad judgment hides why the score moved.Atomic rate calls with weights you own and can audit.
Intent routingA router prompt drifts, and its output needs parsing.One classify call with described labels, and probabilities per route.

The patterns

What every pattern assumes

Three facts drive all six patterns.

  1. A decision returns a number, not prose. You branch on probability or confidence instead of parsing text, as decisions and probabilities describes.
  2. A batch costs one HTTP request. texts takes up to 32 inputs, but each text is a separate model call. statements and questions batch inside one text in one inference call, and each adds only its own length to the billed input, under batching.
  3. The thresholds are yours. The API never decides for you what is confident enough. Pick the bands on thresholds and confidence routing.

Every code sample on these pages runs without credentials. No API key is required during the launch period.

Patterns and recipes

A pattern is a shape you apply to your own problem. A recipe is a finished job with a schema, labels, and thresholds already chosen. A recipe combines the patterns above.

Next