feat(ai): pass assistant response into tool execution options (#11822) #11823
+29
−1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Background
When executing tools, developers may want access to the assistant's response that triggered the tool call - particularly for accessing reasoning content. Currently this requires manually handling the tool loop without providing an execute function, which adds boilerplate.
Summary
Added
currentModelResponsetoToolExecutionOptions, which provides access to the full assistant response during tool execution. This allows tools to access reasoning content and other response metadata without manual loop handling.currentModelResponseparameter toexecuteToolCallandexecuteToolsToolExecutionOptionsinterface in@ai-sdk/provider-utilsManual Verification
Updated existing tests to verify
currentModelResponseis passed correctly.Checklist
pnpm changesetin the project root)Future Work
I am passing the entire response object but we may want to limit this to just the content, I'm not sure here. It might be better to pass the entire response and let developers grab what they need.
Related Issues
#11822