Skip to content

run_config.save_input_blobs_as_artifacts not respected. #45

@Datise

Description

@Datise

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

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions