0
Fork 0
mirror of https://github.com/TanStack/ai.git synced 2026-11-16 19:38:41 +00:00
ai/docs/reference/interfaces/AgentLoopState.md
github-actions[bot] 1999af2267
docs: regenerate API documentation (#1260)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2026-08-28 11:42:19 +02:00

1.7 KiB

id title
AgentLoopState AgentLoopState

Interface: AgentLoopState

Defined in: packages/ai/src/types.ts:929

State passed to agent loop strategy for determining whether to continue

Properties

finishReason

finishReason: string | null;

Defined in: packages/ai/src/types.ts:935

Finish reason from the last response


iterationCount

iterationCount: number;

Defined in: packages/ai/src/types.ts:931

Current iteration count (0-indexed). One iteration = one model turn.


lastTurnToolCallCount

lastTurnToolCallCount: number;

Defined in: packages/ai/src/types.ts:947

Tool calls in the most recent batch — a live model turn or a pending/resume batch (0 when the last phase produced no tool calls).


messages

messages: ModelMessage<
  | string
  | ContentPart<unknown, unknown, unknown, unknown, unknown>[]
  | null>[];

Defined in: packages/ai/src/types.ts:933

Current messages array


toolCallCount

toolCallCount: number;

Defined in: packages/ai/src/types.ts:942

Cumulative tool calls counted so far in this run (model-emitted during the agent loop, including ones skipped by middleware, and pending tools from the inbound message list when resumed). Not a recount of full message history; not model turns.