File size: 17,418 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
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
# Full reference trajectory configuration - RecruitmentAssistant-A2A project
#
# Version: ideal trajectory ported from the MCP version and adapted to the A2A architecture (applies to all models)
# Principle: only include steps explicitly required by the code design; do not rely on test statistics
#
# Migration notes:
# - This file is based on RecruitmentAssistant-MCP/reference_trajectory.yaml
# - It preserves the same business roles, Agent names, LLM/Tool names, and the dynamic 3x/4x reference trajectory design
# - Only the trajectory hierarchy is adapted to match the actual execution path under A2A:
#   * Top-level SPAN: recruitment_orchestrator
#   * Second-level SPAN: crew_execution
#   * Inside each business stage (analyze_job / evaluate_candidates / prepare_interviews)
#     add A2A-specific multi-layer SPANs: a2a_call_xxx → xxx_server_execution → Crew***.kickoff
#
# Code design + A2A architecture analysis (based on trace samples execution_path.md):
# 1. The top-level orchestrator runs 3 stages sequentially:
#    - JobAnalysisCrew: Senior Job Requirements Analyst uses unified_web_search for market research
#    - CandidateEvaluationCrew: Senior Candidate Evaluator uses candidate_evaluator_pro to evaluate candidates
#    - InterviewCommunicationCrew: Senior Interview Materials Coordinator uses tools to generate interview materials and email templates
#
# 2. Tool usage (business design is consistent with the MCP version):
#    - Job Analysis: unified_web_search (web search for market research; recommended 3-4 calls)
#    - Candidate Evaluation: candidate_evaluator_pro (core scoring tool)
#    - Interview Communication: comprehensive_interview_material_generator + email_template_generator
#
# 3. A2A execution flow (adds two extra server-related SPAN layers compared to MCP):
#    - orchestrator creates the top-level SPAN: recruitment_orchestrator
#    - orchestrator creates crew_execution SPAN, then runs 3 business stages in order:
#      * analyze_job
#      * evaluate_candidates
#      * prepare_interviews
#    - Within each stage, introduce the A2A-specific 3-level nesting:
#      * Business method SPAN: analyze_job / evaluate_candidates / prepare_interviews
#      * A2A call SPAN: a2a_call_job_analysis / a2a_call_candidate_evaluation / a2a_call_interview_communication
#      * Server execution SPAN: job_analysis_server_execution / candidate_evaluation_server_execution / interview_communication_server_execution
#      * Then enter the Crew chain inside the server: Chain: Crew***.kickoff → Agent → LLM/Tool
#
# 4. SPAN hierarchy under A2A (abstracted from execution_path.md):
#    - [SPAN] recruitment_orchestrator
#      └─ [SPAN] crew_execution
#         ├─ [SPAN] analyze_job
#         │  └─ [SPAN] a2a_call_job_analysis
#         │     └─ [SPAN] job_analysis_server_execution
#         │        └─ [Chain] Crew***.kickoff
#         │           └─ [AGENT] Senior Job Requirements Analyst
#         ├─ [SPAN] evaluate_candidates
#         │  └─ [SPAN] a2a_call_candidate_evaluation
#         │     └─ [SPAN] candidate_evaluation_server_execution
#         │        └─ [Chain] Crew***.kickoff
#         │           └─ [AGENT] Senior Candidate Evaluator
#         └─ [SPAN] prepare_interviews
#            └─ [SPAN] a2a_call_interview_communication
#               └─ [SPAN] interview_communication_server_execution
#                  └─ [Chain] Crew***.kickoff
#                     └─ [AGENT] Senior Interview Materials Coordinator
#
# 5. The dynamic reference trajectory design remains unchanged (choose 3x/4x by unified_web_search count):
#    - If unified_web_search under analyze_job SPAN ≤ 3, use reference_trajectory_3x
#    - If unified_web_search under analyze_job SPAN ≥ 4, use reference_trajectory_4x
#
# 6. Important conventions:
#    - Agent role names must match the role fields in each self-hosted server's agents.yaml
#    - Tool names must match the actual invoked tool names: unified_web_search, candidate_evaluator_pro,
#      comprehensive_interview_material_generator, email_template_generator
#    - For [LLM], use "LLM: *" as a wildcard for any concrete model name
#

# Project name (used to match RESULTS/<model>/<project_name>/test_results)
project_name: "RecruitmentAssistant-A2A"

