Image Agent Tools
The generateImage@bxai built-in agent tool enables AI agents to generate images from text prompts and return file paths.
BoxLang AI ships with a built-in generateImage@bxai agent tool that enables AI agents to generate images from text prompts during conversations.
π€ generateImage@bxai
The ImageTools class (models/tools/image/ImageTools.bx) is auto-registered in the global tool registry at module startup. It generates an image from a text prompt, saves it to a file, and returns the absolute file path.
How It Works
Usage
Tool Parameters
prompt
string
β Yes
β
Text description of the image to generate
size
string
No
1024x1024
Image dimensions
quality
string
No
standard
Quality level (standard, hd)
style
string
No
""
Visual style (vivid, natural)
outputFile
string
No
(temp file)
File path to save the image (auto-generates temp file if omitted)
Return Value
Returns the absolute file path of the saved image as a string.
Auto-Generated Temp Files
When no outputFile is supplied, the tool auto-generates a temporary file in the system's temp directory:
Full Parameter Example
When an agent calls the tool with optional parameters, the generated image uses those settings:
π Using with Multiple Agents
π§ Custom Image Tool
If you need more control over image generation (specific provider, size, quality), create a custom tool:
Last updated