test_case_id: "proxy_inbound_artifact_001"
description: "Tests that the proxy correctly resolves an inbound artifact URI into bytes before forwarding."
tags: ["all", "proxy", "artifacts"]
skip_intermediate_events: true

setup_artifacts:
  - filename: "inbound.txt"
    user_id: "proxy_artifact_tester@example.com"
    session_id: "session_proxy_inbound_artifact_001"
    # The app_name for setup must match the target_agent_name in the gateway_input
    # because the test runner uses the target_agent_name to scope the artifact.
    content: "inbound artifact content"
    mime_type: "text/plain"

gateway_input:
  target_agent_name: "TestAgent_Proxied"
  user_identity: "proxy_artifact_tester@example.com"
  is_streaming: false
  parts:
    - type: "text"
      text: "Process this artifact."
    - type: "file"
      uri: "artifact://TestAgent_Proxied/proxy_artifact_tester@example.com/session_proxy_inbound_artifact_001/inbound.txt?version=0"
      name: "inbound.txt"
      mime_type: "text/plain"
  external_context:
    a2a_session_id: "session_proxy_inbound_artifact_001"

downstream_a2a_agent_responses:
  - id: "downstream-task-id"
    contextId: "session_proxy_inbound_artifact_001"
    kind: "task"
    status:
      state: "completed"
      message:
        role: "agent"
        messageId: "msg-1"
        kind: "message"
        parts:
          - kind: "text"
            text: "Downstream agent received the artifact."

assert_downstream_request:
  - method: "message/send"
    params:
      message:
        role: "user"
        parts:
          - kind: "text"
            text_matches_regex: "^Request received by gateway at: .*"
          - kind: "text"
            text: "Process this artifact."
          - kind: "file"
            file:
              name: "inbound.txt"
              mimeType: "text/plain"
              # Base64 of "inbound artifact content"
              bytes: "aW5ib3VuZCBhcnRpZmFjdCBjb250ZW50"

expected_gateway_output:
  - type: "final_response"
    task_state: "completed"
    content_parts:
      - type: "text"
        text_exact: "Downstream agent received the artifact."