# Trajectory extraction type configuration
extract_types:
  - "SPAN" # Multi-level SPAN structure (including A2A framework SPANs)
  - "Chain" # Kickoff chain for each Crew
  - "AGENT" # Agent for each Crew
  - "LLM" # LLM calls
  - "Tool" # Tool calls

# ============================================================================
# Reference trajectory (Ground Truth) - based on code design + A2A trace structure
# ============================================================================
#
# Diagram (ideal execution path; shows 3x version; 4x adds one extra search in Job Analysis):
#
# [SPAN] recruitment_orchestrator
# └─ [SPAN] crew_execution
#    ├─ [SPAN] analyze_job
#    │  └─ [SPAN] a2a_call_job_analysis
#    │     └─ [SPAN] job_analysis_server_execution
#    │        └─ [Chain] Crew***.kickoff
#    │           └─ [AGENT] Senior Job Requirements Analyst
#    │              ├─ [LLM] *
#    │              ├─ [Tool] unified_web_search (1st search)
#    │              ├─ [LLM] *
#    │              ├─ [Tool] unified_web_search (2nd search)
#    │              ├─ [LLM] *
#    │              ├─ [Tool] unified_web_search (3rd/4th search)
#    │              └─ [LLM] *
#    ├─ [SPAN] evaluate_candidates
#    │  └─ [SPAN] a2a_call_candidate_evaluation
#    │     └─ [SPAN] candidate_evaluation_server_execution
#    │        └─ [Chain] Crew***.kickoff
#    │           └─ [AGENT] Senior Candidate Evaluator
#    │              ├─ [LLM] *
#    │              ├─ [Tool] candidate_profile_analyzer
#    │              ├─ [LLM] *
#    │              ├─ [Tool] candidate_evaluator_pro
#    │              └─ [LLM] *
#    └─ [SPAN] prepare_interviews
#       └─ [SPAN] a2a_call_interview_communication
#          └─ [SPAN] interview_communication_server_execution
#             └─ [Chain] Crew***.kickoff
#                └─ [AGENT] Senior Interview Materials Coordinator
#                   ├─ [LLM] *
#                   ├─ [Tool] comprehensive_interview_material_generator
#                   ├─ [LLM] *
#                   ├─ [Tool] email_template_generator
#                   └─ [LLM] *
#
# Notes:
# - Real traces may include extra LLM calls and auxiliary tools (e.g., candidate_profile_analyzer).
#   They are not written into the reference trajectory, but are allowed in the In-order / Any-order / Precision / Recall metrics.
# - The reference trajectory captures only the key steps that should appear at minimum, and their required order.
# ============================================================================

# [Compatibility] Default reference trajectory (kept as the 3x version for older scripts and Markdown output)
reference_trajectory:
  # ===== Top-level SPAN =====
  - "SPAN: recruitment_orchestrator"

  # ===== Second-level SPAN (contains 3 stages) =====
  - "SPAN: crew_execution"

  # ===== Crew 1: Job Analysis (3 searches; A2A multi-layer SPAN) =====
  - "SPAN: analyze_job"
  - "SPAN: a2a_call_job_analysis"
  - "SPAN: job_analysis_server_execution"
  - "Chain: Crew***.kickoff"
  - "Agent: Senior Job Requirements Analyst"
  - "LLM: *"
  - "Tool: unified_web_search"
  - "LLM: *"
  - "Tool: unified_web_search"
  - "LLM: *"
  - "Tool: unified_web_search"
  - "LLM: *"

  # ===== Crew 2: Candidate Evaluation =====
  - "SPAN: evaluate_candidates"
  - "SPAN: a2a_call_candidate_evaluation"
  - "SPAN: candidate_evaluation_server_execution"
  - "Chain: Crew***.kickoff"
  - "Agent: Senior Candidate Evaluator"
  - "LLM: *"
  - "Tool: candidate_profile_analyzer"
  - "LLM: *"
  - "Tool: candidate_evaluator_pro"
  - "LLM: *"

  # ===== Crew 3: Interview Communication =====
  - "SPAN: prepare_interviews"
  - "SPAN: a2a_call_interview_communication"
  - "SPAN: interview_communication_server_execution"
  - "Chain: Crew***.kickoff"
  - "Agent: Senior Interview Materials Coordinator"
  - "LLM: *"
  - "Tool: comprehensive_interview_material_generator"
  - "LLM: *"
  - "Tool: email_template_generator"
  - "LLM: *"

