agentRunMaxTurns top-level constant

int const agentRunMaxTurns

How many model turns a tool-using run may take before the SDK ends it.

Each tool call costs a turn, so a plain completion's maxTurns: 1 would end the run at the first call. Bounded all the same: a model that loops on a refusal must end in an error result the user sees, not run until the budget is gone. Twenty-four covers a read-modify-verify pass over a dozen sections, which is more than one instruction in the agent dialog asks for.

Implementation

const agentRunMaxTurns = 24;