File size: 21,813 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
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
# Full reference trajectory configuration - SocialMediaManager-MCP
#
# Version: ideal trajectory derived from the code design (applicable to all models)
# Principle: include only steps explicitly required by the code design, not based on test statistics
#
# Code-design analysis:
# 1. Execution flow (orchestrator.py):
#    - The Orchestrator manages the whole workflow with two layers of retry logic:
#      (a) Orchestrator-level retry: for unexpected exceptions (up to 3 attempts; MAX_CREW_RETRIES=2)
#      (b) Business-logic retry: for validation failures (up to 6 attempts; max_retries=5)
#    - Ideal flow (no retries):
#      Step 1: Topic Analysis (TopicAnalyzerCrew)
#      Step 2-4: Content Generation with Feedback Loop
#        - Generate X post (ShakespeareGeneratorCrew)
#        - Validate X post (PostReviewCrew)
#        - If valid=True, stop the loop; otherwise retry
#      Step 5: Save Results
#
# 2. Agent structure of the three crews:
#    - TopicAnalyzerCrew (topic_analyzer/topic_analyzer_crew.py):
#      - Agent: Topic Analysis Expert
#        Tools: keyword_extractor, topic_complexity_analyzer
#    - ShakespeareGeneratorCrew (content_generator/shakespeare_generator_crew.py):
#      - Agent: Shakespearean Bard
#        Tools: keyword_extractor, character_counter_tool, emoji_detector_tool,
#              post_structure_validator, shakespearean_style_detector, tone_analyzer
#    - PostReviewCrew (post_reviewer/post_review_crew.py):
#      - Agent: X Post Verifier
#        Tools: character_counter_tool, emoji_detector_tool, post_structure_validator,
#              shakespearean_style_detector, tone_analyzer
#
# 3. SPAN hierarchy:
#    - shakespeare_x_post_orchestrator (top-level; orchestrator.py line 347)
#      └─ crew_execution (contains retry logic; orchestrator.py line 362-393)
#         ├─ topic_analysis (topic analysis; orchestrator.py line 114-141)
#         └─ content_generation_loop (content generation + review loop; orchestrator.py line 143-250)
#            Includes multiple iterations:
#            - ShakespeareGeneratorCrew.kickoff (generate X post)
#            - PostReviewCrew.kickoff (validate X post)
#            - If valid=True then stop; otherwise continue
#
# 4. MCP tools (tools/mcp_server.py):
#    - Character count: character_counter_tool (validate 200-280 characters)
#    - Emoji detection: emoji_detector_tool (ensure no emoji)
#    - Structure validation: post_structure_validator (validate 1-3-1 structure, 5 lines)
#    - Style detection: shakespearean_style_detector (detect Shakespearean style elements)
#    - Tone analysis: tone_analyzer (ensure satire and humor)
#    - Keyword extraction: keyword_extractor (extract key topic concepts)
#    - Complexity analysis: topic_complexity_analyzer (estimate topic complexity)

# Project name
project_name: "SocialMediaManager-MCP"

# Trajectory extraction types
extract_types:
  - "SPAN" # Multi-level SPAN hierarchy
  - "Chain" # Each Crew kickoff chain
  - "Agent" # Agents inside each Crew
  - "LLM" # LLM calls
  - "Tool" # MCP tool calls

# Repeatable pattern configuration
# SocialMediaManager-MCP has a self-evaluation loop (ideal trajectory uses only 1 iteration)
repeatable_patterns: []

