Skip to content

feat(ai): add experimental callbacks in generateText - #12654

Merged
aayush-kapoor merged 30 commits into
mainfrom
aayush/telemetry-redesign
Feb 19, 2026
Merged

aayush-kapoor merged 30 commits into
mainfrom
aayush/telemetry-redesign

Conversation

@aayush-kapoor

@aayush-kapoor aayush-kapoor commented Feb 17, 2026 •

Copy link
Copy Markdown
Collaborator

Background

our current telemetry setup was heavily integrated with OTel. this is the first step in decoupling the telemetry from the core functions

Summary

  • added callback experimental_onStart that exposes the data/events that happen at the very beginning
  • added callback experimental_onStepStart
  • added callback experimental_onToolCallStart
  • added callback experimental_onToolCallFinish

Manual Verification

Checklist

  • Tests have been added / updated (for bug fixes / features)
  • Documentation has been added / updated (for bug fixes / features)
  • A patch changeset for relevant packages has been added (for bug fixes / features - run pnpm changeset in the project root)
  • I have reviewed this pull request (self-review)

Future Work

@tigent tigent Bot added ai/core core functions like generateText, streamText, etc. Provider utils, and provider spec. ai/telemetry feature New feature or request minor marker for PRs with minor version bump labels Feb 17, 2026
@aayush-kapoor aayush-kapoor removed the minor marker for PRs with minor version bump label Feb 17, 2026
@aayush-kapoor aayush-kapoor changed the title feat(ai): refactor telemetry feat(ai): add experimental callbacks in generateText Feb 18, 2026
@lgrammel

Copy link
Copy Markdown
Collaborator

For future PRs, we need something like onGenerationStart/onGenerationEnd that bounds the LLM call (not the full step)

| undefined,
experimental_context,
});
} catch (_ignored) {

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

future work: figure out how to log this; don't want to swallow errors

@aayush-kapoor
aayush-kapoor enabled auto-merge (squash) February 19, 2026 20:15
@aayush-kapoor
aayush-kapoor merged commit d3769ec into main Feb 19, 2026
16 checks passed
@aayush-kapoor
aayush-kapoor deleted the aayush/telemetry-redesign branch February 19, 2026 20:17
aayush-kapoor added a commit that referenced this pull request Feb 20, 2026
## Background

as a follow up to #12654, we will introduce the same callbacks for
streamText function

## Summary

- added callback `experimental_onStart` that exposes the data/events
that happen at the very beginning
- added callback `experimental_onStepStart`
- added callback `experimental_onToolCallStart`
- added callback `experimental_onToolCallFinish`

## Manual Verification



## Checklist

- [x] Tests have been added / updated (for bug fixes / features)
- [x] Documentation has been added / updated (for bug fixes / features)
- [x] A _patch_ changeset for relevant packages has been added (for bug
fixes / features - run `pnpm changeset` in the project root)
- [x] I have reviewed this pull request (self-review)

## Future Work

- add similar callbacks for the agent loop
aayush-kapoor added a commit that referenced this pull request Feb 20, 2026
## Background

as a follow up to #12654, we will
introduce the same callbacks for the `ToolLoopAgent`

## Summary

- added callback `experimental_onStart` that exposes the data/events
that happen at the very beginning
- added callback `experimental_onStepStart`
- added callback `experimental_onToolCallStart`
- added callback `experimental_onToolCallFinish`

## Manual Verification

## Future Work

- callbacks aren't currently passed through for streaming - will need to
merge #12708 first

## Checklist

- [x] Tests have been added / updated (for bug fixes / features)
- [x] Documentation has been added / updated (for bug fixes / features)
- [x] A _patch_ changeset for relevant packages has been added (for bug
fixes / features - run `pnpm changeset` in the project root)
- [x] I have reviewed this pull request (self-review)
@gr2m gr2m removed the ai/telemetry label Mar 6, 2026
@aayush-kapoor aayush-kapoor mentioned this pull request Apr 9, 2026
2 tasks
@aayush-kapoor aayush-kapoor linked an issue Apr 9, 2026 that may be closed by this pull request

This branch was successfully deployed

1 active deployment
Preview — 4d4571b1 Deployed Feb 19, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai/core core functions like generateText, streamText, etc. Provider utils, and provider spec. feature New feature or request task-merge-tracking-no-issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

add experimental callbacks to all core functions

3 participants