# ============================================================================
# Dynamic reference trajectory - Version 1: 3x unified_web_search
# ============================================================================
# Applies when unified_web_search count under analyze_job SPAN ≤ 3
reference_trajectory_3x:
  # ===== Top-level SPAN =====
  - "SPAN: recruitment_orchestrator"

  # ===== Second-level SPAN (contains 3 stages) =====
  - "SPAN: crew_execution"

  # ===== Crew 1: Job Analysis (3 searches; A2A multi-layer SPAN) =====
  - "SPAN: analyze_job"
  - "SPAN: a2a_call_job_analysis"
  - "SPAN: job_analysis_server_execution"
  - "Chain: Crew***.kickoff"
  - "Agent: Senior Job Requirements Analyst"
  - "LLM: *" # Decide to call tools
  - "Tool: unified_web_search" # Market research - search #1
  - "LLM: *" # Analyze results and decide to continue searching
  - "Tool: unified_web_search" # Market research - search #2
  - "LLM: *" # Analyze results and decide to continue searching
  - "Tool: unified_web_search" # Market research - search #3
  - "LLM: *" # Produce the final job analysis report

  # ===== Crew 2: Candidate Evaluation (A2A multi-layer SPAN) =====
  - "SPAN: evaluate_candidates"
  - "SPAN: a2a_call_candidate_evaluation"
  - "SPAN: candidate_evaluation_server_execution"
  - "Chain: Crew***.kickoff"
  - "Agent: Senior Candidate Evaluator"
  - "LLM: *" # Decide to call the auxiliary analysis tool
  - "Tool: candidate_profile_analyzer" # Analyze candidate profiles and background
  - "LLM: *" # Decide to call the scoring tool
  - "Tool: candidate_evaluator_pro" # Evaluate all candidates (scoring, ranking, grading)
  - "LLM: *" # Produce the final evaluation report

  # ===== Crew 3: Interview Communication (A2A multi-layer SPAN) =====
  - "SPAN: prepare_interviews"
  - "SPAN: a2a_call_interview_communication"
  - "SPAN: interview_communication_server_execution"
  - "Chain: Crew***.kickoff"
  - "Agent: Senior Interview Materials Coordinator"
  - "LLM: *" # Decide to generate interview materials
  - "Tool: comprehensive_interview_material_generator" # Generate interview questions for all stages
  - "LLM: *" # Review materials and decide to generate email templates
  - "Tool: email_template_generator" # Generate all types of email templates
  - "LLM: *" # Final merge to produce a complete interview materials package

# ============================================================================
# Dynamic reference trajectory - Version 2: 4x unified_web_search
# ============================================================================
# Applies when unified_web_search count under analyze_job SPAN ≥ 4
reference_trajectory_4x:
  # ===== Top-level SPAN =====
  - "SPAN: recruitment_orchestrator"

  # ===== Second-level SPAN (contains 3 stages) =====
  - "SPAN: crew_execution"

  # ===== Crew 1: Job Analysis (4 searches; A2A multi-layer SPAN) =====
  - "SPAN: analyze_job"
  - "SPAN: a2a_call_job_analysis"
  - "SPAN: job_analysis_server_execution"
  - "Chain: Crew***.kickoff"
  - "Agent: Senior Job Requirements Analyst"
  - "LLM: *" # Decide to call tools
  - "Tool: unified_web_search" # Market research - search #1
  - "LLM: *" # Analyze results and decide to continue searching
  - "Tool: unified_web_search" # Market research - search #2
  - "LLM: *" # Analyze results and decide to continue searching
  - "Tool: unified_web_search" # Market research - search #3
  - "LLM: *" # Analyze results and decide to continue searching
  - "Tool: unified_web_search" # Market research - search #4
  - "LLM: *" # Produce the final job analysis report

  # ===== Crew 2: Candidate Evaluation (A2A multi-layer SPAN) =====
  - "SPAN: evaluate_candidates"
  - "SPAN: a2a_call_candidate_evaluation"
  - "SPAN: candidate_evaluation_server_execution"
  - "Chain: Crew***.kickoff"
  - "Agent: Senior Candidate Evaluator"
  - "LLM: *" # Decide to call the auxiliary analysis tool
  - "Tool: candidate_profile_analyzer" # Analyze candidate profiles and background
  - "LLM: *" # Decide to call the scoring tool
  - "Tool: candidate_evaluator_pro" # Evaluate all candidates (scoring, ranking, grading)
  - "LLM: *" # Produce the final evaluation report

  # ===== Crew 3: Interview Communication (A2A multi-layer SPAN) =====
  - "SPAN: prepare_interviews"
  - "SPAN: a2a_call_interview_communication"
  - "SPAN: interview_communication_server_execution"
  - "Chain: Crew***.kickoff"
  - "Agent: Senior Interview Materials Coordinator"
  - "LLM: *" # Decide to generate interview materials
  - "Tool: comprehensive_interview_material_generator" # Generate interview questions for all stages
  - "LLM: *" # Review materials and decide to generate email templates
  - "Tool: email_template_generator" # Generate all types of email templates
  - "LLM: *" # Final merge to produce a complete interview materials package

