Skip to content

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

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

feat(ai): add experimental callbacks in generateText#12654
aayush-kapoor merged 30 commits intomainfrom
aayush/telemetry-redesign

Conversation

@aayush-kapoor
Copy link
Copy Markdown
Collaborator

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

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
17 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 linked an issue Apr 9, 2026 that may be closed by this pull request
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

add experimental callbacks to all core functions

3 participants