File size: 8,624 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
# Complete Reference Trajectory Configuration - SQLAssistant-H_A2A Project
#
# This configuration is ported from the SQLAssistant-A2A version, keeping the core consistent:
# - Still evaluates the same business stages, LLM calls, and database-related tools
# - Still uses the same 6 trajectory metrics + path diversity metrics
#
# Only adapted for A2A_mix trajectory hierarchy and framework differences:
# - Top-level SPAN: sql_assistant_workflow_a2a
# - Second-level SPAN: a2a_execution
# - Stage 1: generate_sql still executed by CrewAI (two Agents, same as A2A)
# - Stage 2: check_compliance changed to LangGraph orchestration graph (agent + tools + format_output)
# - Stage 3: interpret_results changed to AutoGen architecture (result_interpreter_autogen_execution + invoke_agent result_interpreter)
#
# Refer to actual execution samples in RESULTS/<model>/SQLAssistant-H_A2A/test_results/run_*/execution_path.md.

# Project name (determines trajectory collection from RESULTS/<model>/<project_name>/test_results)
project_name: "SQLAssistant-H_A2A"

# Trajectory extraction type configuration: consistent with A2A / MCP versions
extract_types:
  - "SPAN" # Multi-layer SPAN structure (including *_a2a, a2a_execution, generate_sql, etc.)
  - "Chain" # Chain nodes in CrewAI / LangGraph / AutoGen (e.g., Crew***.kickoff, LangGraph, RunnableSequence)
  - "Agent" # CrewAI Agents, AutoGen create/invoke Agents, LangGraph "agent" nodes
  - "LLM" # LLM calls
  - "Tool" # Tool calls (database schema / validation / query, etc.)

# A2A_mix version also has no chapter-style repeatable patterns
repeatable_patterns: []

# ==========================================================================
# Reference Trajectory (Ground Truth) - A2A_mix Architecture, based on code design + trajectory samples
# ==========================================================================
#
# Ideal execution path (no retries, no errors) hierarchical structure (abstracted from A2A_mix execution_path):
#
# [SPAN] sql_assistant_workflow_a2a
# └─ [SPAN] a2a_execution
#    ├─ [SPAN] generate_sql
#    │  └─ [SPAN] a2a_call_sql_generation
#    │     └─ [SPAN] sql_generation_server_execution
#    │        └─ [Chain] Crew***.kickoff
#    │           ├─ [AGENT] Expert SQL Query Generator
#    │           │  ├─ [LLM] *
#    │           │  ├─ [Tool] get_database_schema
#    │           │  └─ [LLM] *
#    │           └─ [AGENT] Senior SQL Code Reviewer
#    │              ├─ [LLM] *
#    │              ├─ [Tool] validate_sql_syntax
#    │              ├─ [LLM] *
#    │              ├─ [Tool] get_database_schema
#    │              └─ [LLM] *
#    ├─ [SPAN] check_compliance
#    │  └─ [SPAN] a2a_call_compliance_checker
#    │     └─ [SPAN] compliance_checker_server_execution
#    │        └─ [Chain] LangGraph
#    │           ├─ [AGENT] agent
#    │           │  ├─ [LLM] *
#    │           │  └─ [Chain] _should_continue
#    │           ├─ [Chain] tools
#    │           │  └─ [Tool] get_database_schema
#    │           ├─ [AGENT] agent
#    │           │  ├─ [LLM] *
#    │           │  └─ [Chain] _should_continue
#    │           └─ [Chain] format_output
#    └─ [SPAN] interpret_results
#       └─ [SPAN] a2a_call_result_interpreter
#          └─ [SPAN] result_interpreter_autogen_execution
#             └─ [AGENT] invoke_agent result_interpreter
#                ├─ [LLM] *
#                ├─ [Tool] run_sql_query
#                └─ [LLM] *
#
# Notes:
# - Business stages (generate_sql → check_compliance → interpret_results), key Agent roles, and core tools
#   remain consistent with SQLAssistant-A2A version, just with framework changed to CrewAI + LangGraph + AutoGen combination.
# - In LangGraph stage, ideal path uses get_database_schema as schema tool;
#   check_table_exists and other existence check tools are considered optional additional calls.
# - In AutoGen stage, result interpretation is completed through invoke_agent result_interpreter,
#   actual SQL execution is still handled by run_sql_query tool (still considered a core tool to cover in tool list).
# - Business retries (business_retry N) and orchestrator-level retries (retry N) are not written into reference trajectory,
#   evaluation allows extra steps and retries to exist according to in_order / any_order metrics.

