Problem
When an agent invokes a tool, the tool_output stream event always has the same structure regardless of whether the tool succeeded or failed. Both successful results and error messages end up in the output field with no indication of which is which.
This makes it impossible for a UI to properly present tool execution results - it can't tell if the output represents a successful tool result or an error message.
Current Behavior
RunItemStreamEvent(
name="tool_output",
item=ToolCallOutputItem(
output="some result", # Could be success OR error message
raw_item={...},
agent=agent
)
)
My question; is this behavior intentional? Are there design reasons for not distinguishing success/error states? Is extending the ToolCallOutputItem data model to have an is_error flag a welcome contribution?