ToolResult

class ToolResult:

Special result type for tools that can return images along with text.

This class is used by ChatAgent to detect when a tool returns visual content that should be included in the conversation context.

init

def __init__(self, text: str, images: Optional[List[str]] = None):

Initialize a tool result.

Parameters:

  • text (str): The text description or result of the tool operation.
  • images (Optional[List[str]]): List of base64-encoded images to include in the conversation context. Images should be encoded as “data:image/{format};base64,{data}” format.

str

def __str__(self):

Return the text representation of the result.

repr

def __repr__(self):

Return a detailed representation of the result.