# tests/integration/scenarios_declarative/test_data/image_tools/describe_image/test_describe_image_specific_version.yaml
test_case_id: "describe_image_specific_version"
description: "Tests the ability to describe a specific, older version of an image artifact."
tags: ["all","agent","tools","image_tools"]
skip_intermediate_events: true

setup_artifacts:
  # Version 1: A 1x1 red pixel
  - filename: "versioned_image.png"
    mime_type: "image/png"
    content_base64: "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/wcAAwAB/epv2AAAAABJRU5ErkJggg=="
  # Version 2: A 1x1 blue pixel
  - filename: "versioned_image.png"
    mime_type: "image/png"
    content_base64: "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII="

gateway_input:
  user_prompt: "Describe version 1 of versioned_image.png"
  user_identity: "test_user@example.com"
  target_agent_name: "TestAgent"
  tool_names: ["describe_image"]

llm_interactions:
  # First LLM call: Agent decides to use the tool with the specific version
  - static_response:
      choices:
        - message:
            role: "assistant"
            tool_calls:
              - id: "call_describe_image_version_1"
                type: "function"
                function:
                  name: "describe_image"
                  arguments: '{"image_filename": "versioned_image.png:1"}'
    expected_request:
      tools_present: ["describe_image"]

  # Second LLM call (to vision API): Should receive the content for version 1 (the red pixel)
  - static_response:
      choices:
        - message:
            role: "assistant"
            content: "This is a single red pixel."
      usage:
        total_tokens: 130
    expected_request:
      messages:
        - role: "user"
          content:
            - type: "text"
              text: "What is in this image?"
            - type: "image_url"
              image_url:
                url: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/wcAAwAB/epv2AAAAABJRU5ErkJggg=="

  # Third LLM call: Agent processes the successful tool output
  - static_response:
      choices:
        - message:
            role: "assistant"
            content: "The image `versioned_image.png` (version 1) is a single red pixel."
    expected_request:
      expected_tool_responses_in_llm_messages:
        - tool_call_id_matches_prior_request_index: 0
          response_json_matches:
            status: "success"
            description: "This is a single red pixel."
            image_filename: "versioned_image.png"
            image_version: 1

expected_gateway_output:
  - type: "status_update"
    event_purpose: "tool_invocation_start"
    expected_tool_name: "describe_image"

  - type: "final_response"
    task_state: "completed"
    content_parts:
      - type: "text"
        text_contains: "is a single red pixel"
