InvokeLimits
Defined in: src/types/agent.ts:188
Limits for the request a top-level invoke() / stream() call starts. Each
is optional; omit a field for no limit on that dimension. Token limits count
every model call in the request, unlike a provider’s per-call maxTokens, and
are checked before each turn, so the last turn can go over a limit, more so
when nested calls run in parallel. A model response counts as one failed
structured output attempt when it calls the structured output tool with invalid
input, or doesn’t return valid structured output while the tool is forced,
including when a content filter or guardrail stops it. See
InvokeOptions.limits for what they cover.
Properties
Section titled “Properties”turns?
Section titled “turns?”turns?: number;Defined in: src/types/agent.ts:190
Maximum turns (one model call plus the tool calls it requests) across the request.
outputTokens?
Section titled “outputTokens?”outputTokens?: number;Defined in: src/types/agent.ts:193
Maximum model-generated tokens across every model call in the request.
totalTokens?
Section titled “totalTokens?”totalTokens?: number;Defined in: src/types/agent.ts:196
Maximum input + output tokens across every model call in the request; input grows each turn, so this compounds.
structuredOutputAttempts?
Section titled “structuredOutputAttempts?”structuredOutputAttempts?: number;Defined in: src/types/agent.ts:199
Maximum failed structured output attempts across the request; when omitted, retries are unbounded and a failed forced response throws StructuredOutputError.