Summary
ImageOutput.save() in sdk/python/agentfield/multimodal_response.py ~line 99 calls requests.get(self.url) unconditionally on the URL branch, which raises InvalidSchema for data: URLs.
vision.generate_image_openrouter populates ImageOutput.url with whatever the OpenRouter response carries. For Gemini image models (e.g. google/gemini-2.5-flash-image), that value is a data:image/png;base64,... URL, not an HTTP URL.
Repro
from agentfield.multimodal_response import ImageOutput
img = ImageOutput(url="data:image/png;base64,iVBORw0KGgoAAAA...")
img.save("/tmp/out.png")
Error
requests.exceptions.InvalidSchema: No connection adapters were found for
'data:image/png;base64,iVBORw0KGgo...'
Suggested fix
In either:
generate_image_openrouter — when the response's url is a data: URL, base64-decode it once and populate b64_json instead, leaving url=None. Then the existing b64_json branch of save() handles it.
ImageOutput.save() / ImageOutput.get_bytes() — detect data: URLs and decode locally before falling through to requests.get.
Status
This is fixed on origin/main — get_bytes() now special-cases data: URLs and save() delegates to get_bytes(). The bug is still present in the latest released version agentfield==0.1.84, which is what surfaced this. Filing for visibility once an 0.1.85 release cuts so consumers can drop their workarounds.
Consumer workaround
reel-af ships a _save_image_output() helper plus a runtime monkey-patch (src/reel_af/sdk_patches.py::_patch_image_output_save) that sniffs data: URLs and decodes them itself before delegating back to the SDK for real HTTP URLs.
Found by the Python SDK consumer reel-af (an AgentField example pipeline).
Summary
ImageOutput.save()insdk/python/agentfield/multimodal_response.py~line 99 callsrequests.get(self.url)unconditionally on the URL branch, which raisesInvalidSchemafordata:URLs.vision.generate_image_openrouterpopulatesImageOutput.urlwith whatever the OpenRouter response carries. For Gemini image models (e.g.google/gemini-2.5-flash-image), that value is adata:image/png;base64,...URL, not an HTTP URL.Repro
Error
Suggested fix
In either:
generate_image_openrouter— when the response'surlis adata:URL, base64-decode it once and populateb64_jsoninstead, leavingurl=None. Then the existingb64_jsonbranch ofsave()handles it.ImageOutput.save()/ImageOutput.get_bytes()— detectdata:URLs and decode locally before falling through torequests.get.Status
This is fixed on
origin/main—get_bytes()now special-casesdata:URLs andsave()delegates toget_bytes(). The bug is still present in the latest released versionagentfield==0.1.84, which is what surfaced this. Filing for visibility once an 0.1.85 release cuts so consumers can drop their workarounds.Consumer workaround
reel-af ships a
_save_image_output()helper plus a runtime monkey-patch (src/reel_af/sdk_patches.py::_patch_image_output_save) that sniffsdata:URLs and decodes them itself before delegating back to the SDK for real HTTP URLs.Found by the Python SDK consumer
reel-af(an AgentField example pipeline).