Skip to content
providerkit
GitHub

RunLimits

Defined in: agents/src/types.ts:56

Limits for one run, not a whole tree of delegated runs. Cancellation is cooperative: an admitted call can still finish or incur a charge after the signal aborts.

optional activeMs?: number;

Defined in: agents/src/types.ts:72

Time this run may spend actively working in one attempt, paused while host.answerNow waits for a person in process. Time spent suspended between attempts never counts, and each resumed attempt starts with a fresh allowance. elapsedMs keeps its wall-clock meaning across resumes. Absent means no separate active-time cap.


optional costUsd?: number;

Defined in: agents/src/types.ts:88

USD this run may spend: its own model calls, compaction summaries included, what its tools report through context.reportCost, and the same for every agent it starts (helpers, specialists, handoff targets). host.priceModelCall prices each call when its usage arrives, and the journal keeps that price. Once the known cost reaches the limit, no new model call starts in the run or under it, and the run ends limited with costUsd. It limits starting calls, not the bill: calls already running when the limit is reached, such as parallel helpers or the rest of a tool batch, can finish above it. A call that never reported usage adds nothing. Absent means no limit. With AgentConfig.finish, reaching this run’s own limit buys one more call, its finish turn, so the limit is soft by that one bounded call. It is priced and counted like any other.


elapsedMs: number;

Defined in: agents/src/types.ts:67

Wall time, including time spent waiting for approval, across resumed attempts.


inlineBytes: number;

Defined in: agents/src/types.ts:77

Decoded bytes of the images and files sent inline, history and new turn together. The snapshot holds them, and every checkpoint writes the whole snapshot again, so large files belong behind a MediaRef. Zero accepts media references only.


parallelTools: number;

Defined in: agents/src/types.ts:73


toolCalls: number;

Defined in: agents/src/types.ts:65

A call host.screenCall refused, or one cancelled with the rest of its turn, does not count: it never started. That holds inside a code program too, where the program’s own call limit still counts it.


turns: number;

Defined in: agents/src/types.ts:61

Tool-capable model turns. Text agents may make one final tool-free call, still counted against the tree’s model-call budget. Checked-output agents and stopOnlyAtTools agents keep the hard cap: a tool-free call cannot end them. With AgentConfig.finish, every agent gets that one extra call, as its finish turn.