Thanks for the earlier response. Could you also help me with this?
I’m currently working on a proof-of-concept where I’m using a RAG subagent as part of my Deep Agent (using the Deep Agents library). The retrieved chunks can contain text, images, tables, etc. Ideally, I’d like to pass the complete retrieved content, including images, to the model and have it generate the final response.
My current model (gemini-3.1-flash-lite) is text-output only, so whatever it generates is represented as text content. Even if the model outputs JSON describing an image, that JSON is still a text block and therefore isn’t rendered as an image by LangSmith Studio.
As a workaround, I keep the image reference IDs in the agent state and use @after_agent middleware to resolve them and add image_url blocks to the final AIMessage.
The images in my canonical representation are stored as base64-encoded data, and I have been able to render them in LangSmith Studio using:
{
"type": "image_url",
"image_url": {
"url": f"data:image/png;base64,{base64_str}",
},
}
Is there a native/recommended Deep Agents pattern where the retrieved multimodal content can be passed to the model and the resulting final AIMessage can contain both the generated text and the retrieved image blocks, without the @after_agent post-processing?
Passing the images to the model may be less efficient with a text-output model, but I’d prefer this architecture since it would also work naturally with a multimodal output model later.
I’m using LangGraph Dev/Agent Server with LangSmith Studio, and I’m not manually constructing the graph with LangGraph nodes.