A derivative-free optimizer in which a language-model agent chooses numerical-method campaigns in a shared decision space, with a textbook autopilot as the fixed-policy fallback.
Release: coming soon
solve(fun, x0, options)
Opaque scalar objective
Unconstrained
Budget counted in function evaluations
Runtime dependency: NumPy
What it is
NextEval Solver minimizes a scalar objective on Rn from function values alone: solve(fun, x0, options=None). A language-model agent selects numerical methods, reads evidence, continues or switches methods, and decides when to finish. A trusted environment owns objective access, validation, function-evaluation accounting, the immutable history, and method state.
Shared decision space. The solver has one toolset. The agent and the autopilot act on the same tools with the same parameters: bounded campaigns of numerical methods, single sampling actions, reads that perform no function evaluations, and the agent's own analysis code. Every actual objective call goes through one transaction and one ledger.
Textbook autopilot. The autopilot is a fixed policy over that space and calls no model: trust-region slices of 2n+1 evaluations with textbook defaults (initial radius 1.0, 2n+1 interpolation points), a reset at the initial radius after a floor, a stall, or two method calls that spent nothing, and finalize after six such calls in a row. By default it is the fallback: when the agent session raises, reports an error or a timeout, or stops without finalize while budget remains, the autopilot spends the rest from the current ledger in the same run.
The solver treats fun as an opaque oracle. It does not inspect source code, problem names, known optima, or verifiers, and it does not support bounds, constraints or derivatives. Dimensions and evaluation budgets are configurable; the default budget is 200 function evaluations.
The agent and the autopilot differ only in who decides. Both reach the objective through the same tools, and the environment performs and meters every function evaluation. When the agent session fails or stops without finalize, the autopilot takes over the remaining budget on the same ledger.
Release: coming soonThe package and its repository are not public yet. The install command and the repository link appear here with the release.
Configure a model provider (the User Guide lists the environment variables), then minimize a function from Python:
import numpy as np
from nexteval import solve
result = solve(
lambda x: float(x @ x),
np.array([2.0, -1.0, 0.5]),
options={"model": "env", "maxfev": 80, "seed": 7, "trace": "off"},
)
print(result.fun, result.nfev, result.status)
print(result.runner_report["fallback"]) # whether the autopilot completed the run
maxfev is the ceiling on actual objective calls, including the initial point and failed calls. A missing model configuration is an error before the objective is evaluated.
The tool surface
One runner owns the whole solve and talks to the environment only through these tools. There is no tool for recording: the environment appends every ledger and trace record itself.
A bounded run of one method inside the environment, reported step by step: trust region with minimum-Frobenius-norm quadratic models, line search, positive-basis polling, coordinate search, Newton steps, geometry repair, a global polynomial surrogate.
One per step, capped per call and by the remaining budget
Own analysis
run_analysis
The agent's own Python on a read-only copy of every evaluation; the candidate points it returns are evaluated in order.
None for the analysis; one per candidate
Single actions
execute_action
One step from the catalog, such as model_step, geometry_repair, direction_step, poll_set or explicit_points, for a hand-chosen move.
One point or one batch
Episode control
finalize
Ends the task deliberately. The result is the best valid recorded point; a method's own stop never ends the task.
A runner connects a model to the tools for one complete solve. The three runners share one prompt builder, one tool catalog and one session lifecycle.
DefaultNativeToolRunner
Built-in runner
solve and minimize use it, wrapped in FallbackRunner. It talks to a tool-calling model through the provider clients for Anthropic-compatible, OpenAI-compatible and Azure OpenAI endpoints, which need only the standard library.
AdapterCodexTaskRunner
Codex adapter
Runs a whole solve in one Codex app-server thread. Codex keeps the conversation and its context; the solver keeps the objective, ledger, method state and tools. It needs a separately installed Codex CLI.
AdapterClaudeCodeTaskRunner
Claude Code adapter
Runs a whole solve through the Claude Agent SDK with the same tools. It is an optional extra of the package and uses the existing Claude Code authentication unless an endpoint is configured.
A runner passed as minimize(..., runner=...) is used exactly as given. Wrap it in FallbackRunner to have the autopilot complete a run whose session fails or stops without finalize.