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

run_config.save_input_blobs_as_artifacts not respected.

Open Datise opened this issue 7 months ago • 5 comments

Describe the bug Attempting to set the RunConfig.save_input_blobs_as_artifacts has no effect.

To Reproduce using an exact replica of fast_api.py, updating /run_see to use the RunConfig.save_input_blobs_as_artifacts = True has no effect.

`@app.post("/run_sse") async def agent_run_sse(req: AgentRunRequest) -> StreamingResponse: # Connect to managed session if agent_engine_id is set. app_id = agent_engine_id if agent_engine_id else req.app_name # SSE endpoint session = session_service.get_session( app_name=app_id, user_id=req.user_id, session_id=req.session_id ) if not session: raise HTTPException(status_code=404, detail="Session not found")

async def event_generator():
  try:
    stream_mode = StreamingMode.SSE if req.streaming else StreamingMode.NONE
    runner = await _get_runner_async(req.app_name)
    run_config = RunConfig(streaming_mode=stream_mode, save_input_blobs_as_artifacts=True)
    async for event in runner.run_async(
        user_id=req.user_id,
        session_id=req.session_id,
        new_message=req.new_message,
        run_config=run_config
    ):
      # Format as SSE data
      sse_event = event.model_dump_json(exclude_none=True, by_alias=True)
      logger.info("Generated event in agent run streaming: %s", sse_event)
      yield f"data: {sse_event}\n\n"
  except Exception as e:
    logger.exception("Error in event_generator: %s", e)
    # You might want to yield an error event here
    yield f'data: {{"error": "{str(e)}"}}\n\n'

# Returns a streaming response with the proper media type for SSE
return StreamingResponse(
    event_generator(),
    media_type="text/event-stream",
)`

Expected behavior Blobs added as attachments are saved to artifacts when using adk web

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • Python version(python -V): 3.12
  • ADK version(pip show google-adk): 0.5.0

Datise avatar May 15 '25 00:05 Datise

They don't show up on the UI but they do get saved as artifacts in my experience? If you run a list_artifacts in, say, a callback you can see them.

simond avatar May 29 '25 18:05 simond

Thanks @simond for your help. @Datise could you check if that works for you?

DeanChensj avatar May 30 '25 20:05 DeanChensj

It does save the blob. Maybe this issue is more about the devUI since I can't see them even after page refresh. It would be nice to know since I forked the dev ui to jumpstart my own frontend and this confuses me all the time. Is there an event I can manually publish or something?

Feel free to do what you want with this.

Datise avatar Jun 02 '25 18:06 Datise

Hi @wyf7107 , I don't have the permission to migrate this issue to adk-web, I think this ticket is more about adding Web UI support for showing all the artifacts.

DeanChensj avatar Jun 02 '25 18:06 DeanChensj

@jfzeng00 help to take a look

wyf7107 avatar Jun 04 '25 04:06 wyf7107