Back to writing
8 min read

Jev and Laya: A Simple Guide to AI Decision Models

A beginner-friendly introduction to Jev and Laya, with simple examples and practical use cases for building AI-powered decisions.

  • AI
  • Jev
  • Laya
  • Machine Learning

Most AI applications use a language model to generate text.

For example, you might send a support ticket to an LLM and ask:

"Which department should handle this ticket?"

The model might reply with a paragraph explaining its answer. That can work, but your application still has to interpret the response before it can take action.

Jev and Laya take a different approach.

Instead of asking AI to generate a long answer, you can ask it to make a typed decision:

  • Which option should I choose?
  • How urgent is this?
  • Is this statement true?

The result is easier for normal application code to consume.

What is Jev?

Jev is TypeSafe AI's first public System One model.

The main idea is simple:

Your data + typed questions
          ↓
        Jev
          ↓
Structured decisions

Jev is designed for software automation. Instead of returning a chat-style response, it evaluates questions about some input and returns structured decisions.

For example, a support application could ask:

{
  "state": {
    "message": "I was charged twice for the same invoice."
  },
  "questions": {
    "department": {
      "type": "choice",
      "instructions": "Which team should handle this request?",
      "criteria": {
        "billing": "Payments, invoices, and refunds",
        "technical": "Bugs and system errors",
        "sales": "Pricing and new contracts"
      }
    }
  }
}

The useful part is that the output is structured. Your code does not need to extract billing from a paragraph.

What is Laya?

Laya is an open-source decision engine inspired by the same general idea.

It works with inputs such as:

  • plain text
  • emails
  • support tickets
  • JSON data

Laya also provides a Router and model checkpoints for different kinds of inputs, including English and multilingual workflows.

The important idea is the same:

Give the model a piece of state and ask a small, explicit question about it.

Three simple decision types

A useful way to understand Jev and Laya is through three basic question types.

TypeWhat it meansExample
choicePick one optionBilling, technical, or sales
scorePick a value from an ordered scaleLow, medium, or high urgency
noulEstimate whether a statement is trueIs this message phishing?

This is useful because the application already knows what shape of answer it expects.

Jev vs. Laya

The two projects follow a similar pattern, but they are useful in different deployment situations.

JevLaya
Main formHosted System One modelOpen-source decision engine
DeploymentTypeSafe APICan be run locally
FocusFast structured decisionsLocal and customizable decision workflows
LanguagesDepends on the serviceIncludes multilingual checkpoints
Good forManaged AI decision APIsSelf-hosted experimentation and applications

A simple way to think about it is:

Jev
    ↓
Managed AI decision service

Laya
    ↓
Open-source AI decision engine

A small Laya example

Laya can be installed with:

pip install laya

Then you can define a state and a set of questions:

from laya import Router

router = Router(preload=True)

state = {
    "subject": "Duplicate charge",
    "body": "I was billed twice for the same invoice. Please refund one of the charges."
}

questions = {
    "department": {
        "type": "choice",
        "instructions": "Which department should handle this request?",
        "criteria": {
            "billing": "Invoices, payments, refunds",
            "technical": "Bugs, outages, system errors",
            "sales": "Pricing and contracts",
            "other": "Everything else"
        }
    },
    "urgency": {
        "type": "score",
        "instructions": "How urgent is this request?",
        "criteria": [
            "not urgent",
            "soon",
            "critical deadline or blocking issue"
        ]
    },
    "refund_requested": {
        "type": "noul",
        "instructions": "Does the user explicitly request a refund?"
    }
}

result = router.predict(state, questions)

Now the application can use each decision directly:

department = result["answers"]["department"]["choice"]
urgency = result["answers"]["urgency"]["score"]
refund_requested = result["answers"]["refund_requested"]["noul"]

if department == "billing":
    send_to_billing()

if refund_requested:
    create_refund_case()

if urgency >= 2:
    escalate()

The model handles the semantic decision.

Your normal application code handles the business action.

A practical support-ticket example

Imagine a support system receiving thousands of messages every day.

A customer writes:

"My payment failed again and I cannot renew my subscription."

Instead of asking an LLM to explain the whole message, the application can ask a few focused questions:

