test_case_id: web_request_large_response
description: "Test that web_request tool handles a large response body."
tags: ["all", "agent", "tools", "web_tools"]
skip_intermediate_events: true

gateway_input:
  target_agent_name: "TestAgent"
  user_identity: "test_user@example.com"
  gateway_request_id: "request-127"
  external_context:
    a2a_session_id: "session-460"
  prompt:
    parts:
      - text: "Please fetch the content from {{STATIC_FILE_SERVER_URL}}/large_file.bin"

llm_interactions:
  - static_response:
      choices:
        - message:
            role: "assistant"
            tool_calls:
              - id: "call_127"
                type: "function"
                function:
                  name: "web_request"
                  arguments: '{"url": "{{STATIC_FILE_SERVER_URL}}/large_file.bin"}'
    expected_request:
      messages:
        - role: "user"
          content: "Please fetch the content from {{STATIC_FILE_SERVER_URL}}/large_file.bin"
      tools_present:
        - "web_request"
  - static_response:
      choices:
        - message:
            role: "assistant"
            content: "I have successfully fetched the content."
    expected_request:
      messages:
        - role: "user"
          content: "Please fetch the content from {{STATIC_FILE_SERVER_URL}}/large_file.bin"
        - role: "tool"
          content_matches_regex: '.*"status": "success", "message": "Successfully fetched content from {{STATIC_FILE_SERVER_URL}}/large_file.bin \(status: 200\). Saved as artifact.*'
          tool_call_id: "call_127"

expected_gateway_output:
  - type: final_response
    kind: task
    id: '*'
    contextId: "session-460"
    status:
      state: "completed"
      message:
        kind: message
        messageId: '*'
        role: agent
        parts:
          - type: text
            text_contains:

              - "I have successfully fetched the content."
expected_artifacts:
  - filename_matches_regex: "^web_content_.*\\.bin$"
    metadata_contains:
      original_content_type: "application/octet-stream"
