Open History to see the last commit
1---
2id: RunFinishedEvent
3title: RunFinishedEvent
4---
5
6# Interface: RunFinishedEvent
7
8Defined in: [packages/typescript/ai/src/types.ts:917](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L917)
9
10Emitted when a run completes successfully.
11
12@ag-ui/core provides: `threadId`, `runId`, `result?`
13TanStack AI adds: `model?`, `finishReason?`, `usage?`
14
15## Extends
16
17- `RunFinishedEvent`
18
19## Indexable
20
21```ts
22[k: string]: unknown
23```
24
25## Properties
26
27### finishReason?
28
29```ts
30optional finishReason: "length" | "stop" | "content_filter" | "tool_calls" | null;
31```
32
33Defined in: [packages/typescript/ai/src/types.ts:921](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L921)
34
35Why the generation stopped
36
37***
38
39### model?
40
41```ts
42optional model: string;
43```
44
45Defined in: [packages/typescript/ai/src/types.ts:919](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L919)
46
47Model identifier for multi-model support
48
49***
50
51### usage?
52
53```ts
54optional usage: object;
55```
56
57Defined in: [packages/typescript/ai/src/types.ts:923](https://github.com/TanStack/ai/blob/main/packages/typescript/ai/src/types.ts#L923)
58
59Token usage statistics
60
61#### completionTokens
62
63```ts
64completionTokens: number;
65```
66
67#### promptTokens
68
69```ts
70promptTokens: number;
71```
72
73#### totalTokens
74
75```ts
76totalTokens: number;
77```