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

Artifact rendering?

Open HaoLi111 opened this issue 8 months ago • 2 comments

I have code like this

from google.adk.agents import LlmAgent
from google.adk.tools import FunctionTool, ToolContext
from google.genai import types
from google.adk.artifacts import InMemoryArtifactService
from google.adk.sessions import InMemorySessionService


solver = LlmAgent(
    name="solver_agent",
    model="gemini-2.5-pro-preview-06-05",
    description="Solve questions ",
    instruction="Solve the problem, save it to an artifact",
    output_key="question_solution.md"
) 

here my problem is : my artifact is a result from the agent, not a function tool. the result does show up in 'state' but not 'artifact' in the web UI. i think if i use the adk-web, i should not be manually managing the session and artifact? or should I? https://google.github.io/adk-docs/artifacts/ shows how to do it in the runner. thanks.

HaoLi111 avatar Jun 07 '25 23:06 HaoLi111

You don't have to manually manage the session, but if you want agent generated image to be stored in artifact service then you will need to have a function that calls tool_context.save_artifact

wyf7107 avatar Jun 08 '25 03:06 wyf7107

sure. What if I want to save agent result (not tool result) as artifacts? Thanks

HaoLi111 avatar Jun 09 '25 03:06 HaoLi111