# Target tool list (used by the single-tool use metric)
target_tools:
  - "Tool: unified_web_search"
  - "Tool: candidate_profile_analyzer"
  - "Tool: candidate_evaluator_pro"
  - "Tool: comprehensive_interview_material_generator"
  - "Tool: email_template_generator"

# Models to evaluate (kept consistent with the MCP version)
models:
  - "GPT-5"
  - "GPT-4o-mini"
  - "DeepSeek-V3-1"
  - "DeepSeek-R1"
  - "Gemini-2.5-flash"
  - "Gemini-2.5-flash-nothinking"
  - "Qwen3-235b"

# Permutable tool group configuration (for dynamic tool-order optimization)
permutable_tool_groups:
  # Tools in the Candidate Evaluation stage can be in any order
  candidate_evaluation_tools:
    - "Tool: candidate_profile_analyzer"
    - "Tool: candidate_evaluator_pro"

  # Tools in the Interview Communication stage can be in any order
  interview_communication_tools:
    - "Tool: comprehensive_interview_material_generator"
    - "Tool: email_template_generator"
# ============================================================================
# Usage - A2A architecture version
# ============================================================================
#
# 1. Trajectory hierarchy (tiered by type):
#    - Level 1: SPAN (recruitment_orchestrator)
#    - Level 2: SPAN (crew_execution)
#    - Level 3: SPAN (analyze_job / evaluate_candidates / prepare_interviews)
#    - Level 4: SPAN (a2a_call_job_analysis / a2a_call_candidate_evaluation /
#                    a2a_call_interview_communication)
#    - Level 5: SPAN (job_analysis_server_execution /
#                    candidate_evaluation_server_execution /
#                    interview_communication_server_execution)
#    - Level 6: Chain (Crew***.kickoff)
#    - Level 7: AGENT (Senior roles for each stage)
#    - Level 8: LLM / Tool (alternating)
#
# 2. Wildcards and exact matching:
#    - SPAN names: must exactly match the names in this file
#    - Chain name: "Crew***.kickoff"; evaluate_trajectory.py will automatically normalize
#      the actual Crew_<UUID>.kickoff into this form
#    - AGENT names: exact match the role fields in agents.yaml (e.g.,
#      "Senior Job Requirements Analyst")
#    - LLM: use "LLM: *" as a wildcard to match any model (gpt-5-chat-latest,
#      deepseek-reasoner, gemini-2.5-flash, qwen3-235b-a22b, etc.)
#    - Tool names: exact match tool names
#
# 3. Metric meanings (consistent with the MCP version):
#    - Exact Match: Predicted trajectory exactly matches the reference trajectory in length and every step
#    - In-order Match: Reference trajectory is a subsequence of the predicted trajectory, allowing extra steps
#    - Any-order Match: Only requires the presence of all necessary steps, ignoring order
#    - Precision: Proportion of steps in the predicted trajectory that are considered correct
#    - Recall: Proportion of steps in the reference trajectory that are covered
#    - Single-tool Use: Average usage of each tool in target_tools
#    - unique_path_ratio: Number of unique complete trajectories / total samples
#    - path_entropy: Shannon entropy based on trajectory frequencies, normalized to 0-1
#
# 4. How to use dynamic reference trajectories:
#    - evaluate_trajectory.py automatically counts unified_web_search calls under analyze_job SPAN
#      for each sample:
#        * ≤ 3 → use reference_trajectory_3x
#        * ≥ 4 → use reference_trajectory_4x
#    - This treats models with fewer/more searches more fairly.
#
# 5. Run example:
#    - Run in the RecruitmentAssistant-A2A directory:
#        python3 evaluate_trajectory.py --config reference_trajectory.yaml
#
# 6. Possible differences vs. real A2A traces:
#    - Real traces may include:
#      * More LLM calls (thinking / planning / self-reflection)
#      * Extra tools (e.g., multiple calls to candidate_profile_analyzer)
#      * Orchestrator-level retries or business retries
#    - These are not written into the reference trajectory, but will naturally be reflected in Precision/Recall;
#      when analyzing results, focus on In-order Match, Recall, and path diversity metrics.