File size: 7,629 Bytes
8c10cf2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
# 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_<UUID>.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