jev-decision-gateway
Gateway that batches agent control questions through Jev and calls a generative LLM only when policy says generation is needed.
Overview
jev-decision-gateway sits in front of expensive generative models. Application and agent code send the small, bounded questions Jev handles well (which tool next, should the agent continue, does the output pass verification, which model tier) and a deterministic policy layer turns Jev's typed, confidence-scored answers into an execution plan. A real LLM is invoked only for the step that needs text.
The README contrasts a loop that makes four LLM calls per iteration, three of them for decisions, with one gateway.evaluate() call returning nextTool, shouldContinue, verifyOutput and modelTier, followed by a single generation call at the chosen tier. A flagship example (an agent runtime optimiser) and a benchmark scenario implement this shape. It uses the @typesafe-ai/sdk package.
What the decision model decides
| Type | Question | Answers |
|---|---|---|
| Choice | Which tool should the agent use next? | — |
| Yes / no | Should the agent keep going? | — |
| Yes / no | Does this output pass verification? | — |
| Choice | Which model tier should generate the final answer? | — |
How it works
- Agent loop calls gateway.evaluate() with current state
- Jev answers next tool, continue, verify and model tier in one call
- Policy layer converts answers and confidences into a plan
- Invoke the LLM once at the selected tier when generation is needed
Strengths
- Replaces several decision-only LLM calls with one Jev call
- No parsing of free text into enums
- Deterministic policy keeps control of actions
Caveats
- Benchmark scenario results not summarised in the excerpt
- Requires a TypeSafe key plus an LLM provider
Getting started
See 'Run the flagship example and benchmark' in the README (examples/agent-runtime-optimizer and benchmark/ai-agent-scenario).At a glance
- Type
- Service
- Status
- prototype
- Language
- TypeScript
- Runtime
- Node service
- Has code
- yes
- License
- MIT
Use cases and integrations
How curated lists describe it
A gateway that asks Jev continue / tool / verify questions and invokes a generative LLM only when policy says generation is needed.
logicrw/awesome-jev-projects
Frequently asked questions
What does Jev decide?
Next tool, whether to continue, whether output passes, and which model tier should generate.
How does it save cost?
Decision questions go to Jev in one batched call; the LLM runs only when text generation is needed.
Who owns the final action?
A deterministic policy layer converts Jev's answers into the execution plan.
Related projects
OpenCode orchestrator that keeps a cheap sticky parent model and escalates to strong child subagents only when Jev flags a hard turn.
ProjectbetaTypeScriptAdaptive thinking-level router for Pi: Jev or local rules pick low/medium/high/xhigh at task start, on reasoning failures and when stable.
ProjectbetaTypeScriptRuns Claude Code on Opus 5.5 with Jev re-picking reasoning effort after every tool batch, via per-message effort so the cache survives.
ProxybetaTypeScriptLocal-first routing engine for long-running agent tasks that uses a Jev decider to pick a model group per turn.
PluginproductionRust, TypeScriptOpen-source AI gateway for 100+ LLMs that can use Jev to classify requests for complexity routing and to compact tool results.
ProxyproductionPythonOpen-source workspace for running and reviewing AI coding agents across devices, with an optional Jev-based automatic model router.
ProjectproductionTypeScript