# ============================================================================
# Reference trajectory (ground truth) - derived from the code design
# ============================================================================
#
# Diagram (ideal execution path: no retries, no errors, first generation passes validation):
#
# [SPAN] shakespeare_x_post_orchestrator
# └─ [SPAN] crew_execution
#    ├─ [SPAN] topic_analysis
#    │  └─ [Chain] Crew***.kickoff
#    │     └─ [AGENT] Topic Analysis Expert
#    │        ├─ [LLM] * (understand the topic)
#    │        ├─ [Tool] keyword_extractor (extract keywords)
#    │        ├─ [LLM] * (analyze extracted keywords)
#    │        ├─ [Tool] topic_complexity_analyzer (analyze complexity)
#    │        └─ [LLM] * (produce topic analysis report)
#    └─ [SPAN] content_generation_loop
#       ├─ [Chain] Crew***.kickoff (ShakespeareGeneratorCrew - iteration 1 generation)
#       │  └─ [AGENT] Shakespearean Bard
#       │     ├─ [LLM] * (plan the generation strategy)
#       │     ├─ [Tool] keyword_extractor (understand topic keywords)
#       │     ├─ [LLM] * (draft the initial X post)
#       │     ├─ [Tool] character_counter_tool (check character count)
#       │     ├─ [LLM] * (adjust character count)
#       │     ├─ [Tool] emoji_detector_tool (check emoji)
#       │     ├─ [LLM] * (confirm no emoji)
#       │     ├─ [Tool] post_structure_validator (validate 1-3-1 structure)
#       │     ├─ [LLM] * (adjust structure)
#       │     ├─ [Tool] shakespearean_style_detector (check style)
#       │     ├─ [LLM] * (strengthen style)
#       │     ├─ [Tool] tone_analyzer (check tone)
#       │     └─ [LLM] * (final polish and output)
#       └─ [Chain] Crew***.kickoff (PostReviewCrew - iteration 1 validation)
#          └─ [AGENT] X Post Verifier
#             ├─ [LLM] * (read and do an initial assessment)
#             ├─ [Tool] character_counter_tool (validate character count)
#             ├─ [LLM] * (record character count result)
#             ├─ [Tool] emoji_detector_tool (validate no emoji)
#             ├─ [LLM] * (record emoji check result)
#             ├─ [Tool] post_structure_validator (validate 1-3-1 structure)
#             ├─ [LLM] * (record structure check result)
#             ├─ [Tool] shakespearean_style_detector (validate style)
#             ├─ [LLM] * (record style check result)
#             ├─ [Tool] tone_analyzer (validate tone)
#             └─ [LLM] * (final decision, output valid=True)
#
# Design basis:
# - orchestrator.py: execute topic_analysis → content_generation_loop sequentially
# - TopicAnalyzerCrew contains 1 Agent, using 2 tools to analyze the topic
# - ShakespeareGeneratorCrew contains 1 Agent, using multiple tools for generation and self-validation
# - PostReviewCrew contains 1 Agent, using multiple tools for comprehensive validation
# - Ideal situation: first generation passes validation (valid=True), no retries needed
# - All Agent roles are defined in each crew's config/agents.yaml
# - All tasks are defined in each crew's config/tasks.yaml, specifying the use of specific tools
# - Tools are obtained from the MCP server through MCPServerAdapter
# - PostReviewCrew contains 1 Agent, using multiple tools for comprehensive validation
# - Ideal situation: first generation passes validation (valid=True), no retries needed
# - All Agent roles are defined in each crew's config/agents.yaml
# - All tasks are defined in each crew's config/tasks.yaml, specifying the use of specific tools
# - Tools are obtained from the MCP server through MCPServerAdapter
#
# Ideal trajectory notes:
# - Top-level SPAN: shakespeare_x_post_orchestrator
# - Second-level SPAN: crew_execution (contains two layers of retry logic)
# - Two sub-SPANs executed sequentially: topic_analysis → content_generation_loop
# - Topic analysis stage: Topic Analyst uses keyword_extractor and topic_complexity_analyzer
# - content_generation_loop stage contains a self-evaluation loop:
#   - Iteration 1 (ideal case):
#     * ShakespeareGeneratorCrew generates the X post and self-validates with multiple tools
#     * PostReviewCrew validates the X post using all required validation tools and returns valid=True
#   - No iterations 2-N needed (because iteration 1 already passes)
# - This trajectory represents the ideal execution path: no retries and no errors
#
# Notes:
# - "LLM: *" means any LLM model (wildcard match)
# - Agent names must exactly match the role field in agents.yaml
# - Tool names must exactly match tool names provided by the MCP server
# - Both Generator and Verifier use multiple tools (as required by tasks.yaml)
# - Tool call order may vary by agent decisions
# - Some LLM calls may be merged/split, but core tool calls must appear
# ============================================================================

