Skip to content

fix: rename onFinish to onEnd#15245

Merged
lgrammel merged 18 commits into
mainfrom
lg/fTTO4TTp
May 27, 2026
Merged

fix: rename onFinish to onEnd#15245
lgrammel merged 18 commits into
mainfrom
lg/fTTO4TTp

Conversation

@lgrammel
Copy link
Copy Markdown
Collaborator

@lgrammel lgrammel commented May 13, 2026

Background

We are standardizes on End over Finish, and results should be accumulative.

Summary

  • Renames the final lifecycle callback from onFinish to onEnd for generateText, streamText, Agent, ToolLoopAgent, and WorkflowAgent; onFinish remains as a deprecated alias, with onEnd taking precedence.
  • Updates final callback result semantics so usage, content, toolCalls, toolResults, files, sources, and warnings aggregate across all steps, while final-step-only data is available through finalStep.
  • Adds/deprecates the corresponding callback types (GenerateTextOnEndCallback, WorkflowAgentOnEndCallback) and updates telemetry to use the new onEnd event shape.
  • Updates docs, examples, references, and the AI SDK 7 migration guide to describe the onEnd rename and the new aggregated final event fields.

- Marked `reasoning`, `reasoningText`, `request`, `response`, `providerMetadata`, and `totalUsage` as deprecated in `GenerateTextEndEvent`.
- Updated documentation to suggest using `finalStep` properties as alternatives.
- Replaced `totalUsage` with `usage` in telemetry events across multiple files for consistency.
- Renamed `onFinish` to `onEnd` in relevant types and functions to standardize terminology.
- Deprecated `totalUsage` in `GenerateTextEndEvent` and updated related documentation.
- Adjusted console logs and examples to reflect the new property names.
@lgrammel lgrammel changed the title 1 fix: rename onFinish to onEnd May 15, 2026
@lgrammel lgrammel marked this pull request as ready for review May 15, 2026 16:08
@lgrammel lgrammel merged commit e67d80e into main May 27, 2026
48 checks passed
@lgrammel lgrammel deleted the lg/fTTO4TTp branch May 27, 2026 07:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants