adk-samples icon indicating copy to clipboard operation
adk-samples copied to clipboard

*[HELP] Unable to access generated image artifact from deployed ADK agent on Google Cloud**

Open qudosabdu opened this issue 1 month ago • 2 comments

python/agents/marketing-agency

Name of sample affected

python/agents/marketing-agency


Description of issue

I deployed my ADK agent (marketing_agency) on Google Cloud (Reasoning Engine).
The agent successfully generates an image, but I can’t access or view the generated artifact after deployment.

The API response only includes:

"artifact_delta": { "image.png": 1 },
"response": { "result": "" }

I want to retrieve or view the actual image stored in the artifact storage, but there’s no clear documentation or example for doing that after deployment.


Environment

  • OS & Architecture: Windows 11 (amd64)
  • Python version: 3.10
  • ADK version: 1.15.1

Relevant sub-agent code

"""logo_create_agent: for creating logos"""

from google.adk import Agent
from google.adk.tools import ToolContext, load_artifacts
from google.genai import Client, types

from . import prompt

MODEL = "gemini-2.5-pro"
MODEL_IMAGE = "imagen-3.0-generate-002"


async def generate_image(img_prompt: str, tool_context: "ToolContext"):
    """Generates an image based on the prompt."""
    client = Client()
    response = client.models.generate_images(
        model=MODEL_IMAGE,
        prompt=img_prompt,
        config={"number_of_images": 1},
    )
    if not response.generated_images:
        return {"status": "failed"}
    image_bytes = response.generated_images[0].image.image_bytes
    await tool_context.save_artifact(
        "image.png",
        types.Part.from_bytes(data=image_bytes, mime_type="image/png"),
    )
    return {
        "status": "success",
        "detail": "Image generated successfully and stored in artifacts.",
        "filename": "image.png",
    }


logo_create_agent = Agent(
    model=MODEL,
    name="logo_create_agent",
    description=(
        "An agent that generates images and answers questions about the images."
    ),
    instruction=prompt.LOGO_CREATE_PROMPT,
    output_key="logo_create_output",
    tools=[generate_image, load_artifacts],
)

### What I’m asking

Is there a recommended way to **retrieve or download artifacts (like images)** generated by an agent after it’s deployed on **Google Cloud Reasoning Engine**?

If there’s a missing step or API for this, could you please point to an example or documentation reference?

Thank you 

qudosabdu avatar Nov 06 '25 04:11 qudosabdu

Hi, Can I handle this issue now?

marktech0813 avatar Nov 06 '25 09:11 marktech0813

Please check PR. thanks.

marktech0813 avatar Nov 06 '25 09:11 marktech0813