Skip to content

v0.148.0

Choose a tag to compare

@nstfkc nstfkc released this 16 Oct 16:29
· 337 commits to main since this release

AI: per-step reasoning effort in prepareStep, and AgentController.reasoning() (#975)

New, nothing to migrate. See AI Context Window → Reasoning effort per step.

  • PrepareStepResult takes reasoning and maxOutputTokens, for that model call only; the next step goes back to the run's. Capability-gated like the agent's reasoning. Only the request's reasoning field changes: messages, instructions, tools and replayed reasoning items are sent as before.
  • PrepareStepContext has three new fields: reasoning and maxOutputTokens (what the call would send, after earlier hooks) and body (the turn's request body fields, client-controlled). Code that builds a PrepareStepContext by hand (a test calling a hook directly) must add them.
  • AgentController.reasoning(req, { body }): a per-turn effort, called once per turn beside instructions(). 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 one text-delta, stored like any reply, no usage); true or "" ends it with no closing message; false/null/undefined asks the model again, as before.
  • The run ends with finishReason: "stop", also on the last step maxSteps allows. 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 run awaiting-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.