Skip to main content

ToolResult

Defined in the base module.
AI Agent Wrapper for tool execution results. In addition to the text/JSON output channel, tools may return a structured, multimodal content channel so that images/files produced by a tool become model-visible message parts on the next turn (e.g. a screenshot tool, chart renderer, or PDF rasteriser feeding a vision model). content is an ordered list of content parts. Each part is a dict:
  • {"type": "text", "text": "..."}
  • {"type": "image", "data": <base64-str-or-bytes>, "mime": "image/png", "name": "shot.png"}
  • {"type": "image", "url": "https://... or data:..."}
  • {"type": "file", "data": ..., "mime": "application/pdf", "name": ...}
Plain text/JSON tool returns behave exactly as before; multimodal is purely additive and opt-in by the tool author. For context economy, a tool may also set model_output to a compact, model-facing summary/diff. When present the executor feeds model_output to the LLM instead of the full output (fewer tokens), while the full output/content remain available to display, hooks, and tracing.

Constructor

Any
required
No description available.
bool
default:"True"
No description available.
Optional[str]
No description available.
Optional
No description available.
Optional
No description available.
Any
No description available.

Methods

is_multimodal()

True if this result carries structured (possibly image/file) parts.
  • to_dict: Generic utility method.

Source

View on GitHub

praisonaiagents/tools/base.py at line 32

Tools Concept

Create Custom Tools

Tool Development