Skip to content

Jev Integrations & Adapters

LangChain and LangGraph: decision nodes in a state graph

A decision node inside a state graph: how to add typed routing to LangChain and LangGraph without hiding the policy in a prompt.
Published
Category
Jev Integrations & Adapters
Resources cited
10
Reading time
6 min
Tags#integrations#langchain#agents#routing

LangChain is a framework for composing model calls; LangGraph is the runtime that makes the composition explicit as a state graph. That second part is what makes a decision model useful. Jev does not write the answer to a user's question; it returns a typed judgment that a node can write into state and an edge can branch on. The integration is less about a new model class than about where in the graph the judgment sits.

A decision is a node, not a chat turn

The LangChain repository is a general-purpose, MIT-licensed Python framework with 147,862 stars. Its README never mentions Jev or TypeSafe. The Jev-specific bridge is langchain-typesafe, which exposes TypeSafeClassifier as a LangChain Runnable. invoke() accepts text, structured data, or LangChain messages and returns classification results rather than a chat response.

That distinction matters in a graph. A chat node returns text that the next prompt has to interpret. A decision node returns a value from a schema, so the next edge can compare it to a threshold without a parser. The LangGraph production post frames the split as code owning the workflow while Jev handles narrow judgments. In its litigation-discovery example, each page is evaluated with three questions in one request (responsive, personal information, privileged), and each answer maps to a route. The post says the same graph with Sonnet as judge was 5–6x slower on the classification step across trials. That is a vendor-authored comparison, not an independent benchmark.

The post also cites TypeSafe's 200x/400x claims and a Stagehand result: Browserbase rebuilt act() so Jev picks the action type and candidate element, with an LLM fallback below 0.7 confidence, and median latency fell from 1.97 to 0.46 seconds in early testing. Treat the mechanism as the lesson and the number as a single team's result.

Routing on the answer and its confidence

TypeSafe's intent-routing pattern is a compact graph design. One request asks a Choice over order_status, product_question, return_exchange, and complaint, plus a Score for complexity. Intent confidence below 0.5 routes to a human regardless of the label. order_status goes to deterministic code with no model call. Complaints escalate when complexity is above level 1 or its confidence is below 0.5.

The confidence-gated routing pattern adds a second axis. In the voice-banking example, anything below 0.6 confidence goes to a support agent before the action is considered. check_balance can act at 0.6 because the worst case is a wrong read-out; approve_transfer needs more than 0.85, or the user confirms first. The graph edge is the policy.

That is the design worth copying: a confidence gate on the edge, with different thresholds per action, and the irreversible actions keeping hard limits in code. A single global threshold hides the difference between a wrong answer and a costly one. The intent-routing page makes the same point about routing on the pair of answer and confidence rather than either alone.

A judge node, with evidence

LangChain's LangSmith team published a Jev-as-a-judge evaluation on a fixed dataset of five captured weather-agent runs from a Deep Agents harness. Over 500 repeated binary does_pass decisions, Jev matched the human oracle on all 500; GPT-5.6 Terra matched 99.8%, Luna 96.4%, and Claude Sonnet 4.6 80.0%. Jev's mean per-case quality-score variance was 0.0000149, described as 92–913x lower than the three LLM judges. It averaged 0.44 seconds and $0.00035 per call: $0.34 total against $28.17 for Claude.

The caveats belong next to the numbers. It was five fixed runs, a narrow test by LangChain's own description, using langchain-typesafe 0.0.1a2 with the Jev service version unrecorded; the post says the results still need to be shown on other agents and production workflows. It is a reason to try a judge node, not a guarantee that your judge will agree with your reviewers.

A judge node is still a graph node. Write the verdict and the confidence into state, route disagreements to a human review queue, and log the model version. If the judge is asked several questions, keep them independent; a question that depends on another answer needs a second request, not a clever prompt.

Skill routing in a deep agent

langchain-skill-router is a community middleware for deepagents that replaces SkillsMiddleware with per-turn judging. It ranks skills, gates whether any is needed, and verifies the top candidates against their SKILL.md files. A pick verified at 0.9 or higher is loaded with its instructions; otherwise the model gets a short list of up to three candidates and a find_skill tool. Each turn is capped at two seconds by default.

The README claims roughly a fourfold context reduction per turn while keeping the right skill in front of the model, but the digest does not include the intervals or full test details. Two operational details are more useful than the headline. A judge timeout or outage hands the agent the full catalog, exactly as it would without the router, while bad credentials raise. And the judge declares its limits (for Jev, 32k tokens and 255 options), so a larger catalog is split into parts and the winners are ranked again.

Hybrid Intent Router takes the opposite trade. It cascades regex and tries, TF-IDF with CatBoost, System One models (Laya, Jev, CLM), then a generative LLM fallback, and keeps a replayable decision record at every exit. It runs fully local on Ollama with no API keys. The README is truncated in the catalog, so setup and accuracy remain unverified; the repository had 0 stars at review.

The JavaScript side and the Noul argument

