JEV DEVELOPER GUIDE / CONTINUOUS COURSE

Jev Guide: From Concepts to LangChain

A compact, continuous TypeSafe Jev learning path: understand typed decisions and the execution model, build with the official Python SDK, then integrate Jev with LangChain.

About 25 minutes Concept → runnable code Updated 2026-09-24
STATE→QUESTION→JEV→ANSWER→POLICY
Course outline
  1. 01Core concept
  2. 02How it works
  3. 03Code practice
  4. 04Official SDK
  5. 05LangChain
01
CORE CONCEPT

Jev is a model for typed judgment

Jev does not continue or generate prose. It receives state plus bounded questions and returns Choice, Score, or Noul answers that software can read. It fits tasks where the answer space is known, but the raw evidence cannot be resolved with exact if/else rules alone.

Choice

Select one named option, such as routing a ticket to billing, technical, or human.

Score

Place a case on an ordered scale, such as calm → frustrated → angry.

Noul

Estimate whether one proposition is true, such as “Is this request urgent?”

02
HOW IT WORKS

Separate judgment from execution

A reliable call has five layers. The application shapes evidence and declares questions; Jev returns probabilistic answers; application policy checks schema, thresholds, and risk; only then may ordinary code perform an action. The model never receives authority to refund, delete, or publish.

  1. 1
    State

    Keep only evidence that can change this decision, with clear labels, units, and provenance.

  2. 2
    Question

    Declare the answer shape and criteria with Choice, Score, or Noul.

  3. 3
    Typed answer

    Read the winner, full distribution, or P(true); do not treat the result as prose.

  4. 4
    Policy

    Validate option keys, confidence, business risk, and whether review is required.

  5. 5
    Action

    Let application code act, and log the question version, model version, and final action.

03
CODE PRACTICE

One support-routing example throughout

Assume the input is a customer message. We need to choose a team and detect urgency. Routing is a Choice, urgency is a Noul, and the actual assignment remains an application decision.

INPUT / STATE
{
  "message": "Stripe has failed for three days. Help ASAP.",
  "account_tier": "enterprise"
}
OUTPUT / CONTRACT
route   → billing | technical | human
urgent  → P(true)
policy  → automate | review

This separation matters: the model answers two small questions and policy combines them. Adding SLA, enterprise, or high-risk rules later does not require hiding business logic inside a long prompt.

04
OFFICIAL SDK

Make the first Jev call with Python

The official Python client is typesafe-sdk. Keep the key in a server-side environment variable and begin with a reversible task that is easy to review manually.

python -m pip install typesafe-sdkexport TYPESAFE_API_KEY="your-api-key"
from typesafe_sdk import Choice, Noul, TypeSafeClient

questions = {
    "route": Choice(
        instructions="Which team should handle this request?",
        criteria={
            "billing": "Payments or subscriptions",
            "technical": "Bugs or integrations",
            "human": "Ambiguous or sensitive cases",
        },
    ),
    "urgent": Noul(
        instructions="Does this message express urgency?"
    ),
}

with TypeSafeClient() as client:
    result = client.system_one(
        state={
            "message": "Stripe has failed for three days. Help ASAP.",
            "account_tier": "enterprise",
        },
        questions=questions,
    )

route = result.answers["route"]
urgent = result.answers["urgent"]

if route.choice == "human" or route.confidence < 0.75:
    enqueue_for_review(result)
else:
    assign_team(route.choice)

print(route.probabilities, urgent.noul)
VALIDATE BEFORE SHIPPING

Option keys exist, questions are non-empty, and the response shape is complete.

RISK POLICY

Review low-confidence cases; a high score never grants authority for irreversible actions.

REPRODUCIBLE LOGS

Record model, question version, distribution, threshold, and final action.

05
LANGCHAIN

Move the same contract into a Runnable

LangChain’s official TypeSafe integration exposes TypeSafeClassifier as a Runnable. Both state and questions travel with each invoke call, so the complete request can participate in batching, async execution, callbacks, and tracing.

uv add langchain-typesafeexport TYPESAFE_API_KEY="your-api-key"
from langchain_typesafe import Choice, Noul, TypeSafeClassifier

classifier = TypeSafeClassifier()

questions = {
    "route": Choice(
        instructions="Which team should handle this request?",
        criteria={
            "billing": "Payments or subscriptions",
            "technical": "Bugs or integrations",
            "human": "Ambiguous or sensitive cases",
        },
    ),
    "urgent": Noul(
        instructions="Does this message express urgency?"
    ),
}

if not questions:
    raise ValueError("At least one Jev question is required")

result = classifier.invoke({
    "state": "Stripe has failed for three days. Help ASAP.",
    "questions": questions,
})

print(result.choices["route"].choice)
print(result.nouls["urgent"].noul)
LANGCHAIN

Orchestration, batching, callbacks, tracing

JEV

Probabilistic answers to bounded questions

YOUR CODE

Thresholds, authority, review, and side effects

GO DEEPER

Continue by the problem you have