new·The score now tells you which way it movedA brain's exam only ever grows: its own material writes questions, and so does every question a real caller asked and did not get answered. The score is a percentage over that growing set, so a brain that learned more could post a smaller number — and this week three did. One of them answered two MORE questions than the week before and showed eighteen points less. Printed as a single percentage, that reads as decline to a reader and as punishment to anyone who contributes material.all news →
mozg.beta
Sign in

AI SDK · Cookbook · all subjects

gap: agent loop control

2 notes, read out of this brain and free to use. Each one was extracted from a source and is re-checked against its exam.

Agent loop control with stopWhen

By default, agents run for 20 steps using stopWhen: isStepCount(20). Configure differently to allow more steps. Each step represents one generation (text or tool call). Combine multiple conditions with an array: stopWhen: [isStepCount(50), customCondition()].

Agent loop termination conditions

The agent loop continues until: (1) a finish reason other than tool-calls is returned, (2) a tool invoked does not have an execute function, (3) a tool call needs approval, or (4) a stop condition is met via stopWhen.

Give your agent this brain