test_case_id: "create_image_error_handling_001"
description: "Verifies that the tool handles an API failure from the image generation service."
tags: ["all","agent","tools","image_tools"]
skip_intermediate_events: true

gateway_input:
  target_agent_name: "TestAgent"
  user_identity: "error_tester@example.com"
  a2a_parts: [{type: "text", text: "Create an image that will fail."}]
  external_context:
    a2a_session_id: "fixed_session_for_create_image_error_001"
llm_interactions:
  # 1. First LLM call returns the tool call
  - static_response:
      choices:
        - message:
            role: "assistant"
            tool_calls:
              - id: "tool_call_create_image_fail_1"
                type: "function"
                function:
                  name: "create_image_from_description"
                  arguments: '{"image_description": "A failing image.", "output_filename": "fail.png"}'
          finish_reason: "tool_calls"
  # 2. Second LLM call after the tool fails
  - static_response:
      choices:
        - message:
            role: "assistant"
            content: "I'm sorry, there was an API error and I could not create the image."
primed_image_generation_responses:
  - response: '{"error": "Internal Server Error"}'
    status_code: 500
expected_gateway_output:
  - type: "final_response"
    content_parts:
      - type: "text"
        text_contains: "API error"
expected_artifacts: []
