test_case_id: "proxy_outbound_artifact_metadata_001"
description: "Tests that the proxy correctly populates the 'produced_artifacts' metadata when forwarding a response with artifacts."
tags: ["all", "proxy", "artifacts"]
skip_intermediate_events: true

gateway_input:
  target_agent_name: "TestAgent_Proxied"
  user_identity: "proxy_artifact_tester@example.com"
  is_streaming: false
  a2a_parts:
    - type: "text"
      text: "Generate an artifact for me."
  external_context:
    a2a_session_id: "session_proxy_outbound_artifact_metadata_001"

downstream_a2a_agent_responses:
  - id: "downstream-task-id"
    contextId: "session_proxy_outbound_artifact_metadata_001"
    kind: "task"
    status:
      state: "completed"
      message:
        role: "agent"
        messageId: "msg-1"
        kind: "message"
        parts:
          - kind: "text"
            text: "Here is your generated artifact."
    artifacts:
      - artifact_id: "downstream-artifact-1"
        name: "report.txt"
        description: "A generated report."
        parts:
          - kind: "file"
            file:
              name: "report.txt"
              mime_type: "text/plain"
              # Base64 of "This is the report content."
              bytes: "VGhpcyBpcyB0aGUgcmVwb3J0IGNvbnRlbnQu"

expected_gateway_output:
  - type: "final_response"
    task_state: "completed"
    content_parts:
      - type: "text"
        text_exact: "Here is your generated artifact."
    artifacts:
      - name: "report.txt"
        description: "A generated report."
        parts:
          - kind: "file"
            file:
              name: "report.txt"
              mimeType: "text/plain"
              uri_matches_regex: "artifact://TestAgent_Proxied/proxy_artifact_tester@example.com/session_proxy_outbound_artifact_metadata_001/report.txt/0"
    metadata_contains:
      produced_artifacts:
        - filename: "report.txt"
          version: 0
    assert_artifact_state:
      - filename: "report.txt"
        version: 0
        user_id: "proxy_artifact_tester@example.com"
        session_id: "session_proxy_outbound_artifact_metadata_001"
        app_name: "TestAgent_Proxied"
        expected_content_bytes_base64: "VGhpcyBpcyB0aGUgcmVwb3J0IGNvbnRlbnQu"
        expected_metadata_contains:
          description: "A generated report."
          proxied_from_artifact_id: "downstream-artifact-1"
