Repository navigation
v0.148.0
AI: per-step reasoning effort in prepareStep, and AgentController.reasoning() (#975)
New, nothing to migrate. See AI Context Window → Reasoning effort per step.
PrepareStepResulttakesreasoningandmaxOutputTokens, for that model call only; the next step goes back to the run's. Capability-gated like the agent'sreasoning. Only the request'sreasoningfield changes: messages, instructions, tools and replayed reasoning items are sent as before.PrepareStepContexthas three new fields:reasoningandmaxOutputTokens(what the call would send, after earlier hooks) andbody(the turn's request body fields, client-controlled). Code that builds aPrepareStepContextby hand (a test calling a hook directly) must add them.AgentController.reasoning(req, { body }): a per-turn effort, called once per turn besideinstructions(). Answering nothing keeps the agent's.
AI: endsRun on a tool, ending the run without another model call (#974)
New, nothing to migrate. See AI Tools That End the Run.
AgentTool.create({ ..., endsRun }):true, or(output, ctx) => string | boolean | null | undefined(may be async). After a successful call (status: "ok"), a string ends the run with that text as a new assistant message (streamed as onetext-delta, stored like any reply, nousage);trueor""ends it with no closing message;false/null/undefinedasks the model again, as before.- The run ends with
finishReason: "stop", also on the last stepmaxStepsallows. With several calls in one step, it ends only if every call succeeded and asked to end; closing texts are joined in call order. A pending call still ends the runawaiting-input. - Only calls run in the step loop: a call approved on a later turn goes back to the model. A sub-agent's tool ends its sub-run, not the parent. Client tools can't set it. A function that throws is logged and the run carries on.
- New exported types:
ToolEndsRun,ToolEndsRunContext.