Birth Of Arvinxu

L3
ModelContextProtocolPlaywrightWeb Search

Search for biographical information about X profile arvin17x across multiple web sources, extract birth year data, verify information accuracy, and compile findings.

Created by Arvin Xu
2025-08-18
Search AggregationData Extraction

Model Ranking

Click on the dots to view the trajectory of each task run
Model
Run Results
Pass@4
Pass^4
Avg Time
Avg Turns
Input Tokens
Output Tokens
Total Tokens
OpenAI
gpt-5
4
/4
776.7s
36.0
2,546,290
23,530
2,569,820
OpenAI
o3
1
/4
194.6s
23.3
721,945
3,598
725,543
Claude
claude-4-1-opus
0
/1
--
203.0s
8.0
356,654
1,465
358,119
Claude
claude-4-sonnet
0
/4
88.6s
6.3
224,044
1,237
225,280
DeepSeek
deepseek-chat
0
/4
152.6s
9.8
369,862
1,231
371,092
Gemini
gemini-2-5-pro
0
/4
39.0s
5.3
234,815
1,254
236,070
Grok
grok-4
0
/4
302.8s
20.0
-
-
-
MoonshotAI
k2
0
/4
109.6s
9.8
185,450
1,126
186,576
Qwen
qwen-3-coder
0
/4
69.5s
7.5
283,071
895
283,965

Instruction



Verify

*.py
Python
#!/usr/bin/env python3
"""
Verification script for Playwright web search task.

Simple verification that checks if the AI agent found the correct answer.
The expected ground truth answer is configured at the top of the file.
"""

import sys
import json
import os
from pathlib import Path
from typing import Dict, Any

# =============================================================================
# CONFIGURATION
# =============================================================================

# Expected ground truth answer (exact match)
EXPECTED_GROUND_TRUTH = "1995"

# =============================================================================
# MCP RESULT PARSING
# =============================================================================


def get_working_directory() -> Path:
    """Get the working directory where messages.json should be."""
    # Priority 1: Use MCP_MESSAGES path if available (most reliable)
    messages_path = os.getenv("MCP_MESSAGES")
    if messages_path and Path(messages_path).exists():
        return Path(messages_path).parent.resolve()

    # Priority 2: Use PLAYWRIGHT_WORK_DIR environment variable
    work_dir = os.getenv("PLAYWRIGHT_WORK_DIR")
    if work_dir:
        work_path = Path(work_dir).resolve()
        if (work_path / "messages.json").exists():
            return work_path

    # Priority 3: Check current directory (fallback)
    current_dir = Path.cwd()
    if (current_dir / "messages.json").exists():
        return current_dir

    # Priority 4: Default fallback
    return Path(".").resolve()


def parse_ai_results(work_dir: Path) -> Dict[str, Any]:
    """Parse the AI agent's results from messages.json"""
    messages_file = work_dir / "messages.json"
    if not messages_file.exists():
        return {"success": False, "error": "No messages.json found"}

    try:
        with open(messages_file, "r", encoding="utf-8") as f:
            messages = json.load(f)
    except (json.JSONDecodeError, IOError) as e:
        return {"success": False, "error": f"Failed to read messages.json: {e}"}

    # Look for expected answer in the AI's responses
    found_answer = False
    ai_responses = []

    for message in messages:
        if message.get("role") == "assistant":
            content = str(message.get("content", ""))

            # Handle both string and list content formats
            if isinstance(message.get("content"), list):
                content = " ".join(
                    item.get("text", "") if isinstance(item, dict) else str(item)
                    for item in message.get("content", [])
                )

            ai_responses.append(content)

            # Exact match (character-for-character, case-sensitive, no trimming)
            if content == EXPECTED_GROUND_TRUTH:
                found_answer = True

    return {
        "success": True,
        "found_answer": found_answer,
        "ai_responses": ai_responses,
        "total_responses": len(ai_responses),
    }


# =============================================================================
# MAIN VERIFICATION
# =============================================================================


def verify_task() -> bool:
    """Verify the AI agent found the correct answer"""

    # Parse AI agent results
    work_dir = get_working_directory()
    print(f"| Working directory: {work_dir}")

    ai_results = parse_ai_results(work_dir)

    if not ai_results["success"]:
        print(f"| ❌ Could not parse AI results: {ai_results.get('error')}")
        return False

    if ai_results["found_answer"]:
        print(f"| AI agent correctly identified: {EXPECTED_GROUND_TRUTH}")
        return True
    else:
        print(f"| AI agent did not find the correct answer: {EXPECTED_GROUND_TRUTH}")
        return False


def main():
    """Main verification function."""
    try:
        success = verify_task()
        sys.exit(0 if success else 1)
    except Exception as e:
        print(f"\n💥 Verification error: {e}")
        sys.exit(1)


if __name__ == "__main__":
    main()