reference_trajectory:
  # ===== Top-level SPAN (A2A_mix top-level workflow) =====
  - "SPAN: sql_assistant_workflow_a2a"

  # ===== Second-level SPAN (A2A_mix execution wrapper layer) =====
  - "SPAN: a2a_execution"

  # ===== Stage 1: Generate SQL (SQLGenerationCrew, CrewAI) =====
  - "SPAN: generate_sql"
  - "SPAN: a2a_call_sql_generation"
  - "SPAN: sql_generation_server_execution"
  - "Chain: Crew***.kickoff"
  # Agent 1: SQL Generator (uses key schema exploration tools)
  - "Agent: Expert SQL Query Generator"
  - "LLM: *" # Determine overall generation strategy
  - "Tool: get_database_schema" # Read complete schema
  - "LLM: *" # Generate candidate SQL based on schema
  # Other exploration tools (list_tables / get_table_sample / get_column_stats) are considered optional

  # Agent 2: SQL Reviewer (syntax and structure checking)
  - "Agent: Senior SQL Code Reviewer"
  - "LLM: *" # Read and understand generated SQL
  - "Tool: validate_sql_syntax" # Required: syntax check
  - "LLM: *" # Analyze syntax check results
  - "Tool: get_database_schema" # Required: verify table/column existence against schema
  - "LLM: *" # Correct SQL based on schema check results

  # ===== Stage 2: Check Compliance (LangGraph) =====
  - "SPAN: check_compliance"
  - "SPAN: a2a_call_compliance_checker"
  - "SPAN: compliance_checker_server_execution"
  - "Chain: LangGraph" # Top-level chain of LangGraph orchestration graph
  - "Agent: agent" # Compliance "agent" node in LangGraph
  - "LLM: *" # Preliminary reading of SQL and identifying potential risks
  - "Chain: _should_continue" # LangGraph internal flow control node
  # LangGraph's tools subchain should use schema / table existence related tools at least once
  - "Chain: tools"
  - "Tool: get_database_schema" # Evaluate sensitivity combined with schema (consistent with Reviewer/Compliance semantics)
  # check_table_exists is an equivalent existence check tool, can appear simultaneously in actual trajectory
  - "LLM: *" # Update compliance judgment combined with tool results
  - "Agent: agent" # Merge context again, generate final verdict
  - "LLM: *" # Give PASS/FAIL verdict
  - "Chain: _should_continue" # LangGraph internal flow control node
  - "Chain: format_output"

  # ===== Stage 3: Interpret Results (AutoGen) =====
  # Note: Only enters this stage if compliance passes
  - "SPAN: interpret_results"
  - "SPAN: a2a_call_result_interpreter"
  - "SPAN: result_interpreter_autogen_execution"
  - "Agent: invoke_agent result_interpreter" # Call result interpretation Agent to complete reasoning
  - "LLM: *" # Understand business question and reviewed SQL
  - "Tool: run_sql_query" # Required: execute SQL to get real data
  - "LLM: *" # Generate business interpretation based on real results (count_rows is optional statistics tool)
  # Actual SQL execution should still be completed through run_sql_query tool, see target_tools configuration

# Target tool list (used by single_tool_use metric)
# Consistent with A2A / MCP versions, covers all core tools (including some optional tools)
target_tools:
  # SQL Generation stage - Generator
  - "Tool: get_database_schema"
  - "Tool: get_table_sample"
  - "Tool: get_column_stats"
  - "Tool: list_tables"
  # SQL Generation stage - Reviewer
  - "Tool: validate_sql_syntax"
  - "Tool: check_table_exists"
  # Compliance stage (shares get_database_schema / check_table_exists, not repeated)
  # Result Interpretation stage
  - "Tool: run_sql_query"
  - "Tool: count_rows"

# List of models to evaluate (consistent with A2A / MCP versions, path only changed to SQLAssistant-H_A2A)
models:
  - "GPT-5"
  - "GPT-4o-mini"
  - "DeepSeek-V3-1"
  - "DeepSeek-R1"
  - "Gemini-2.5-flash"
  - "Gemini-2.5-flash-nothinking"
  - "Qwen3-235b"
# Usage instructions (simplified version):
# - Run path: Execute in RQ-Failure_Breakdown/SQLAssistant-H_A2A directory:
#     python3 evaluate_trajectory-Filter_Tools.py --config reference_trajectory.yaml
# - evaluate_trajectory-Filter_Tools.py will automatically read
#   RESULTS/<model>/SQLAssistant-H_A2A/test_results based on project_name for execution_path.md.