Which team should handle this?
How urgent is this?
Does the user need a payment-related action?

The output might look like:

department → billing
urgency → high
payment_action_needed → true

Your workflow can then be simple:

if department == "billing":
    send_to_billing_queue()

if payment_action_needed:
    create_payment_case()

if urgency == "high":
    notify_on_call_team()

This is one of the biggest benefits of typed decisions: the AI output fits directly into the application's control flow.

Use case: ticket routing

Support systems often need to decide where a message belongs.

For example:

billing
technical
sales
account
other

A choice question is a natural fit.

Instead of generating a sentence such as:

"This appears to be a billing issue because the customer mentions a duplicate charge."

the model can return:

billing

That is much easier to connect to a queue or workflow.

Use case: prioritization

You can also turn free-form requests into an ordered score.

For example:

How urgent is this request?

1. Not urgent
2. Needs attention soon
3. Critical or blocking

Then your code can define what each level means:

if urgency >= 2:
    create_priority_ticket()

The important separation is that the model answers the question, while the application decides what the threshold should trigger.

Use case: phishing and security checks

A security system could ask:

Is this message likely to be phishing?

That fits naturally into a noul question.

For example:

phishing_score = result["answers"]["phishing"]["noul"]

if phishing_score > 0.9:
    quarantine_message()
elif phishing_score > 0.6:
    send_to_security_review()

This creates a simple confidence-based workflow.

The same pattern can be used for:

  • prompt injection detection
  • jailbreak detection
  • suspicious requests
  • unsafe content
  • policy checks

Use case: AI agent routing

Agents often need to decide what should happen next.

For example:

Simple task
    ↓
small model

Coding task
    ↓
coding model

Complex research
    ↓
research workflow

Sensitive request
    ↓
human review

A decision model can handle the routing step before another model or tool is called.

This is a useful architecture because the first model is not trying to solve the entire task. It is only answering:

"Which path should the application take?"

Use case: document processing

Suppose you receive invoices, emails, or other documents.

You might want to ask:

Is this an invoice?
Is payment overdue?
Does this require manual review?

These are small questions about the same input.

A typed decision system is a natural fit because the application already knows what kinds of answers it needs.

Use case: customer churn signals

Consider a message like:

"We've had billing problems for months. If this happens again, we'll move to another provider."

Instead of asking for a long explanation, the application can ask:

Does this message indicate churn risk?

The result can then feed into an existing customer-success workflow.

Why not just use a normal LLM?

You absolutely can.

A normal LLM is often better when the output itself needs to be written:

Write a reply to the customer.
Summarize this document.
Explain this error.
Generate SQL.
Write code.

Typed decisions are more interesting when the application only needs a small answer:

Which queue?
Which category?
How urgent?
Is this safe?
Should this be escalated?
Is the user asking for a refund?

A real application can combine both approaches.

                  User / Event
                       │
                       ▼
                ┌───────────────┐
                │ Jev / Laya    │
                │ decision step │
                └───────┬───────┘
                        │
             ┌──────────┴──────────┐
             │                     │
          simple path          complex path
             │                     │
             ▼                     ▼
      normal application        LLM / Agent

For example, Jev or Laya can decide what should happen next, while a generative model handles the part that actually requires writing or open-ended reasoning.

One thing to keep in mind

A structured result is still a model prediction.

This:

{
  "department": "billing"
}

is easier for software to consume than a paragraph, but it can still be wrong.

That means production systems should still think about:

  • confidence thresholds
  • evaluation datasets
  • fallback behavior
  • human review
  • the cost of false positives and false negatives

A common pattern is:

High confidence
    → automate

Medium confidence
    → additional checks

Low confidence
    → human review

The main idea

The interesting part about Jev and Laya is not just the model itself. It is the interface between AI and application code.

Instead of:

AI → paragraph → parse text → guess the intent → run code

you can aim for:

AI → typed decision → run code

That makes AI easier to use for workflows such as routing, moderation, prioritization, verification, guardrails, and classification.

Jev provides a hosted System One approach from TypeSafe.

Laya provides an open-source decision engine that can be run and experimented with locally.

The broader idea is simple:

AI makes the semantic decision. Code owns the workflow.

References