docs: improve tool execution error documentation#14000
Open
nielskaspers wants to merge 1 commit intovercel:mainfrom
Open
docs: improve tool execution error documentation#14000nielskaspers wants to merge 1 commit intovercel:mainfrom
nielskaspers wants to merge 1 commit intovercel:mainfrom
Conversation
Expand documentation for how tool execution errors are handled in the AI SDK. When a tool's execute function throws, the error is caught and represented as a tool-error content part rather than being re-thrown. This enables multi-step tool use where the model can see and recover from failures. Changes: - Expand "Handling Errors" section in tools-and-tool-calling with detailed explanation of tool-error content parts and their properties - Add separate generateText and streamText examples showing how to inspect tool-error parts - Add section on monitoring tool errors via onToolCallFinish listener - Add "Handling tool execution errors" section to core error-handling page with cross-link to tool calling docs Fixes vercel#13798
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
executefunction throws, the SDK catches the error and represents it as atool-errorcontent part instead of re-throwingtool-errorcontent part properties (type,toolCallId,toolName,input,error)generateTextandstreamTextexamples showing how to inspecttool-errorpartsexperimental_onToolCallFinishevent listenerIssue
Fixes #13798
Testing
ToolExecutionErrorclass)