Tool Result • AI Agent SDK
ToolResult: Wrapper for tool execution results.
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
AnyNo description available.
boolNo description available.
Optional[str]No description available.
OptionalNo description available.
OptionalNo description available.
AnyNo description available.
Methods
Internal & Generic Methods
- to_dict: Generic utility method.
Source
View on GitHubpraisonaiagents/tools/base.py at line 32