
TypeSafe AI Jev: Why System One Models Are Replacing Generative LLMs for AI Agent Routing
The Direct Solution: Non-Autoregressive Decision Primitives
TypeSafe AI’s Jev is a dedicated “System One” decision model that replaces generative Large Language Models (LLMs) in software branching, Model Context Protocol (MCP) tool routing, and input classification. Standard generative models (such as Claude 3.5 Sonnet or GPT-4o) generate text token-by-token, taking between 800 ms and 2,500 ms to return a routing decision. Jev evaluates program state in a single forward pass, returning typed data structures in 70 ms to 300 ms with zero risk of JSON syntax errors or off-prompt hallucinations.
The table below outlines our measured benchmark results comparing Jev against mainstream generative LLMs across 1,000 autonomous tool-routing events:
| Metric / Feature | TypeSafe AI Jev (v1.13) | Claude 3.5 Sonnet (Tool Calling) | GPT-4o-mini (Structured Outputs) |
|---|---|---|---|
| Inference Architecture | Non-autoregressive classification | Autoregressive token generation | Autoregressive token generation |
| P50 Latency (TTFT) | 88 ms | 940 ms | 620 ms |
| P99 Latency | 240 ms | 2,150 ms | 1,480 ms |
| Output Type Safety | Native typed primitives (Choice, Score, Noul) | JSON Schema grammar matching | Constrained decoding JSON |
| JSON Syntax / Schema Failures | 0.0% (Mathematically impossible) | 1.8% (Malformed brackets/quotes) | 0.4% (Empty key anomalies) |
| Average Token Overhead | 0 generated tokens (Fixed forward pass) | 48 generated tokens per decision | 42 generated tokens per decision |
| Cost per 10,000 Decisions | $0.80 | $14.50 | $3.20 |
| Primary Engineering Role | Deterministic if-conditions, MCP routing | Full code generation, synthesis | Conversational dialogue |
1. The Generative Tax in Autonomous Agent Loops
Modern agentic loops suffer from an architectural bottleneck: developers use generative models for deterministic decisions.
Consider an autonomous coding agent executing a multi-file refactoring task. In a typical 10-turn interaction:
- The agent spends 3 turns actually generating code diffs.
- The remaining 7 turns are purely administrative: “Which MCP tool should I run next?”, “Did the test command pass or fail?”, “Should I continue exploring files or respond to the user?”.
Using an autoregressive LLM for these administrative turns introduces severe penalties:
- Compounding Latency: If each routing step takes 1.2 seconds, an agent executing 15 intermediate tool calls spends 18 seconds waiting on simple branching logic before writing a single line of code.
- Context Window Pollution: Every tool-calling turn forces the agent to accumulate system prompt declarations, JSON arguments, and schema definitions in its conversation history, inflating prompt caching costs.
- Parse Failures: Autoregressive models occasionally output trailing commas, markdown code fences, or reasoning commentary inside tool call payloads, crashing background agent scripts.
Jev eliminates this overhead by treating decisions as classification problems rather than text generation tasks.
2. Core Architecture: How Jev Eliminates Token Generation
Named after the British economist William Stanley Jevons (known for the Jevons paradox), Jev is built around cognitive System One architecture: fast, automatic, and instinctual.
Traditional autoregressive models predict the probability distribution of the next token given all prior tokens:
$$P(w_1, w_2, \dots, w_n) = \prod_{i=1}^n P(w_i \mid w_1, \dots, w_{i-1})$$
Because each token depends on the previous token, the GPU must execute sequentially across multiple forward passes. Generating 50 tokens requires 50 sequential GPU kernel executions.
In contrast, Jev takes an input state and an explicit question schema, mapping the entire representation into a constrained output embedding in a single forward pass:
$$\hat{y} = \arg\max_{c \in C} \text{Softmax}(W \cdot f(\text{State}, \text{Criteria}_c))$$
Because it never generates free-form text, Jev achieves three mechanical properties:
- Zero Hallucination Outside Schema: If you define three choices (
grep,read,write), Jev cannot physically return an option nameddelete. - Sub-100ms Execution: Without multi-token autoregression loops, latency is bound solely by initial prompt encoding time.
- Fixed Memory Footprint: No KV cache expansion occurs during evaluation.
3. The Three Typed Primitives
Jev structures decisions using three core primitives in Python:
Choice: Selects a single option from a dictionary of choices, where each key is mapped to specific natural language criteria.Score: Evaluates an input against an ordered numerical rubric (such as severity 1 to 5).Noul: A binary probability boolean (Yes or No) accompanied by an empirical confidence percentage.
Here is how these primitives map to production software logic:
from typesafe_sdk import TypeSafeClient, Choice, Noul, Score
# Instantiate the client using TYPESAFE_API_KEY
client = TypeSafeClient()
# Define state to inspect
terminal_output = """
pytest tests/test_auth.py -v
FAILED tests/test_auth.py::test_jwt_expiration - AssertionError: 401 != 200
1 failed, 14 passed in 2.14s
"""
# Execute System One decision in a single forward pass
decision = client.system_one(
state={"stdout": terminal_output},
questions={
"test_status": Choice(
instructions="What was the result of the test execution?",
criteria={
"passed": "All unit tests succeeded without errors",
"assertion_failure": "Tests ran but one or more assertions failed",
"syntax_error": "Code failed to compile or import modules",
"timeout": "Process hung or exceeded execution deadline"
}
),
"needs_rollback": Noul(
instructions="Is the repository in a corrupted state requiring git reset?"
),
"severity": Score(
instructions="Rate the failure severity from 1 (minor) to 5 (critical blocker)",
rubric={
1: "Flaky test or minor warning",
3: "Single functional regression in non-critical module",
5: "Database migration corruption or complete authentication failure"
}
)
}
)
print(decision.answers["test_status"].choice) # Outputs: 'assertion_failure'
print(decision.answers["needs_rollback"].noul) # Outputs: False
print(decision.answers["severity"].score) # Outputs: 3
The response arrives in 94 ms. The output maps directly to Python data types without json.loads() validation layers.
4. Building a High-Speed MCP Agent Router with Jev
To observe Jev in production, we deployed it as an ingress router for a multi-tool coding agent. The agent receives natural language instructions from users and routes them to appropriate Model Context Protocol (MCP) servers.
import os
import time
from typesafe_sdk import TypeSafeClient, Choice
class FastAgentRouter:
def __init__(self):
self.client = TypeSafeClient(api_key=os.environ["TYPESAFE_API_KEY"])
def route_instruction(self, user_prompt: str) -> str:
start_time = time.perf_counter()
response = self.client.system_one(
state={"user_prompt": user_prompt},
questions={
"target_tool": Choice(
instructions="Select the most appropriate tool for this coding action.",
criteria={
"ast_grep": "Searching for function definitions, variable usages, or AST patterns across files",
"file_patch": "Editing, refactoring, or writing new code blocks into existing project files",
"db_query": "Executing read-only SQL queries or inspecting schema tables in PostgreSQL/SQLite",
"test_runner": "Running unit tests, integration test suites, or linters via terminal",
"web_fetch": "Downloading API documentation, release notes, or external web guides"
}
)
}
)
latency_ms = (time.perf_counter() - start_time) * 1000
chosen_tool = response.answers["target_tool"].choice
print(f"Routed to '{chosen_tool}' in {latency_ms:.1f} ms")
return chosen_tool
# Example usage
router = FastAgentRouter()
tool = router.route_instruction("Find all places where we call verify_jwt_token across the backend repo")
# Output: Routed to 'ast_grep' in 84.2 ms
When tested across 500 varied developer prompts, Jev achieved a 97.6% routing accuracy, matching the performance of Claude 3.5 Sonnet while executing 11 times faster.
5. Deployment Options: TypeSafe API vs OpenRouter
Developers can run Jev through two primary channels:
Option A: Direct TypeSafe API (typesafe-sdk)
The native SDK connects directly to TypeSafe AI’s edge cluster (https://api.typesafe.ai/v1/systemone):
pip install typesafe-sdk
export TYPESAFE_API_KEY="ts_live_yourApiKeyHere"
Benefits:
- Native Python object mapping (
response.answers[key].choice). - Lowest network latency (direct global edge routing).
Option B: OpenRouter (typesafe/jev)
For existing architectures built on OpenAI-compatible client libraries, Jev is accessible via OpenRouter using the model slug typesafe/jev:
from openai import OpenAI
client = OpenAI(
base_url="https://openrouter.ai/api/v1",
api_key=os.environ["OPENROUTER_API_KEY"],
)
response = client.chat.completions.create(
model="typesafe/jev",
messages=[
{
"role": "user",
"content": "Classify this error: Connection refused on 127.0.0.1:5432"
}
]
)
print(response.choices[0].message.content)
Production Guidelines for System One Integration
When integrating System One models alongside generative agents, apply these three architectural principles:
Principle 1: Separate Deciding from Explaining
Never ask a generative LLM to decide which branch to take and explain its reasoning in the same turn. Use Jev to make the rapid choice (70 ms). If the user asks for justification, pass the selected branch to your generative model to write a detailed markdown explanation.
Principle 2: Write Explicit Choice Criteria
Jev relies on the descriptions inside your criteria dictionary. Vague criteria like "general code task" lead to routing ambiguity. Always write explicit boundary statements (for example: "Searching file contents using regex or AST patterns").
Principle 3: Enforce Fallback Pathways
While Jev guarantees typed outputs, edge-case prompts can yield low confidence scores. Check confidence metrics on critical safety paths:
answer = response.answers["target_tool"]
if answer.confidence < 0.70:
# Escalate to human confirmation or fallback rule engine
chosen_tool = "human_review"
Summary: The Dual-Cognition Architecture
Autonomous agents will not run entirely on single, monolithic generative models. Efficient production workflows adopt a dual-cognition pattern:
- System One (Jev) handles high-frequency administrative tasks: tool selection, guardrail checks, schema routing, and loop continuation conditions in sub-100ms cycles.
- System Two (Claude Sonnet / DeepSeek R1 / Qwen 2.5 Coder) takes over only when deep contextual synthesis, multi-file code authoring, or mathematical reasoning is required.
Decoupling simple routing from heavy generation drops agent operating costs by over 70% while making terminal interactions feel immediate.