# Complete reference trajectory configuration - GameBuilder-MCP # # Version: ideal trajectory derived from the code design (applies to all models) # Principle: include only steps explicitly required by the design; do not rely on test statistics # # Design analysis: # 1. Three agents execute sequentially: # - Senior Software Engineer: generate game code # - Software Quality Control Engineer: review code (uses validate_python_code) # - Chief Software Quality Control Engineer: final evaluation (uses validate_python_code) # # 2. Tool usage analysis: # - validate_python_code is provided via the MCP server # - The tool is configured specifically for QA and Chief QA (via mcp_adapter.tools) # - tasks.yaml requires "check for errors" and "syntax errors" # - Validating code is a core QA responsibility; tool calls are required # # 3. Execution flow: # - Process.sequential: sequential execution # - Each agent executes its task and produces results via the LLM # # 4. MCP variant characteristics: # - Tools are obtained from the MCP server via MCPServerAdapter # - Tool name is the function name: validate_python_code # - The key difference from the non-MCP variant is the tool provisioning mechanism # Project name project_name: "GameBuilder-MCP" # Trajectory extraction configuration # Focus: SPAN, Chain, AGENT, LLM, Tool # Ignore: non-core items like Task Created, Crew Created extract_types: - "SPAN" # Level 1: top-level execution span - "Chain" # Level 2: crew execution chain - "AGENT" # Level 3: agent execution - "LLM" # Level 4: LLM call - "Tool" # Level 4: tool call # ============================================================================ # Reference trajectory (ground truth) - derived from code design # ============================================================================ # # Visual structure (ideal execution path): # # [SPAN] GameBuilder_generation # └─ [Chain] Crew***.kickoff # ├─ [AGENT] Senior Software Engineer ← Task 1: code_task # │ └─ [LLM] * ← generate game code # │ # ├─ [AGENT] Software Quality Control Engineer ← Task 2: review_task # │ ├─ [LLM] * ← review code and decide to validate # │ ├─ [Tool] validate_python_code ← validate code syntax (MCP tool) # │ └─ [LLM] * ← handle validation results and output # │ # └─ [AGENT] Chief Software Quality Control Engineer ← Task 3: evaluate_task # ├─ [LLM] * ← final evaluation and decide to validate # ├─ [Tool] validate_python_code ← confirm code is runnable (MCP tool) # └─ [LLM] * ← confirm completion and output # # Design rationale: # - crew.py: defines a sequential flow of 3 agents and 3 tasks # - tasks.yaml: all tasks expect "full python code, only the python code" # - tasks.yaml: review_task requires "check for errors" and "syntax errors" # - main.py line 532: SPAN name is "GameBuilder_generation" # - agents.yaml: QA focuses on "checking code for errors" # - crew.py: QA and Chief QA are configured with mcp_adapter.tools (lines 57 and 68) # - mcp_server.py: tool name is validate_python_code (line 21) # # Ideal trajectory notes: # - Senior Engineer: generate code (1 LLM call) # - QA Engineer: review -> validate tool -> output (2 LLM + 1 tool) # - Chief QA: evaluate -> validate tool -> confirm (2 LLM + 1 tool) # - This trajectory represents an ideal execution path: no retries, no redundancy # # Notes: # - "LLM: *" means any LLM model (wildcard match) # - Agent names must exactly match those defined in agents.yaml # - MCP tool name is the function name: validate_python_code (not "Python Code Validator") # - Real runs may include more LLM calls (thinking, retries, etc.); this is expected # ============================================================================ reference_trajectory: # ===== Level 1: SPAN ===== - "SPAN: GameBuilder_generation" # ===== Level 2: Chain (wildcard UUID) ===== - "Chain: Crew***.kickoff" # ===== Task 1: code_task ===== # Senior Software Engineer generates game code - "Agent: Senior Software Engineer" - "LLM: *" # Any model # ===== Task 2: review_task ===== # Software Quality Control Engineer reviews code - "Agent: Software Quality Control Engineer" - "LLM: *" - "Tool: validate_python_code" - "LLM: *" # ===== Task 3: evaluate_task ===== # Chief Software Quality Control Engineer performs final evaluation - "Agent: Chief Software Quality Control Engineer" - "LLM: *" - "Tool: validate_python_code" - "LLM: *" # Target tool list (for the single-tool use metric) # Only includes actual tool calls; used to detect tool usage target_tools: - "Tool: validate_python_code" # Models to evaluate models: - "GPT-5" - "GPT-4o-mini" - "DeepSeek-V3-1" - "DeepSeek-R1" - "Gemini-2.5-flash" - "Gemini-2.5-flash-nothinking" - "Qwen3-235b" # ============================================================================ # Usage # ============================================================================ # # 1. Trajectory hierarchy structure: # - Level 1: SPAN (GameBuilder_generation) # - Level 2: Chain (Crew***.kickoff, wildcard UUID) # - Level 3: AGENT (specific agent name, must match exactly) # - Level 4: LLM (wildcard match for any model) # # 2. Wildcards: # - Crew_.kickoff -> Crew***.kickoff (handled automatically by evaluate_trajectory.py) # - LLM: * -> matches any model name (e.g., gpt-4o-mini, deepseek-r1) # # 3. Exact match requirements: # - SPAN name: "GameBuilder_generation" (exact) # - Chain name: "Crew***.kickoff" (wildcard) # - AGENT names: must exactly match those defined in agents.yaml # * "Senior Software Engineer" # * "Software Quality Control Engineer" # * "Chief Software Quality Control Engineer" # - LLM name: "LLM: *" (wildcard) # - Tool name: "validate_python_code" (exact MCP tool function name) # # 4. Metric meanings: # - Exact Match: trajectories must be identical (including the number of LLM calls) # - In-order Match: allows extra calls, but core steps must appear in order # - Any-order Match: includes all required steps (order ignored) # - Precision: fraction of predicted steps that are correct # - Recall: fraction of reference steps covered # - Single-tool Use: checks usage of validate_python_code # # 5. Example command: # cd /Users/wzr/TOSEM-2025/RESULTS/RQ-Failure_Breakdown/GameBuilder-MCP # python3 evaluate_trajectory.py --config reference_trajectory.yaml # # 6. Design notes: # - This reference trajectory represents the ideal execution path # - Senior Engineer: 1 LLM call (generate code) # - QA Engineer: 2 LLM + 1 tool (review -> validate -> output) # - Chief QA: 2 LLM + 1 tool (evaluate -> validate -> confirm) # - Total: 5 LLM calls + 2 tool calls # - In-order Match and Any-order Match are often more informative for real executions # # 7. Differences from real trajectories: # - Real trajectories may include more LLM calls (thinking, planning, execution, summaries) # - Real trajectories may call the validation tool multiple times # - These differences are not necessarily errors; they reflect execution strategies # - Exact Match may be low; focus on In-order Match and Recall # # 8. MCP variant notes: # - Tools are provided by the MCP server via SSE # - Tool names use the function name (validate_python_code) # - The trajectory is the same as the non-MCP variant; only the tool provisioning differs # - The evaluation method and criteria are identical