-
Notifications
You must be signed in to change notification settings - Fork 508
Closed
Labels
enhancementNew feature or requestNew feature or requestgood first issueGood for newcomersGood for newcomerspackage:agents-extensions
Milestone
Description
openai-agents-js/packages/agents-extensions/src/aiSdk.ts
Lines 996 to 1004 in 1900729
| span.setError({ | |
| message: 'Error streaming response', | |
| data: { | |
| error: | |
| request.tracing === true | |
| ? String(error) | |
| : error instanceof Error | |
| ? error.name | |
| : undefined, |
For example, when the LLM provider returns an error, the span here hardcodes the error message as "Error streaming response" and sets data.error to error.name (in this case, it's AI_APICallError). However, this information is insufficient for troubleshooting and may even obscure the issue. Additionally, the error contains fields like responseBody that could aid in debugging.
I hope span.setError can record the original error object, so that I can assemble the information I need in TracingProcessor.onSpanEnd. If you're concerned about directly passing a JS object affecting the toJSON method, you could...
catch (error) {
const errorData = {
error: request.tracing === true
? String(error)
: error instanceof Error
? error.name
: undefined
}
Object.defineProperty(errorData, 'originalError', {
value: error,
enumerable: false, // JSON.stringify will ignore originalError
writable: true,
configurable: true
})
// or
errorData[Symbol.for('originalError')] = error;
span.setError({
message: 'Error streaming response',
data: errorData
});
}Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requestgood first issueGood for newcomersGood for newcomerspackage:agents-extensions