[Feature] Tool wrapper for runImage so agents can decide when to generate
Author: JackChen-meCreated Sep 23, 2026Updated Sep 23, 2026
LabelsenhancementP3source:analysis
Context
runImage() (#610) is called from application code. When the decision to generate or edit an image belongs to the model, for example an assistant that decides when to redraw, the application has to write its own custom tool around it and decide how the image gets back to the model.
Proposal
A helper that returns a tool definition wrapping runImage() with a fixed chain and options:
- Input schema: the prompt, an optional size, and references to input images. Raw image bytes never pass through tool input.
- Result: the image returned to the model as a rich tool result (image part, #466), plus a short text summary.
- Failure: a failed
runImage()becomes an errorToolResult, consistent with tool errors being values. - Attempt records still go to the application's
onAttempt, as with a direct call.
Open questions
- How the model refers to input images for an edit: indexes into the conversation, handles supplied by the application, or generation only in the first version.
- How the application receives the generated bytes for storage, since the tool result goes to the model.
- Context cost: a full-size image in every tool result is expensive. Whether the model should see a downscaled copy while the application keeps the original.
Why not now
Waiting for a concrete use case where the model, not the application, decides when to generate.
Split from #469.
Source: open-multi-agent/open-multi-agent