LangChain.js is the TypeScript counterpart: 18,270 stars, MIT, and documented runs on Node 20/22/24, Cloudflare Workers, Vercel/Next.js, Supabase Edge, browsers, Deno, and Bun. Its README also never mentions Jev. If you need the bridge there, you are writing it or using a community adapter; the Python langchain-typesafe package does not cover it.

LangChain's short Noul explainer makes the case for a probability over a paragraph followed by a boolean: the boolean leaves one bit you cannot threshold, while a Noul returns a probability code can branch on. The clip is a product demo, not a PII benchmark; its timings and probabilities are illustrative, and the only concrete range it offers is TypeSafe's documented 70–500 ms. That is still the right argument for a graph. A threshold needs a number, not a sentence.

Node patternInputOutputBest use
RouterState + intent ChoiceLabel + confidenceSend work to code, a specialist, or a human
GateState + NoulProbabilityAllow, block, or review an action
JudgeState + pass/fail + quality ScoreVerdict + scoreEvaluate an agent run or a document
Skill pickerCatalog + turn contextRanked skillsKeep a large skill library out of the prompt

What to measure

Instrument the graph, not just the model. Record the answer, confidence, model id, and the edge taken. Then measure the rate at which each edge was wrong, not the model's overall accuracy. A router that is 95% accurate but sends the costly 5% to the wrong handler is worse than one that abstains more often. Agent Workflow Evals, Traces, and Harnesses covers the trace side; Decision Gates in Agent Frameworks compares the surrounding frameworks.

LangGraph's value is that the decision is visible. You can point at the node, the question, the threshold, and the edge. Keep that visibility when you add Jev: one node, one question set, one confidence policy, and a review path for the cases the graph cannot settle. Routing Models, Tools, and Skills with Jev goes deeper on the routing half.

From the Jev directory

The resources behind this article.

LangChain deepagents middleware that replaces SkillsMiddleware with per-turn judging, loading only the SKILL.md files a turn needs so large catalogs stay out of the prompt.
Jev Agents & MCP#community#jevbest#catalog-import
An explainable intent router that cascades regex, TF-IDF with CatBoost, System One decision models (Laya, Jev, CLM) and a generative LLM fallback, answering from the cheapest engine able to decide and leaving a replayable decision record. Runs fully local.
Jev Tools & CLIs#community#github#python
148kGitHub stars
LangChain is the agent engineering platform: an MIT-licensed Python framework from the LangChain team for building agents and LLM applications by chaining interoperable components with third-party model, tool, and vector-store integrations.
Jev Repos & SDKs#community#catalog-import#cobanov
LangChain's LangSmith team benchmarks Jev as an agent evaluator against GPT-5.6 Luna, Terra, and Claude Sonnet 4.6 on five captured weather-agent runs. Jev matched the human oracle on all 500 binary pass/fail decisions with 92-913x lower quality-score variance and cost $0.00035 per call.
Jev Benchmarks & EvaluationsArticle#community#evals#langsmith
Community
LangChain's September 25 post argues Jev's typed decisions fit LangGraph's deterministic orchestration, with a litigation review example and a Stagehand browser case where act() latency fell to 0.46 seconds.
Jev Media & TalksArticle#community#press#explainer
Community
LangChain's langchain-typesafe integration exposes Jev as a TypeSafeClassifier plus experimental model-routing and auto-mode middleware that screens risky tool calls before execution.
Jev Tools & CLIsArticle#community#integration#python
Community
18.3kGitHub stars
LangChain.js is the TypeScript edition of LangChain, a framework for LLM-powered applications that runs on Node.js, Cloudflare Workers, Vercel and Next.js, Supabase Edge Functions, browsers, Deno, and Bun.
Jev Repos & SDKs#community#catalog-import#cobanov
Use the answer to decide what to do and confidence to decide whether to act: the voice-banking example routes below 0.6 to a human and needs 0.85 or more to auto-approve a transfer.
Jev Practices & PatternsDocs#official#patterns#confidence
Official
Classify intent with a Choice and complexity with a Score, then send each branch to deterministic code, a specialist model, or a person, with a 0.5 intent-confidence floor.
Jev Practices & PatternsDocs#official#patterns#routing
Official
LangChain contrasts an LLM that writes a paragraph and then a boolean with a Noul probability you can threshold, via langchain-typesafe.
Jev Media & TalksVideo#community#video#routing
Community
Back to all articles

Related Jev articles

How Pydantic AI, Mastra, TanStack AI, DSPy, Spring AI, and LiteLLM expose Jev: where the typed decision sits in the loop, what each integration returns, and which big frameworks are only adjacent.
Jev Integrations & Adapters#agents#frameworks#integrations
Read article
One key, many providers: how decision models fit OpenRouter's routing, what the response shapes look like, and where fallbacks belong.
Jev Integrations & Adapters#integrations#openrouter#routing
Read article

From the Jev AI model community

Posts from builders shipping with Jev right now.

Follow @typesafeai