# Jev for coding routers: why Weave uses session state

Canonical: https://weaveos.com/blog/why-you-shouldnt-use-jev-for-coding-agents-and-routing

Published: 2026-09-23T00:00:00.000Z

Updated: 2026-11-13T00:00:00.000Z

By Samir Amin

[Weave Router](/products/router) handles model selection, cache-aware switching and escalation for Claude Code, Codex and other coding clients. Jev provides typed decisions that can power a router. Weave supplies the routing system around those decisions, including the session state, client setup and serving infrastructure.

**Updated November 13, 2026:** Jev now appears in [LiteLLM Auto Routing](https://docs.litellm.ai/docs/proxy/auto_routing), [OpenRouter](https://openrouter.ai/docs/guides/routing/routers/overview), [Ramp](https://docs.router.com) and [Bifrost's beta Complexity Router](https://docs.getbifrost.ai/features/complexity-router). These are complete products around the decision model. The September experiments below explain why we built around session state; they do not rank today's Jev-based routers.

Jev is an interesting model release. Dropping a classifier into a coding harness, though, is only one part of making routing work.

Some context first, because it changes how much of this transfers to you. By routing, I mean deciding which model handles each call an agent makes. I'm specifically talking about coding-agent traffic: agents running in a loop, mostly making tool calls, reading files, editing and running tests. At Weave, we've been running a small classifier in front of that traffic for about five months, picking the model for each turn.

In those five months we've tried a lot of approaches, models and architectures. Almost all of the improvement came from one thing: giving the router the state of the session, meaning what the agent has already done. That was the deciding factor in our implementation.

## What Jev does

[TypeSafe describes Jev](https://docs.typesafe.ai/introduction) as a decision model. Give it state and typed questions, and it returns structured results with probability distributions for Choice and Score questions. Model selection is a natural use: estimate what a request needs and choose a capable model at an appropriate cost.

For our coding router, the harder problem was deciding what state to give the classifier. The following experiments show why session history mattered more than swapping the model that made the decision.

## What we tried

Most of our early experiments tried to work out, from the prompt, what a turn needed:

- Clustering prompts. We embedded nearly a million prompts and looked for natural groups we could map to models.
- Skill taxonomy. We tagged each request with how much it demanded of eight capabilities, then scored models against that demand minus a price penalty. This is almost exactly the design Jev makes trivial to build.
- Turn taxonomy. We classified each turn as planning, a tool call, a confirmation, a refinement, and so on. This worked for telling us what kind of turn we were looking at, but not which model it needed.
- Escalation. We started on a smaller model, watched for signs of failure, and escalated to a frontier model.

We also kept swapping the architecture underneath: centroids plus a classifier, an LLM, XGBoost, and back and forth a few more times. None of those swaps made a meaningful difference either. Whatever gave the best quality within our ~200ms latency budget won and the gap between them was small.

## Where the gains actually came from

The router in these September experiments predicted the agent's next action, out of six possibilities, and routed on that. Here's how much each input contributes:

Adding simple features about what happened on the previous calls took accuracy from 0.28 to 0.61. That's roughly double, from history alone.

Adding the prompt embedding on top of that moved band-AUC from 0.860 to 0.879.

Reading the prompt carefully helps a little. Knowing where the agent is in its loop helps a lot.

It makes sense once you look at real traffic. In ours, edit calls produce more output than any other action, more even than reasoning calls, which sound like the expensive kind of thinking. You can't tell that from reading an edit prompt. You can tell it instantly if you know the agent has already read four files and is now writing. How hard a call is depends mostly on what came before it, and that isn't in the text of the call.

## The feature layout in these experiments

The feature vector in those experiments made the session context explicit. Alongside the embedding, every routing decision read:

- how many tool calls, tool results, and tool errors came before this turn
- what the current intent is (explore, edit, run a test, and so on)
- which harness is sending the request (Claude Code, Codex, and so on)
- a block of belief dynamics from the filter: entropy, movement, expected dwell, and the change in turn log-likelihood

That last one needs explaining. We run a filter over the hidden session state, so at every turn the router carries a belief about what phase the session is in and how confident it is in that belief. Those get fed back in as features. The router's own uncertainty about where the session is turns out to predict what comes next.

Almost none of this is in the prompt, and most of it can't be. It's a property of the trajectory, not the message.

## What Weave adds over using Jev directly

Jev can make the classification decision. Weave tracks the coding session around it: previous actions, tool errors, the harness, cache state and signs that the agent has stopped making progress. That information lets the policy decide whether a cheaper model is appropriate now and whether switching would actually save money.

A complete routing service also needs to translate API formats, preserve tool and reasoning payloads, manage credentials and account for upstream usage. Weave operates those pieces for the managed service. Teams building around Jev own them, unless they use a gateway that supplies its own implementation. The results below concern Weave's tested system; they are not a benchmark against every product using Jev.

So if you're building a router, with Jev or without it, spend your time on state. Start by logging:

- the full trajectory, every tool call and result in order
- tool errors, separately from tool calls
- how deep into the session each turn is
- the harness and the tools available on it
- downstream outcomes, so you have something real to check your labels against

## Why the session state changes cost

A cheaper model can be the wrong choice if moving to it loses a warm cache. A frontier model can be the right choice after a smaller model repeats the same failed edit. Weave evaluates both situations as the session progresses. The aim is to reduce the cost of completing the work, including escalation and cache rebuilding, rather than optimize the rate of an isolated request.

That also makes the decisions easier to inspect. The serving model, request usage and session records show where the policy used a cheaper model and where it escalated.

## What this means for the coding budget

Weave reports **40% average token-spend savings with Router**. Its July 2026 customer update reported Router cost cuts of **20–80%**. The separate September paired evaluation then measured **48–54% lower cost per trial and 2.2–2.5x faster completion** than direct GPT-6 Astra across two coding benchmarks, with solve rates of 62.1% versus 60.6% on Terminal-Bench and 62.1% versus 66.1% on SWE-Atlas. The next-action experiment tests one routing decision; the paired coding benchmarks measure completed tasks, cost and time. [Customer results](https://weaveos.com/blog/weave-raises-13.5m-series-a-to-build-engineering-and-token-intelligence), [full benchmark and methodology](/blog/introducing-weave-router-2-0).

## Inspect the decision the router actually made

A decision model's prediction is only one part of serving an agent. Weave's [analytics export](https://docs.weaveos.com/router/analytics-export) records the requested model, served model and provider, candidate model list, decision reason, sticky routing and failover markers. Policy and roster identifiers let a team compare behavior across releases without assuming the policy stayed unchanged.

The [session-cost API](https://docs.weaveos.com/router/reporting) adds committed request count, actual and requested-model costs, input/output/cache tokens and the last recorded time. It includes Router's own compaction and handover calls. The requested-model cost is a comparison for those recorded calls, separate from the adjusted savings baseline in the dashboard. These records make Jev-style decision experiments inspectable in a running coding workflow instead of leaving the team with a classifier score alone.

## Use the routing policy in your existing coding client

The managed [Weave Router](/products/router) runs the policy and serving infrastructure for your team. Engineers keep Claude Code, Codex or another supported client, and administrators control which models and providers can serve requests. LiteLLM, OpenRouter, Ramp and Bifrost supply their own routing systems too. Weave's practical advantage over starting with a decision model is that setup, session handling and operations are already part of the product. Follow the [setup guide](/router/quickstart) to connect a client.

**Keep model choice when you need it.** In Claude Code 2.1.242+, choose Weave Auto in the native picker for automatic routing, or another model that your organization can serve to pass that choice through. GitHub Copilot CLI has a `weave/auto` entry as well. The November 2026 controls let engineers use the routing policy without giving up a deliberate model choice. [Published installer and model controls](https://github.com/weave-os/router/blob/b1f70281bdca136edf61b049b9880de655d13379/install/README.md).