reference_trajectory:
  # ===== Top-level SPAN =====
  - "SPAN: shakespeare_x_post_orchestrator"

  # ===== Second-level SPAN (contains two layers of retry logic) =====
  - "SPAN: crew_execution"

  # ===== Stage 1: Topic Analysis (TopicAnalyzerCrew) =====
  - "SPAN: topic_analysis"
  - "Chain: Crew***.kickoff"
  - "Agent: Topic Analysis Expert"
  - "LLM: *" # Initial understanding of the topic and analysis planning
  - "Tool: keyword_extractor" # Required by tasks.yaml (no order constraint)
  - "LLM: *" # Analyze keyword extraction results
  - "Tool: topic_complexity_analyzer" # Required by tasks.yaml (no order constraint)
  - "LLM: *" # Synthesize and produce the topic insight report

  # ===== Stage 2: Content Generation Loop (Self-Evaluation Loop) =====
  - "SPAN: content_generation_loop"

  # === Iteration 1: Content generation (ShakespeareGeneratorCrew) ===
  - "Chain: Crew***.kickoff"
  - "Agent: Shakespearean Bard"
  - "LLM: *" # Understand topic and topic_insights; plan generation strategy
  - "Tool: keyword_extractor" # MUST be first: tasks.yaml STEP 1 requires it
  - "LLM: *" # Draft the initial X post based on extracted keywords
  # The following tools are required by tasks.yaml for validation (no order constraint):
  - "Tool: character_counter_tool" # Validate character count (200-280)
  - "LLM: *" # Adjust based on character count results
  - "Tool: emoji_detector_tool" # Ensure no emoji
  - "LLM: *" # Confirm emoji check passes
  - "Tool: post_structure_validator" # Validate 1-3-1 structure (5 lines)
  - "LLM: *" # Adjust based on structure results
  - "Tool: shakespearean_style_detector" # Check Shakespearean style
  - "LLM: *" # Strengthen style elements
  - "Tool: tone_analyzer" # Validate satire/humor tone
  - "LLM: *" # Final polish and output the X post

  # === Iteration 1: Content verification (PostReviewCrew) ===
  - "Chain: Crew***.kickoff"
  - "Agent: X Post Verifier"
  - "LLM: *" # Read the X post and plan a verification strategy
  # The following 5 tools are REQUIRED by tasks.yaml (no order constraint):
  - "Tool: character_counter_tool" # Validate character count (200-280)
  - "LLM: *" # Analyze character count results
  - "Tool: emoji_detector_tool" # Validate no emoji
  - "LLM: *" # Analyze emoji check results
  - "Tool: post_structure_validator" # Validate 1-3-1 structure (5 lines)
  - "LLM: *" # Analyze structure results
  - "Tool: shakespearean_style_detector" # Validate Shakespearean style
  - "LLM: *" # Analyze style results
  - "Tool: tone_analyzer" # Validate satire/humor tone
  - "LLM: *" # Combine all results; output valid=True, feedback=""

# Target tool list (for the single-tool-use metric)
# This lists all tools filtered for each agent in the configuration
target_tools:
  # Topic Analysis stage
  - "Tool: keyword_extractor"
  - "Tool: topic_complexity_analyzer"
  # Content Generation stage
  - "Tool: character_counter_tool"
  - "Tool: emoji_detector_tool"
  - "Tool: post_structure_validator"
  - "Tool: shakespearean_style_detector"
  - "Tool: tone_analyzer"
  # Post Review stage (shares tools with Generation; not duplicated)

# ============================================================================
# Dynamic tool permutation configuration
# ============================================================================
# Define permutable tool groups for some stages to generate reference trajectories
# with different tool orders. During evaluation, all permutations are tried and
# the best-matching one is selected as the reference.
#
# Notes:
# - Topic Analyst's two tools can be in any order (tasks.yaml does not specify)
# - Shakespearean Bard's keyword_extractor MUST be the first tool (explicitly required by tasks.yaml)
#   but the subsequent 5 validation tools can be in any order
# - X Post Verifier's 5 validation tools can be in any order (tasks.yaml does not specify)
permutable_tool_groups:
  # Topic Analysis stage tools can be in any order
  topic_analysis_tools:
    - "Tool: keyword_extractor"
    - "Tool: topic_complexity_analyzer"

  # Shakespearean Bard validation tools can be in any order
  # Note: the first keyword_extractor is NOT included (it must remain the first tool)
  shakespearean_bard_validation_tools:
    - "Tool: character_counter_tool"
    - "Tool: emoji_detector_tool"
    - "Tool: post_structure_validator"
    - "Tool: shakespearean_style_detector"
    - "Tool: tone_analyzer"

  # X Post Verifier validation tools can be in any order
  x_post_verifier_tools:
    - "Tool: character_counter_tool"
    - "Tool: emoji_detector_tool"
    - "Tool: post_structure_validator"
    - "Tool: shakespearean_style_detector"
    - "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"
