Open History to see the last commit
1---
2id: AgentLoopState
3title: AgentLoopState
4---
5
6# Interface: AgentLoopState
7
8Defined in: [packages/typescript/ai/src/types.ts:702](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L702)
9
10State passed to agent loop strategy for determining whether to continue
11
12## Properties
13
14### finishReason
15
16```ts
17finishReason: string | null;
18```
19
20Defined in: [packages/typescript/ai/src/types.ts:708](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L708)
21
22Finish reason from the last response
23
24***
25
26### iterationCount
27
28```ts
29iterationCount: number;
30```
31
32Defined in: [packages/typescript/ai/src/types.ts:704](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L704)
33
34Current iteration count (0-indexed)
35
36***
37
38### messages
39
40```ts
41messages: ModelMessage<
42 | string
43 | ContentPart<unknown, unknown, unknown, unknown, unknown>[]
44 | null>[];
45```
46
47Defined in: [packages/typescript/ai/src/types.ts:706](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L706)
48
49Current messages array