SQLAssistant-H_A2A Evaluation Scripts
This directory contains evaluation scripts for the SQLAssistant-H_A2A project, which analyzes the execution trajectories and performance metrics of different AI models.
Files
Configuration
reference_trajectory.yaml- Reference trajectory configuration defining the expected execution path for the SQLAssistant workflow
Evaluation Scripts
evaluate_trajectory-Filter_Tools-mix.py- Main trajectory evaluation script that computes 6 trajectory metricsevaluate_success.py- Success rate analysis based on required tool executionevaluate_scores.py- Score statistics collection from execution logsanalyze_retry_patterns.py- RETRY pattern analysis including business retries and orchestrator retries
Trajectory Metrics
The evaluation framework computes the following 6 metrics:
- Exact Match - Predicted trajectory must exactly match the reference trajectory
- In-Order Match - Reference trajectory must be a subsequence of predicted trajectory
- Any-Order Match - Predicted trajectory must contain all necessary actions (order-agnostic)
- Precision - Ratio of correct actions in predicted trajectory
- Recall - Ratio of reference actions covered by predicted trajectory
- Single-Tool Use - Usage rate of specific tools
Additional diversity metrics:
- Unique Path Ratio - Number of unique trajectories / total samples
- Path Entropy - Shannon entropy of trajectory distribution
Usage
Trajectory Evaluation
python3 evaluate_trajectory-Filter_Tools-mix.py --config reference_trajectory.yaml
Options:
--config- Path to reference trajectory configuration file (YAML format)--base-dir- RESULTS directory path (defaults to two levels up from script location)--output- Output CSV file path--diagnose-failures- Diagnose any_order_match failure reasons and generate report
Success Rate Analysis
python3 evaluate_success.py
Success criterion: Whether the get_database_schema tool was executed (required for understanding database structure).
Score Statistics
python3 evaluate_scores.py
Collects and analyzes scores from execution logs.
Retry Pattern Analysis
python3 analyze_retry_patterns.py
Analyzes two types of retries:
- Orchestrator RETRY - Framework-level retries (e.g.,
[SPAN] crew_execution (retry N)) - BUSINESS-RETRY - Business logic retries (e.g.,
[SPAN] generate_sql (business_retry N))
Models Evaluated
- GPT-5
- GPT-4o-mini
- DeepSeek-V3-1
- DeepSeek-R1
- Gemini-2.5-flash
- Gemini-2.5-flash-nothinking
- Qwen3-235b
Project Structure
The SQLAssistant-H_A2A project uses a hybrid architecture combining:
- CrewAI for SQL generation stage
- LangGraph for compliance checking stage
- AutoGen for result interpretation stage
Workflow Stages
Generate SQL - CrewAI-based SQL generation with two agents:
- Expert SQL Query Generator
- Senior SQL Code Reviewer
Check Compliance - LangGraph orchestration for compliance validation
Interpret Results - AutoGen-based result interpretation and SQL execution
Output Files
evaluation_results.csv- Trajectory evaluation results for all modelssuccess_rate.csv- Success rate summarysuccess_detailed_results.json- Detailed success analysisscore_summary.csv- Score statistics summaryscore_analysis.json- Detailed score analysisretry_summary.csv- Retry pattern summaryretry_analysis.json- Detailed retry analysiserror_by_agent.csv- Error statistics by agentbusiness_retry_chapters.csv- Business retry location statisticsany_order_match_failures.csv- Failure diagnosis (if enabled)
Requirements
- Python 3.x
- pandas
- PyYAML
- pathlib
- collections
- json
- csv
- re
- math