# ============================================================================
# Usage
# ============================================================================
#
# 1. Trajectory hierarchy:
#    - Level 1: SPAN (shakespeare_x_post_orchestrator)
#    - Level 2: SPAN (crew_execution)
#    - Level 3: SPAN (topic_analysis, content_generation_loop)
#    - Level 4: Chain (Crew***.kickoff; wildcard-normalized UUID)
#    - Level 5: AGENT (exact match for agent role)
#    - Level 6: LLM (wildcard match for any model)
#    - Level 6: Tool (exact match for tool name)
#
# 2. Wildcard handling:
#    - Crew_<UUID>.kickoff -> Crew***.kickoff (handled by evaluate_trajectory.py)
#    - LLM: * -> matches any model name (e.g., gpt-4o-mini, deepseek-reasoner, gemini-2.5-flash)
#    - Agent names must match fully (including the complete role name)
#
# 3. Exact-match requirements:
#    - SPAN names: "shakespeare_x_post_orchestrator", "crew_execution",
#      "topic_analysis", "content_generation_loop"
#    - Chain name: "Crew***.kickoff" (wildcard match)
#    - Agent names: "Agent: Topic Analysis Expert",
#      "Agent: Shakespearean Bard",
#      "Agent: X Post Verifier"
#      (must exactly match the role field in agents.yaml)
#    - LLM name: "LLM: *" (wildcard match for any model)
#    - Tool names: must exactly match MCP tool names (keyword_extractor, topic_complexity_analyzer,
#      character_counter_tool, emoji_detector_tool, post_structure_validator,
#      shakespearean_style_detector, tone_analyzer)
#
# 4. Metric meanings:
#    - Exact Match: trajectories must be identical (including the number of LLM and tool calls)
#    - In-order Match: extra calls allowed, but core steps must appear in order
#    - Any-order Match: all required steps must appear (order ignored)
#    - Precision: fraction of predicted steps that are correct
#    - Recall: fraction of reference steps covered by the prediction
#    - Single-tool Use: checks usage of core tools
#    - unique_path_ratio: path diversity (unique full trajectories / samples)
#    - path_entropy: path entropy (Shannon entropy over trajectory frequencies, normalized to 0-1)
#
# 5. Run:
#    python3 evaluate_trajectory.py --config reference_trajectory.yaml
#
# 6. Design notes:
#    - This reference trajectory represents the ideal execution path (no retries, no errors)
#    - Two main stages execute sequentially: Topic Analysis → Content Generation Loop
#    - Stage 1 (Topic Analysis): Topic Analyst uses 2 tools to analyze the topic
#    - Stage 2 (Content Generation Loop): contains a self-evaluation loop
#      * Shakespearean Bard generates the X post and self-validates with multiple tools
#      * X Post Verifier performs comprehensive validation using all validation tools
#      * Ideal case: valid=True on the first attempt, no retries needed
#    - In-order Match and Recall are often more suitable for evaluating practical performance
#    - The reference trajectory defines only core required steps and allows extra tool/LLM calls
#
# 7. Differences from real trajectories:
#    - Real trajectories may include business-logic retries (validation failure triggers regeneration)
#    - Real trajectories may include orchestrator-level retries (exceptions trigger workflow retry)
#    - Generator may use a different tool order (but should still use tools required by tasks.yaml)
#    - Verifier may use a different tool order (but must use all 5 validation tools)
#    - Some reasoning models (e.g., DeepSeek-R1) may include many extra LLM calls
#    - Some models (e.g., Gemini) may skip tool calls and directly generate outputs (non-compliant)
#    - These differences are not necessarily errors, but skipping required tools or failing validation is abnormal
#
# 8. MCP version characteristics:
#    - All tools are provided by an MCP server using the SSE protocol
#    - Tools are obtained from the server via MCPServerAdapter
#    - Includes multi-level SPAN structure (orchestrator + crew_execution + 2 stage SPANs)
#    - Three specialized crews collaborate to generate Shakespeare-style X posts
#    - Each crew has a clear responsibility and an explicit set of available tools
#    - TopicAnalyzerCrew: 1 agent, analyzes the topic and extracts insights
#    - ShakespeareGeneratorCrew: 1 agent, generates and self-validates the X post
#    - PostReviewCrew: 1 agent, comprehensively validates the X post
#    - Tool categories: analysis tools (keyword_extractor, topic_complexity_analyzer) and
#      validation tools (character_counter_tool, emoji_detector_tool, post_structure_validator,
#      shakespearean_style_detector, tone_analyzer)
#
# 9. Business-logic notes:
#    - The self-evaluation loop is critical: generation must be followed by validation
#    - If validation fails (valid=False), regenerate with feedback (up to 6 attempts)
#    - If all attempts fail, the workflow ends and the failed X post is saved
#    - The ideal trajectory assumes the first generation passes validation (best case)
#    - Generator should self-validate using all tools required by tools.yaml
#    - Verifier must use all 5 validation tools for thorough validation
#    - Some real trajectories may include multiple generation-validation cycles (normal business retries)
#
# 10. Tool usage requirements (based on tasks.yaml):
#     - Topic Analyst (analyze_topic task):
#       * Explicit requirement: "Start by using the available analytical tools"
#       * Must use: keyword_extractor, topic_complexity_analyzer
#       * Order: none (tasks.yaml does not specify)
#     - Shakespearean Bard (write_x_post task):
#       * Explicit requirement: "STEP 1 - REQUIRED: First, use the keyword_extractor tool"
#       * Explicit requirement: "IMPORTANT: Before finalizing, use the available tools to verify quality"
#       * Must use: keyword_extractor (must be the first tool)
#       * Should use: character_counter_tool, emoji_detector_tool, post_structure_validator,
#                    shakespearean_style_detector, tone_analyzer (quality validation)
#       * Order: keyword_extractor must be first; remaining validation tools have no order constraint
#     - X Post Verifier (verify_x_post task):
#       * Explicit requirement: "CRITICAL: You MUST use the following tools to perform thorough validation"
#       * Must use: character_counter_tool, emoji_detector_tool, post_structure_validator,
#                  shakespearean_style_detector, tone_analyzer (all 5)
#       * Requirement: "Base your validation decision on these tool results, not assumptions"
#       * Order: none (tasks.yaml does not specify)
#
# 11. Tool ordering notes:
#     - **Ordered scenario**:
#       * Shakespearean Bard's keyword_extractor must be the first tool
#         (tasks.yaml line 7-8: "STEP 1 - REQUIRED: First, use the keyword_extractor tool")
#     - **Unordered scenarios**:
#       * Topic Analyst's two tools (keyword_extractor, topic_complexity_analyzer) can be in any order
#       * Shakespearean Bard's 5 validation tools can be in any order (as long as after keyword_extractor)
#       * X Post Verifier's 5 validation tools can be in any order
#     - **Order in the reference trajectory**:
#       * The listed order reflects common observed patterns
#       * Evaluation should allow flexible tool ordering (except the Bard's keyword_extractor-first constraint)
#       * The evaluator should enforce the "keyword_extractor must be first" constraint for the Bard
#
# 12. Dynamic tool permutation optimization:
#     - **Idea**: tool calls within each AGENT can have different orders
#     - **Mechanism**:
#       * permutable_tool_groups defines permutable tool groups
#       * The evaluator generates all tool-order permutations (Cartesian product)
#       * For each sample, select the permutation with the highest combined score across
#         exact_match, in_order_match, and any_order_match
#     - **Number of permutations**:
#       * topic_analysis_tools: 2! = 2
#       * shakespearean_bard_validation_tools: 5! = 120
#       * x_post_verifier_tools: 5! = 120
#       * Total: 2 × 120 × 120 = 28,800 candidate reference trajectories
#     - **Evaluation strategy**:
#       * Dynamically select the best reference trajectory per test sample
#       * Combined score = exact_match×3 + in_order_match×2 + any_order_match×1
#       * This is fairer and adapts to different models' tool-calling strategies
#     - **Notes**:
#       * The Bard's first keyword_extractor is not permuted (must remain first)
#       * Permutations are within an AGENT boundary only (not across AGENT boundaries)
#       * Tool permutations do not change the positions or counts of LLM calls