# RecruitmentAssistant-H_A2A Evaluation Scripts This directory contains evaluation scripts for analyzing the RecruitmentAssistant-H_A2A (Hybrid A2A) project results. ## Architecture This project uses a hybrid Agent-to-Agent (A2A) architecture: - **LangGraph** - Job Analysis stage with dynamic batched tool execution - **CrewAI** - Candidate Evaluation stage with standard CrewAI structure - **AutoGen** - Interview Communication stage with flexible LLM/tool patterns ## Scripts ### 1. analyze_retry_patterns.py Analyzes RETRY patterns in execution paths. **Features:** - Counts error occurrences by location and type - Calculates RETRY rates per model - Identifies maximum RETRY attempts - Tracks errors by agent and node type **Output:** - `retry_analysis.json` - Detailed JSON results - `retry_summary.csv` - Summary statistics - `error_by_agent.csv` - Error breakdown by agent **Usage:** ```bash python3 analyze_retry_patterns.py ``` ### 2. evaluate_success.py Calculates success rates for each model. **Success Criteria:** - Reports folder exists - Contains at least 2 markdown files **Output:** - `success_detailed_results.json` - Detailed results per session - `success_rate.csv` - Success rate summary **Usage:** ```bash python3 evaluate_success.py ``` ### 3. evaluate_trajectory-mix.py Evaluates trajectory metrics with hybrid architecture support. **Special Features:** - **Dynamic LangGraph matching** - Handles batched tool execution patterns (3-4 searches) - **AutoGen LLM insertion** - Flexible LLM call patterns between tools - **Tool order permutation** - Evaluates different tool call orders **Metrics:** - Exact match - In-order match - Any-order match - Precision - Recall - Single-tool use - Path diversity (unique path ratio, path entropy) **Output:** - `evaluation_results.csv` - Trajectory evaluation results **Usage:** ```bash python3 evaluate_trajectory-mix.py --config reference_trajectory.yaml ``` ### 4. reference_trajectory.yaml Configuration file defining reference trajectories and evaluation parameters. **Key Sections:** - `reference_trajectory_3x` - Reference for 3 web searches - `reference_trajectory_4x` - Reference for 4 web searches - `target_tools` - Required tools for evaluation - `models` - List of models to evaluate - `permutable_tool_groups` - Tool groups that can appear in any order - `extract_types` - Node types to extract (SPAN, Chain, AGENT, LLM, Tool) ## Dynamic Matching The hybrid architecture requires sophisticated matching: ### Layer 1: LangGraph Tools Batching - 3 searches: 4 grouping patterns `[1,1,1]`, `[1,2]`, `[2,1]`, `[3]` - 4 searches: 7 grouping patterns `[1,1,1,1]`, `[2,1,1]`, `[1,2,1]`, `[1,1,2]`, `[3,1]`, `[1,3]`, `[4]` ### Layer 2: AutoGen LLM Insertion - 2 tools: 2 patterns (0 or 1 LLM between tools) - 3 tools: 4 patterns (2^2 combinations) ### Layer 3: Tool Order Permutation - Candidate evaluation tools can appear in any order - Interview communication tools can appear in any order **Total combinations:** Up to 7 × 2 × (permutations) variants per sample ## Configuration Edit `reference_trajectory.yaml` to: - Modify reference trajectories - Add/remove models - Adjust tool evaluation criteria - Configure dynamic matching patterns - Enable/disable pattern matching layers ## Requirements - Python 3.7+ - pandas - pyyaml Install dependencies: ```bash pip install pandas pyyaml ``` ## Data Structure Expected directory structure: ``` /Users/wzr/TOSEM-2025/RESULTS/ ├── ModelName/ │ └── RecruitmentAssistant-H_A2A/ │ └── test_results/ │ ├── session_1/ │ │ ├── execution_path.md │ │ └── reports/ │ │ ├── file1.md │ │ └── file2.md │ └── session_2/ │ └── ... ``` ## Notes - The hybrid architecture requires more flexible matching than standard frameworks - Dynamic reference selection adapts to different model execution strategies - All scripts output CSV files for easy analysis - JSON files contain detailed per-session information - Modify `BASE_DIR` in scripts if using a different results directory - The evaluation automatically selects the best-matching reference variant per sample