diff --git a/docs/results.md b/docs/results.md index 52408d4a1..9952f289b 100644 --- a/docs/results.md +++ b/docs/results.md @@ -28,14 +28,27 @@ The [`last_agent`][agents.result.RunResultBase.last_agent] property contains the ## New items -The [`new_items`][agents.result.RunResultBase.new_items] property contains the new items generated during the run. The items are [`RunItem`][agents.items.RunItem]s. A run item wraps the raw item generated by the LLM. - -- [`MessageOutputItem`][agents.items.MessageOutputItem] indicates a message from the LLM. The raw item is the message generated. -- [`HandoffCallItem`][agents.items.HandoffCallItem] indicates that the LLM called the handoff tool. The raw item is the tool call item from the LLM. -- [`HandoffOutputItem`][agents.items.HandoffOutputItem] indicates that a handoff occurred. The raw item is the tool response to the handoff tool call. You can also access the source/target agents from the item. -- [`ToolCallItem`][agents.items.ToolCallItem] indicates that the LLM invoked a tool. -- [`ToolCallOutputItem`][agents.items.ToolCallOutputItem] indicates that a tool was called. The raw item is the tool response. You can also access the tool output from the item. -- [`ReasoningItem`][agents.items.ReasoningItem] indicates a reasoning item from the LLM. The raw item is the reasoning generated. +The [`new_items`][agents.result.RunResultBase.new_items] property contains a list of [`RunItem`][agents.items.RunItem]s generated during the run. The type of `RunItem` you receive depends on the agent's action. + +- **When the LLM gives a direct answer:** + + - [`MessageOutputItem`][agents.items.MessageOutputItem] indicates a final message from the LLM. The raw item is the message generated. + +- **When the LLM uses a tool:** + + - [`ToolCallItem`][agents.items.ToolCallItem] indicates that the LLM has decided to invoke a tool. + + - [`ToolCallOutputItem`][agents.items.ToolCallOutputItem] indicates that the tool was called and has returned a response. The raw item is the tool response. + +- **When a handoff occurs:** + + - [`HandoffCallItem`][agents.items.HandoffCallItem] indicates that the LLM called the handoff tool. + + - [`HandoffOutputItem`][agents.items.HandoffOutputItem] indicates that a handoff occurred. The raw item is the tool response to the handoff tool call. + +- **When the LLM is reasoning internally:** + + - [`ReasoningItem`][agents.items.ReasoningItem] indicates a reasoning item from the LLM. The raw item is the reasoning generated. This item appears when the LLM produces an internal thought process before deciding on its next action. ## Other information