| # Full reference-trajectory configuration - SocialMediaManager-H_A2A | |
| # | |
| # Version: ported from SocialMediaManager-A2A and adapted to the A2A_mix hybrid architecture | |
| # Principle: keep business logic unchanged while adapting to the hybrid framework hierarchy (LangGraph + CrewAI + AutoGen) | |
| # | |
| # A2A_mix hybrid-architecture characteristics: | |
| # - Stage 1 (Topic Analysis): LangGraph | |
| # * Uses [Chain] LangGraph instead of CrewAI's Crew***.kickoff | |
| # * Uses a simplified AGENT name: "agent" (not the full role name) | |
| # * Tool calls appear under [Chain] tools, supporting batched execution | |
| # * LangGraph-specific chains: _should_continue and format_output | |
| # | |
| # - Stage 2 (Content Generation): CrewAI | |
| # * Keeps the standard [Chain] Crew***.kickoff structure | |
| # * Uses the full agent role name: "Shakespearean Bard._execute_core" | |
| # * Tool calls appear directly under AGENT (no intermediate Chain) | |
| # | |
| # - Stage 3 (Post Review): AutoGen | |
| # * AGENT pattern: create_agent + invoke_agent | |
| # * Ignore create_agent (excluded from evaluation) | |
| # * Focus on invoke_agent execution | |
| # * Tool prefix is "execute_tool" | |
| # * Filter all [SPAN] mcp client/operation and its children | |
| # | |
| # Dynamic reference-trajectory design (5-way dynamic composition): | |
| # 1. LangGraph tools batched-execution grouping (2 options): | |
| # - [1,1]: two Chain: tools, each containing 1 tool | |
| # - [2]: one Chain: tools containing 2 tools | |
| # | |
| # 2. LangGraph tools order (2! = 2 options): | |
| # - keyword_extractor → topic_complexity_analyzer | |
| # - topic_complexity_analyzer → keyword_extractor | |
| # | |
| # 3. AutoGen LLM/Tool insertion pattern (2^4 = 16 options): | |
| # Rule: must start and end with an LLM; between adjacent tools there may be 0 or 1 LLM | |
| # - 5 tools have 4 adjacency gaps → 2^4 = 16 combinations | |
| # - Example: LLM → Tool1 → Tool2 → Tool3 → Tool4 → Tool5 → LLM (no insertion) | |
| # LLM → Tool1 → LLM → Tool2 → LLM → Tool3 → LLM → Tool4 → LLM → Tool5 → LLM (insert everywhere) | |
| # | |
| # 4. AutoGen tools order (5! = 120 options): | |
| # - The 5 verification tools can appear in any order | |
| # - character_counter_tool, emoji_detector_tool, post_structure_validator, | |
| # shakespearean_style_detector, tone_analyzer | |
| # | |
| # 5. CrewAI tool order (5! = 120 options): | |
| # - Shakespearean Bard's 5 validation tools can appear in any order | |
| # - keyword_extractor must be the first tool (not permuted) | |
| # | |
| # Total combinations: 2 × 2 × 16 × 120 × 120 = 921,600 reference variants | |
| # | |
| # Evaluation strategy: for each sample, select the variant with the highest score: | |
| # exact_match×3 + in_order_match×2 + any_order_match×1 | |
| # Project name | |
| project_name: "SocialMediaManager-H_A2A" | |
| # Extraction types | |
| extract_types: | |
| - "SPAN" # multi-level SPAN structure | |
| - "Chain" # Chain nodes for LangGraph/CrewAI | |
| - "AGENT" # Agent nodes (AutoGen: only invoke_agent is extracted) | |
| - "LLM" # LLM calls | |
| - "Tool" # tool calls | |
| # ============================================================================ | |
| # Reference trajectory (Ground Truth) - A2A_mix hybrid architecture | |
| # ============================================================================ | |
| # | |
| # Visual structure (ideal execution path; example with batched tools execution): | |
| # | |
| # [SPAN] shakespeare_x_post_orchestrator | |
| # └─ [SPAN] crew_execution | |
| # ├─ [SPAN] analyze_topic (LangGraph) | |
| # │ └─ [SPAN] a2a_call_topic_analyzer | |
| # │ └─ [SPAN] topic_analyzer_server_execution | |
| # │ └─ [Chain] LangGraph | |
| # │ ├─ [AGENT] agent | |
| # │ │ ├─ [LLM] * | |
| # │ │ └─ [Chain] _should_continue | |
| # │ ├─ [Chain] tools (batched execution of 2 tools; possible groupings: 1+1, 2) | |
| # │ │ ├─ [Tool] keyword_extractor | |
| # │ │ └─ [Tool] topic_complexity_analyzer | |
| # │ ├─ [AGENT] agent | |
| # │ │ ├─ [LLM] * | |
| # │ │ └─ [Chain] _should_continue | |
| # │ └─ [Chain] format_output | |
| # └─ [SPAN] content_generation_loop | |
| # ├─ [SPAN] a2a_call_content_generator (CrewAI) | |
| # │ └─ [SPAN] content_generator_server_execution | |
| # │ └─ [Chain] Crew***.kickoff | |
| # │ └─ [AGENT] Shakespearean Bard | |
| # │ ├─ [LLM] * | |
| # │ ├─ [Tool] keyword_extractor | |
| # │ ├─ [LLM] * | |
| # │ ├─ [Tool] character_counter_tool | |
| # │ ├─ [LLM] * | |
| # │ ├─ [Tool] emoji_detector_tool | |
| # │ ├─ [LLM] * | |
| # │ ├─ [Tool] post_structure_validator | |
| # │ ├─ [LLM] * | |
| # │ ├─ [Tool] shakespearean_style_detector | |
| # │ ├─ [LLM] * | |
| # │ ├─ [Tool] tone_analyzer | |
| # │ └─ [LLM] * | |
| # └─ [SPAN] a2a_call_post_reviewer (AutoGen) | |
| # └─ [SPAN] post_reviewer_autogen_execution | |
| # └─ [AGENT] invoke_agent x_post_verifier | |
| # ├─ [LLM] * | |
| # ├─ [Tool] execute_tool character_counter_tool | |
| # ├─ [Tool] execute_tool emoji_detector_tool | |
| # ├─ [Tool] execute_tool post_structure_validator | |
| # ├─ [Tool] execute_tool shakespearean_style_detector | |
| # ├─ [Tool] execute_tool tone_analyzer | |
| # └─ [LLM] * | |
| # | |
| # Notes: | |
| # - Under LangGraph's [Chain] tools there may be batched calls (2 tools can be grouped as 1+1 or 2) | |
| # - AutoGen create_agent nodes are excluded from the reference trajectory | |
| # - AutoGen [SPAN] mcp client/operation and its children are excluded from the reference trajectory | |
| # - Between AutoGen tools there may be 0 or 1 LLM; the evaluator will generate all valid patterns | |
| # ============================================================================ | |
| # Default reference trajectory (compatibility): batched LangGraph tools, AutoGen compact mode | |
| reference_trajectory: | |
| # ===== Top-level SPAN ===== | |
| - "SPAN: shakespeare_x_post_orchestrator" | |
| # ===== Second-level SPAN (includes retry logic) ===== | |
| - "SPAN: crew_execution" | |
| # ===== Stage 1: Topic Analysis (LangGraph; 2 tools) ===== | |
| - "SPAN: analyze_topic" | |
| - "SPAN: a2a_call_topic_analyzer" | |
| - "SPAN: topic_analyzer_server_execution" | |
| - "Chain: LangGraph" | |
| - "AGENT: agent" | |
| - "LLM: *" | |
| - "Chain: _should_continue" | |
| - "Chain: tools" | |
| - "Tool: keyword_extractor" | |
| - "Tool: topic_complexity_analyzer" | |
| - "AGENT: agent" | |
| - "LLM: *" | |
| - "Chain: _should_continue" | |
| - "Chain: format_output" | |
| # ===== Stage 2: Content Generation (CrewAI) ===== | |
| - "SPAN: content_generation_loop" | |
| - "SPAN: a2a_call_content_generator" | |
| - "SPAN: content_generator_server_execution" | |
| - "Chain: Crew***.kickoff" | |
| - "AGENT: Shakespearean Bard" | |
| - "LLM: *" | |
| - "Tool: keyword_extractor" | |
| - "LLM: *" | |
| - "Tool: character_counter_tool" | |
| - "LLM: *" | |
| - "Tool: emoji_detector_tool" | |
| - "LLM: *" | |
| - "Tool: post_structure_validator" | |
| - "LLM: *" | |
| - "Tool: shakespearean_style_detector" | |
| - "LLM: *" | |
| - "Tool: tone_analyzer" | |
| - "LLM: *" | |
| # ===== Stage 3: Post Review (AutoGen) ===== | |
| - "SPAN: a2a_call_post_reviewer" | |
| - "SPAN: post_reviewer_autogen_execution" | |
| - "AGENT: invoke_agent x_post_verifier" | |
| - "LLM: *" | |
| - "Tool: execute_tool character_counter_tool" | |
| - "Tool: execute_tool emoji_detector_tool" | |
| - "Tool: execute_tool post_structure_validator" | |
| - "Tool: execute_tool shakespearean_style_detector" | |
| - "Tool: execute_tool tone_analyzer" | |
| - "LLM: *" | |
| # Target tool list (used for the single-tool use metric) | |
| target_tools: | |
| # Topic Analysis stage (LangGraph) | |
| - "Tool: keyword_extractor" | |
| - "Tool: topic_complexity_analyzer" | |
| # Content Generation stage (CrewAI) | |
| - "Tool: character_counter_tool" | |
| - "Tool: emoji_detector_tool" | |
| - "Tool: post_structure_validator" | |
| - "Tool: shakespearean_style_detector" | |
| - "Tool: tone_analyzer" | |
| # Post Review stage (AutoGen; note the execute_tool prefix) | |
| - "Tool: execute_tool character_counter_tool" | |
| - "Tool: execute_tool emoji_detector_tool" | |
| - "Tool: execute_tool post_structure_validator" | |
| - "Tool: execute_tool shakespearean_style_detector" | |
| - "Tool: execute_tool tone_analyzer" | |
| # 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" | |
| # Permutable tool-group configuration (for dynamic tool-order matching) | |
| permutable_tool_groups: | |
| # Shakespearean Bard validation tools can be in any order (CrewAI part) | |
| # Note: keyword_extractor must be the first tool and is not permuted | |
| shakespearean_bard_validation_tools: | |
| - "Tool: character_counter_tool" | |
| - "Tool: emoji_detector_tool" | |
| - "Tool: post_structure_validator" | |
| - "Tool: shakespearean_style_detector" | |
| - "Tool: tone_analyzer" | |
| # ============================================================================ | |
| # Usage notes - A2A_mix hybrid architecture | |
| # ============================================================================ | |
| # | |
| # 1. Hybrid framework characteristics: | |
| # - Stage 1 (Topic Analysis): LangGraph | |
| # * Chain name: LangGraph (not Crew***.kickoff) | |
| # * Simplified AGENT name: agent (not a full role name) | |
| # * Batched tool execution: [Chain] tools may contain multiple Tool nodes | |
| # * Special chains: _should_continue and format_output | |
| # | |
| # - Stage 2 (Content Generation): CrewAI | |
| # * Standard CrewAI structure: Crew***.kickoff → AGENT → LLM/Tool | |
| # * Full AGENT name: Shakespearean Bard | |
| # * keyword_extractor must be the first tool; subsequent validation tools may be in any order | |
| # | |
| # - Stage 3 (Post Review): AutoGen | |
| # * Ignore create_agent (excluded from evaluation) | |
| # * Focus on invoke_agent x_post_verifier | |
| # * Tool prefix: execute_tool | |
| # * Filter all [SPAN] mcp client/operation and its children | |
| # | |
| # 2. LangGraph dynamic tool mode (grouping + order): | |
| # The evaluator automatically detects the tools grouping pattern and tool order in each sample, | |
| # and dynamically generates matching reference variants. | |
| # | |
| # Grouping patterns (2 options): | |
| # - [1,1]: 2 Chain: tools, each with 1 Tool | |
| # - [2]: 1 Chain: tools, with 2 Tools | |
| # | |
| # Tool order (2! = 2 options): | |
| # - keyword_extractor → topic_complexity_analyzer | |
| # - topic_complexity_analyzer → keyword_extractor | |
| # | |
| # 3. AutoGen dynamic mode (LLM insertion + tool order): | |
| # The evaluator automatically detects the LLM/Tool calling pattern and tool order in AutoGen, | |
| # and dynamically generates matching reference variants. | |
| # | |
| # LLM insertion patterns (2^4 = 16 options): | |
| # - Compact: LLM → Tool1 → Tool2 → Tool3 → Tool4 → Tool5 → LLM | |
| # (consecutive tool calls with no LLM between tools) | |
| # - Interleaved: LLM → Tool1 → LLM → Tool2 → ... → Tool5 → LLM | |
| # (LLM calls interleaved between tools) | |
| # - Mixed: LLM is inserted between some tools but not others (16 combinations) | |
| # | |
| # Tool order (5! = 120 options): | |
| # - The 5 verification tools can be in any order | |
| # - character_counter_tool, emoji_detector_tool, post_structure_validator, | |
| # shakespearean_style_detector, tone_analyzer | |
| # | |
| # Validation rules: | |
| # - Must start and end with an LLM | |
| # - Must contain all 5 target tools in the middle (order can vary) | |
| # - At most one LLM between adjacent tools | |
| # | |
| # 4. Dynamic reference selection strategy (5-way combination): | |
| # For each sample: | |
| # a) Detect the actual LangGraph tools grouping pattern | |
| # b) Enumerate LangGraph tool order (2! = 2) | |
| # c) Detect the actual AutoGen Post Review LLM/Tool pattern | |
| # d) Enumerate AutoGen tool order (5! = 120) | |
| # e) Enumerate CrewAI tool permutations (5! = 120) | |
| # f) Enumerate all combinations | |
| # - LangGraph grouping: 2 | |
| # - LangGraph order: 2 | |
| # - AutoGen LLM insertion: 16 | |
| # - AutoGen order: 120 | |
| # - CrewAI permutations: 120 | |
| # - Total variants: 2 × 2 × 16 × 120 × 120 = 921,600 | |
| # g) For each variant compute exact_match, in_order_match, any_order_match | |
| # h) Select the variant with the highest composite score | |
| # Composite score = exact_match×3 + in_order_match×2 + any_order_match×1 | |
| # | |
| # 5. Metric definitions (consistent with A2A): | |
| # - Exact Match: predicted trajectory matches the reference exactly | |
| # - In-order Match: reference is a subsequence of the predicted trajectory | |
| # - Any-order Match: all required steps are present (order ignored) | |
| # - Precision: fraction of predicted steps that are correct | |
| # - Recall: fraction of reference steps covered by prediction | |
| # - Single-tool Use: average usage rate of target tools | |
| # - unique_path_ratio: path diversity | |
| # - path_entropy: path entropy | |
| # | |
| # 6. Run command: | |
| # cd /Users/wzr/TOSEM-2025/RESULTS/RQ-Failure_Breakdown/SocialMediaManager-H_A2A | |
| # python3 evaluate_trajectory.py --config reference_trajectory.yaml | |
| # | |
| # 7. Key differences vs the A2A version: | |
| # - LangGraph-specific Chain node structure | |
| # - Simplified AGENT name (LangGraph uses "agent") | |
| # - AutoGen invoke_agent pattern | |
| # - Dynamic handling of LangGraph batched tools execution | |
| # - Dynamic handling of AutoGen LLM/Tool insertion patterns (new) | |
| # - AutoGen tool prefix: execute_tool (not CrewAI tool names) | |
| # - Filter AutoGen MCP client/operation SPAN nodes | |
| # - Triple dynamic matching across LangGraph, CrewAI, and AutoGen | |
| # | |
| # 8. Special filtering rules: | |
| # - Filter all [SPAN] mcp client/operation and its children (AutoGen noise) | |
| # - Filter [AGENT] create_agent (AutoGen initialization, not business logic) | |
| # - Keep [AGENT] invoke_agent (actual AutoGen execution) | |
| # | |
| # 9. Tool-order notes: | |
| # - LangGraph Topic Analysis: 2 tools can be in any order (2! = 2) | |
| # - CrewAI Shakespearean Bard: keyword_extractor must be first; the 5 validation tools can be permuted (5! = 120) | |
| # - AutoGen Post Review: the 5 verification tools can be in any order (5! = 120) | |
| # | |