Automatic Model Selection
auto from eve/models chooses an agent model from an allowlist before each turn's inference. decide from eve/ai asks typed questions in your own tools or application code. Both use the AI SDK decision API. The decider can be a Vercel AI Gateway model ID or a decision model from an installed provider.
The AI SDK decision model specification is experimental and can change in patch releases.
Choose from Gateway models
Omit model to decide with typesafe-ai/jev, TypeSafe AI's Jev decision model. Like other AI SDK model strings, it resolves through Vercel AI Gateway unless the application configures a different global default provider.
Configure Gateway authentication as for any other AI SDK model; there is no separate TypeSafe credential. During eve dev, a Gateway decider uses the connection selected through /login, unless a configured AI SDK default provider resolves string models. The TUI footer shows dynamic model and then the turn's resolved model, such as dynamic model · openai/gpt-6-luna.
Set fallback to keep the turn running when the decider is unavailable or returns an error. The fallback can be a Gateway model ID, an AI SDK language model instance, or an object with model and a reasoning override:
The fallback applies only to decider failures. When eve switches, it logs a warning with the decider error and the fallback model. Invalid prompts and cancelled turns don't use the fallback; see Runtime behavior.
Set decider provider options
modelOptions.providerOptions applies to the decider's call. To keep it on Gateway providers with zero data retention:
An option's own modelOptions still configures the model it selects.
Use a provider directly
Install the provider package and pass its decision model. The provider owns its credentials and settings.
Any provider that implements the AI SDK Experimental_DecisionModel contract works.
Route to provider models and set reasoning
The decider sees each option's key. A string value describes the Gateway model whose ID is the key. Use the object form for a provider instance, an alias, or a reasoning override.
The decider sees option keys, descriptions, and recent text messages, never provider credentials or model instances. When it selects my_secret_model, eve resolves the key back to the authored Anthropic model.
Supported reasoning values are "provider-default", "none", "minimal", "low", "medium", "high", and "xhigh". Omit reasoning to inherit the agent's reasoning setting.
Decide inside a tool
decide asks choice, score, or boolean questions about the state you pass it. It defaults to typesafe-ai/jev with the same authentication as auto. Pass model to use another decision model ID or a provider instance.
The choice above is typed as "billing" | "support". Each answer appears under its question's key in result.answers, and usage holds normalized token usage. To use that choice to delegate while keeping specialist subagents out of the parent model's tools, see Route to a hidden subagent with Jev.
decide accepts model, state, questions, maxRetries, signal, and providerOptions; pass signal: ctx.abortSignal to cancel with the tool call. Import DecisionModel, DecisionState, DecisionStatePart, DecisionInput, DecisionQuestion, DecisionAnswer, DecisionOptions, and DecisionResult from eve/ai to type reusable configs and handlers.
A model instance must implement decision model specification v4, the version AI SDK 7 supports. A matching provider, modelId, and specificationVersion alone is not enough. If the installed ai package does not export a decision API, decide throws an error that names the missing export. Validation, retries, and provider errors follow AI SDK semantics.
decide also works outside a tool and doesn't need an active eve session.
Judge eval results
Eval authors can use t.judge(...) to turn decision answers into scored assertions, including batches of questions sharing one state. It uses decide and its default model. See Judge for criteria, rubrics, and thresholds.
Decide tool approvals
auto({ model? }) from eve/tools/approval lets a decision model decide whether a tool call runs automatically or needs human approval. It accepts the same decision model strings and provider instances and defaults to typesafe-ai/jev:
The decision model reviews the tool name and input for dangerous effects. A caution, failed review, or incomplete input requires human approval. See Human-in-the-loop approvals for classifier options and data handling, and the Auto-approve tool calls with Jev guide for an end-to-end walkthrough.
Runtime behavior
auto decides once per turn, before the first model call. The choice holds for the turn's later model calls, including in a fresh process. A new turn makes a new choice, and child sessions route from their own prompts.
The decider receives the turn's opening text and up to seven earlier user and assistant text messages, subject to the decision provider's input limits. Larger inputs can increase decision cost and latency. A request without user text fails before provider I/O.
Without fallback, a decider error fails the turn; with it, eve uses the fallback model for the rest of the turn. Cancelling the turn aborts the decision and keeps no routed or fallback choice. Validation, retries, provider errors, and model resolution follow AI SDK semantics.