Place Jev at a decision point inside an agent loop. Jev evaluates state against typed questions and returns decisions with probabilities. Use those judgments to select a next step or check a proposed action. Keep tool execution and policy in application code, and use a generative model for replies.
Copy link to headingWhich component owns each part of the loop?
Design the agent loop so the model interprets requests and proposes actions, while application code checks permissions and validates arguments before invoking a tool. In the deployment investigation below, each tool result informs the next decision, helping the agent determine what to inspect or explain next.
This division follows TypeSafe's recommendation to keep workflow execution in code and use focused model judgments. Keep the permission check close to execution so that every path to a tool passes through it.
One useful review question is whether you can point to the exact code that authorizes a tool call. If authorization exists only as an instruction in a prompt, make it an application check before connecting tools that can change production.
Copy link to headingHow would a deployment investigation work?
Suppose a user asks why a deployment failed. Given a deployment record and a short error summary, your application could ask Jev to choose:
Inspect the build logs.
Inspect the deployment configuration.
Ask the user for missing information.
Your application maps the selected action to a tool and validates the project and deployment identifiers before execution. Choosing “inspect build logs” should use the credentials and access permissions already established by the application.
When the log tool returns, save its result and completion status so the next decision can account for work already done. Enforce a limit on repeated actions to prevent the agent from fetching the same evidence indefinitely.
If the logs suggest a configuration mismatch, the agent can investigate further within its existing permissions. Changing that configuration requires a separate permission check and, in this example, explicit approval.
Once the investigation ends, give the generative model the tool results and unresolved questions so it can explain the findings without presenting a proposed diagnosis as a confirmed cause.
Copy link to headingWhich questions can share an evaluation?
Questions that use the same evidence can be independent even when application code combines their answers. In the initial deployment state, you might ask which evidence source to inspect and whether the error summary mentions a missing setting. Neither question needs the other's answer.
Jev evaluates same-request questions independently; new evidence or answer-dependent options require another request. Asking about log contents before fetching the logs creates a dependency that batching cannot remove.
Sketch the evidence dependencies before deciding how many model calls to make. In this example, the log lookup separates the initial routing decision from the later diagnosis. Keep that separation visible in state and in your execution trace.
Copy link to headingHow can a router choose a hidden specialist?
When an investigation needs specialist help, give each specialist a distinct responsibility. For the deployment example, a build specialist could investigate compilation failures, while a configuration specialist examines differences between environments. Describing both as “debug deployment problems” gives the router little basis for choosing between them.
You can implement this pattern with eve, Vercel’s framework for building agents. Its workflow tools let the parent agent delegate through a router, with Jev selecting which specialist receives the task.
In eve, “hidden” means the specialist is absent from the parent model’s tool list:
tool: falsehides the specialist’s tool from the parent.ctx.agentsprovides specialist descriptions for routing.ctx.agent()checks availability and invokes the selected specialist.
For a deployment investigation, the routing workflow follows this sequence:
The parent sends the investigation task to the router.
Jev uses the task and specialist descriptions to make a typed choice.
The workflow calls the specialist and returns its findings to the parent.
The evaluation runs inside a "use step" helper so workflow replay can reuse its recorded result. The workflow body then calls ctx.agent() with the selected target. This preserves the routing decision when execution resumes and gives the parent a consistent way to receive findings from different specialists.
Placement determines which decisions Jev controls. When routing lives inside a tool, the parent still decides whether to delegate. If every incoming request must pass through Jev, put the routing step before the parent model runs.
Record the selected specialist alongside the evidence it received. When an investigation goes wrong, that record helps distinguish an incorrect assignment from a specialist working with incomplete logs.
Copy link to headingWhat should happen when a step fails?
When a log request times out, record the failure explicitly so the agent can distinguish unavailable evidence from a deployment that produced no logs. Passing an empty log field would obscure that difference and could lead the next decision to rely on an incorrect assumption.
Retry temporary read failures within a fixed retry budget, then return a “logs unavailable” result if the attempts fail. An invalid deployment identifier needs correction before another lookup. Record each attempt’s outcome so the investigation can account for failed requests and avoid repeating them indefinitely.
Keep retries separate from routing decisions. If the build specialist cannot retrieve logs, switching specialists may leave the same problem unresolved. Reconsider the route when new evidence changes the investigation, such as logs pointing to an environment configuration issue, and include that evidence in the next evaluation.
When the workflow resumes with unchanged input, reuse the recorded routing decision. If updated evidence requires a new evaluation, record its result separately so the investigation history shows what changed.
Copy link to headingHow do AI Gateway and AI SDK support Jev?
AI Gateway provides access to Jev through AI SDK’s experimental_evaluate, using the model ID typesafe-ai/jev. You can ask Choice, Score, or Boolean questions and use the answers in your application’s routing logic. Gateway evaluation requires AI SDK; its compatibility endpoints don’t support these calls.
Copy link to headingWhat are the boundaries of model control?
Jev doesn’t generate prose or explain its reasoning, so pair it with a chat model to turn the investigation’s findings into a written response. Because a typed decision can still be wrong, application code must enforce permissions regardless of the action the model selects.
Test whether the deployment workflow respects those limits when information is missing or access is denied. It should request clarification for a missing deployment identifier and preserve a denied log request without attempting to bypass it. When the available evidence doesn’t establish a cause, the investigation should end with an explanation of what remains unresolved.
Copy link to headingFrequently asked questions
Copy link to headingCan Jev execute an agent tool by itself?
No. Your application invokes tools; Jev supplies judgments within a workflow that code runs. Treat a selected action as input to the tool runner's checks.
Copy link to headingWhich agent decisions can a decision model handle?
Consider bounded choices such as selecting the next evidence source or assessing a proposed action against stated criteria. Jev takes typed questions about supplied state, so define each question around the information available.
Copy link to headingCan dependent decisions share one evaluation request?
Separate decisions when a later question needs evidence or options produced by an earlier result. Jev's questions within a request cannot consume each other's answers. Independent questions can share the same evaluation.
Copy link to headingDoes a model guardrail replace tool permissions?
No. Enforce access rules and required approvals in application code before executing a tool. TypeSafe places workflow control in code; a model judgment can contribute to a check without granting access.
Copy link to headingDoes LangChain support Jev?
For agents built with LangChain, TypeSafeClassifier accepts state and questions directly, while experimental middleware places Jev at specific points in the agent loop. ModelRouterMiddleware handles model selection, and AutoModeMiddleware checks tool calls before execution. These integrations connect Jev’s decisions to the surrounding workflow, where application code controls what runs next.