| # Full reference trajectory configuration - RecruitmentAssistant-MCP project | |
| # | |
| # Version: ideal trajectory based on code design (applies to all models) | |
| # Principle: only include steps explicitly required by the code design; do not rely on test statistics | |
| # | |
| # Code design analysis: | |
| # 1. Three Crews run sequentially (orchestrator.py): | |
| # - 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 analysis: | |
| # - Crew 1: unified_web_search (MCP tool; web search for market research) | |
| # - Crew 2: candidate_evaluator_pro (MCP tool; candidate evaluation and scoring) | |
| # - Crew 3: comprehensive_interview_material_generator (MCP tool; interview materials generation) + | |
| # email_template_generator (MCP tool; email template generation) | |
| # | |
| # 3. Execution flow: | |
| # - orchestrator creates the top-level SPAN: recruitment_orchestrator | |
| # - orchestrator creates crew_execution SPAN containing 3 child SPANs | |
| # - Crew SPANs: analyze_job, evaluate_candidates, prepare_interviews | |
| # - Each Crew includes one Chain and one Agent | |
| # - The Agent uses the LLM to decide tool calls; after tool returns, the LLM generates the output | |
| # | |
| # 4. SPAN hierarchy: | |
| # - recruitment_orchestrator (top-level; orchestrator.py line 353) | |
| # └─ crew_execution (contains 3 Crews; orchestrator.py line 371) | |
| # ├─ analyze_job (Crew 1; orchestrator.py line 141) | |
| # ├─ evaluate_candidates (Crew 2; orchestrator.py line 190) | |
| # └─ prepare_interviews (Crew 3; orchestrator.py line 238) | |
| # Project name | |
| project_name: "RecruitmentAssistant-MCP" | |
| # Trajectory extraction type configuration | |
| extract_types: | |
| - "SPAN" # Multi-level SPAN structure | |
| - "Chain" # Kickoff chain for each Crew | |
| - "AGENT" # Agent for each Crew | |
| - "LLM" # LLM calls | |
| - "Tool" # MCP tool calls | |
| # ============================================================================ | |
| # Reference trajectory (Ground Truth) - based on code design | |
| # ============================================================================ | |
| # | |
| # Diagram (ideal execution path): | |
| # | |
| # Note: dynamically select the reference trajectory based on the actual number of unified_web_search calls: | |
| # - 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 | |
| # | |
| # === Version 1: 3x unified_web_search === | |
| # [SPAN] recruitment_orchestrator | |
| # └─ [SPAN] crew_execution | |
| # ├─ [SPAN] analyze_job | |
| # │ └─ [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 search) | |
| # │ └─ [LLM] * | |
| # ├─ [SPAN] evaluate_candidates | |
| # │ └─ [Chain] Crew***.kickoff | |
| # │ └─ [AGENT] Senior Candidate Evaluator | |
| # │ ├─ [LLM] * | |
| # │ ├─ [Tool] candidate_evaluator_pro | |
| # │ └─ [LLM] * | |
| # └─ [SPAN] prepare_interviews | |
| # └─ [Chain] Crew***.kickoff | |
| # └─ [AGENT] Senior Interview Materials Coordinator | |
| # ├─ [LLM] * | |
| # ├─ [Tool] comprehensive_interview_material_generator | |
| # ├─ [LLM] * | |
| # ├─ [Tool] email_template_generator | |
| # └─ [LLM] * | |
| # | |
| # === Version 2: 4x unified_web_search === | |
| # [SPAN] recruitment_orchestrator | |
| # └─ [SPAN] crew_execution | |
| # ├─ [SPAN] analyze_job | |
| # │ └─ [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 search) | |
| # │ ├─ [LLM] * | |
| # │ ├─ [Tool] unified_web_search (4th search) | |
| # │ └─ [LLM] * | |
| # ├─ [SPAN] evaluate_candidates | |
| # │ └─ [Chain] Crew***.kickoff | |
| # │ └─ [AGENT] Senior Candidate Evaluator | |
| # │ ├─ [LLM] * | |
| # │ ├─ [Tool] candidate_evaluator_pro | |
| # │ └─ [LLM] * | |
| # └─ [SPAN] prepare_interviews | |
| # └─ [Chain] Crew***.kickoff | |
| # └─ [AGENT] Senior Interview Materials Coordinator | |
| # ├─ [LLM] * | |
| # ├─ [Tool] comprehensive_interview_material_generator | |
| # ├─ [LLM] * | |
| # ├─ [Tool] email_template_generator | |
| # └─ [LLM] * | |
| # | |
| # Design basis: | |
| # - orchestrator.py: runs 3 Crews sequentially, with retry support | |
| # - Each Crew has 1 Agent and 1 Task | |
| # - job_analysis_crew.py: Senior Job Requirements Analyst uses unified_web_search | |
| # * agents.yaml: requires 3-5 targeted searches | |
| # * tasks.yaml: requires searching market data, salary standards, industry trends, etc. | |
| # - candidate_evaluation_crew.py: Senior Candidate Evaluator uses candidate_evaluator_pro | |
| # * agents.yaml: uses candidate_evaluator_pro to score, rank, and grade all candidates | |
| # * tasks.yaml: must use the candidate_evaluator_pro tool | |
| # - interview_communication_crew.py: Senior Interview Materials Coordinator uses 2 tools | |
| # * agents.yaml: comprehensive_interview_material_generator (interview_stage="all") | |
| # email_template_generator (template_type="all") | |
| # * tasks.yaml: explicitly requires calling these 2 tools | |
| # - All Agent roles are defined in their respective agents.yaml | |
| # - Tools are retrieved from the MCP server via MCPServerAdapter | |
| # | |
| # Ideal trajectory notes: | |
| # - Top-level SPAN: recruitment_orchestrator | |
| # - Second-level SPAN: crew_execution (contains 3 Crews) | |
| # - The 3 Crews run sequentially; each has its own SPAN | |
| # - Each Agent: at least 2 LLM calls + required tool calls | |
| # - Job Analysis: multiple tool calls (unified_web_search; 3-4x for market research) | |
| # - Candidate Evaluation: 1 tool call (candidate_evaluator_pro) | |
| # - Interview Communication: 2 tool calls (comprehensive_interview_material_generator + email_template_generator) | |
| # - This trajectory represents the ideal execution path with no retries and no redundant steps | |
| # | |
| # Notes: | |
| # - "LLM: *" means any LLM model (wildcard match) | |
| # - Agent names must exactly match the role fields in agents.yaml | |
| # - Tool names must exactly match the tool names provided by the MCP server | |
| # - unified_web_search may be called multiple times (3-4x), which is normal for market research | |
| # - Actual execution may include more LLM calls (thinking/planning/etc.); this is expected | |
| # ============================================================================ | |
| # [Deprecated] Original reference trajectory (kept for compatibility) | |
| # Now dynamically select between reference_trajectory_3x and reference_trajectory_4x | |
| reference_trajectory: | |
| # Default to the 3x version (backward compatible) | |
| - "SPAN: recruitment_orchestrator" | |
| - "SPAN: crew_execution" | |
| - "SPAN: analyze_job" | |
| - "Chain: Crew***.kickoff" | |
| - "Agent: Senior Job Requirements Analyst" | |
| - "LLM: *" | |
| - "Tool: unified_web_search" | |
| - "LLM: *" | |
| - "Tool: unified_web_search" | |
| - "LLM: *" | |
| - "Tool: unified_web_search" | |
| - "LLM: *" | |
| - "SPAN: evaluate_candidates" | |
| - "Chain: Crew***.kickoff" | |
| - "Agent: Senior Candidate Evaluator" | |
| - "LLM: *" | |
| - "Tool: candidate_evaluator_pro" | |
| - "LLM: *" | |
| - "SPAN: prepare_interviews" | |
| - "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 Crews) ===== | |
| - "SPAN: crew_execution" | |
| # ===== Crew 1: Job Analysis (3 searches) ===== | |
| - "SPAN: analyze_job" | |
| - "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 ===== | |
| - "SPAN: evaluate_candidates" | |
| - "Chain: Crew***.kickoff" | |
| - "Agent: Senior Candidate Evaluator" | |
| - "LLM: *" # Decide to call tools | |
| - "Tool: candidate_profile_analyzer" # Analyze candidate profiles (optional; recommended) | |
| - "LLM: *" # Process analysis results | |
| - "Tool: candidate_evaluator_pro" # Evaluate all candidates (scoring, ranking, grading) | |
| - "LLM: *" # Produce the final evaluation report | |
| # ===== Crew 3: Interview Communication ===== | |
| - "SPAN: prepare_interviews" | |
| - "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 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 Crews) ===== | |
| - "SPAN: crew_execution" | |
| # ===== Crew 1: Job Analysis (4 searches) ===== | |
| - "SPAN: analyze_job" | |
| - "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 ===== | |
| - "SPAN: evaluate_candidates" | |
| - "Chain: Crew***.kickoff" | |
| - "Agent: Senior Candidate Evaluator" | |
| - "LLM: *" # Decide to call tools | |
| - "Tool: candidate_profile_analyzer" # Analyze candidate profiles (optional; recommended) | |
| - "LLM: *" # Process analysis results | |
| - "Tool: candidate_evaluator_pro" # Evaluate all candidates (scoring, ranking, grading) | |
| - "LLM: *" # Produce the final evaluation report | |
| # ===== Crew 3: Interview Communication ===== | |
| - "SPAN: prepare_interviews" | |
| - "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 package | |
| # Target tool list (used by the single-tool use metric) | |
| # List all required tools here | |
| target_tools: | |
| - "Tool: unified_web_search" | |
| - "Tool: candidate_profile_analyzer" | |
| - "Tool: candidate_evaluator_pro" | |
| - "Tool: comprehensive_interview_material_generator" | |
| - "Tool: email_template_generator" | |
| # ============================================================================ | |
| # Dynamic tool permutation configuration | |
| # ============================================================================ | |
| # Define permutable tool groups for certain stages to generate reference trajectories in different orders | |
| # During evaluation, all permutations are tried and the best-matching one is selected as the reference | |
| 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" | |
| # 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: | |
| # - Level 1: SPAN (recruitment_orchestrator) | |
| # - Level 2: SPAN (crew_execution) | |
| # - Level 3: SPAN (analyze_job, evaluate_candidates, prepare_interviews) | |
| # - Level 4: Chain (Crew***.kickoff; wildcard-normalized UUID) | |
| # - Level 5: AGENT (exact match on agent role) | |
| # - Level 6: LLM (wildcard match any model) | |
| # - Level 6: Tool (exact match on tool name) | |
| # | |
| # 2. Wildcard handling: | |
| # - Crew_<UUID>.kickoff -> Crew***.kickoff (handled automatically by evaluate_trajectory.py) | |
| # - LLM: * -> match any model name (e.g., gpt-5-chat-latest, deepseek-reasoner) | |
| # | |
| # 3. Exact match requirements: | |
| # - SPAN names: "recruitment_orchestrator", "crew_execution", "analyze_job", | |
| # "evaluate_candidates", "prepare_interviews" | |
| # - Chain names: "Crew***.kickoff" (wildcard match) | |
| # - AGENT names: "Senior Job Requirements Analyst", "Senior Candidate Evaluator", | |
| # "Senior Interview Materials Coordinator" | |
| # (exact match the role fields in agents.yaml) | |
| # - LLM: "LLM: *" (wildcard match any model) | |
| # - Tool: exact match MCP tool names (unified_web_search, candidate_evaluator_pro, | |
| # comprehensive_interview_material_generator, email_template_generator) | |
| # | |
| # 4. Metric meanings: | |
| # - Exact Match: trajectories must be identical (including the counts of LLM/tool calls) | |
| # - In-order Match: extra calls allowed, but core steps must appear in order | |
| # - Any-order Match: contains all required steps (order ignored) | |
| # - Precision: fraction of predicted steps considered correct | |
| # - Recall: fraction of reference steps covered | |
| # - Single-tool Use: checks usage of all 4 required tools | |
| # - unique_path_ratio: path diversity (unique full trajectories / sample count) | |
| # - path_entropy: path entropy (Shannon entropy over trajectory frequencies; normalized to 0-1) | |
| # | |
| # 5. Run command: | |
| # cd /Users/wzr/TOSEM-2025/RESULTS/RQ-Failure_Breakdown/RecruitmentAssistant-MCP | |
| # python3 evaluate_trajectory.py --config reference_trajectory.yaml | |
| # | |
| # 6. Design notes: | |
| # - This reference trajectory represents the ideal execution path | |
| # - Three Crews run sequentially; each Crew completes its task independently | |
| # - Crew 1 (Job Analysis): | |
| # * 3x: multiple LLM calls + 3 web searches + LLM report generation | |
| # * 4x: multiple LLM calls + 4 web searches + LLM report generation | |
| # - Crew 2 (Candidate Evaluation): LLM decision + 1 candidate evaluation tool call + LLM report | |
| # - Crew 3 (Interview Communication): LLM decision + 1 interview-material generation + LLM review + 1 email-template generation + LLM merge | |
| # - 3x total: 2 top-level SPANs + 3 Crew SPANs + 3 Chains + 3 Agents + multiple LLM calls + 6 tool calls | |
| # - 4x total: 2 top-level SPANs + 3 Crew SPANs + 3 Chains + 3 Agents + multiple LLM calls + 7 tool calls | |
| # - In-order Match and Recall are often more suitable for evaluating real performance | |
| # | |
| # 7. Dynamic reference trajectory selection: | |
| # - The evaluation script automatically counts unified_web_search calls under analyze_job SPAN for each sample | |
| # - If count <= 3, use reference_trajectory_3x as the reference | |
| # - If count >= 4, use reference_trajectory_4x as the reference | |
| # - This dynamic selection makes evaluation fairer and adapts to different model search strategies | |
| # | |
| # 8. Differences vs. actual trajectories: | |
| # - Actual trajectories may include more LLM calls (thinking/planning/etc.) | |
| # - Job Analysis may call unified_web_search more times (3-5 is normal) | |
| # - Some models may not use candidate_evaluator_pro and instead evaluate manually | |
| # - Some models may call email_template_generator multiple times | |
| # - These differences are not necessarily errors; they reflect different execution strategies | |
| # - Exact Match may be low; focus on In-order Match and Recall | |
| # | |
| # 9. MCP version characteristics: | |
| # - All tools are provided via the MCP server using SSE for communication | |
| # - Tools are fetched from the server via MCPServerAdapter | |
| # - Includes a multi-level SPAN structure (orchestrator + crew_execution + 3 Crews) | |
| # - Three independent Crews collaborate to complete the recruitment workflow | |
| # - Each Crew has clear responsibilities and required tools | |
| # - Supports orchestrator-level retry (max_crew_retries) | |
| # | |
| # 10. Tool usage notes: | |
| # - unified_web_search: for market research (salary standards, industry trends, similar roles, etc.) | |
| # * Recommended 3-4 calls, each targeting a different research angle | |
| # * Params: query (search query), count (number of results; default 5), search_type (type) | |
| # - candidate_evaluator_pro: comprehensive evaluation for all candidates | |
| # * Includes technical score, experience score, cultural fit score | |
| # * Auto ranking and grading (A/B/C/D) | |
| # * Params: candidates_data (candidate data), job_requirements (job requirements) | |
| # - comprehensive_interview_material_generator: generate a complete interview question bank | |
| # * Use interview_stage="all" to generate all stages (screening/technical/behavioral/final) | |
| # * Params: candidate_name, job_title, interview_stage, candidate_background, special_focus_areas | |
| # - email_template_generator: generate various email templates | |
| # * Use template_type="all" to generate all templates (outreach/interview_invite/offer/rejection/follow_up) | |
| # * Params: template_type, candidate_name, job_title, company_name, custom_details | |