feat: open Athena tool architecture

This commit is contained in:
Mikei386
2026-08-24 12:46:33 +02:00
parent 5528f3ab22
commit 5db73d0a92
26 changed files with 430 additions and 212 deletions
@@ -31,10 +31,10 @@ replacement = """ tool_call_iterations = 0
# Per-tool and exact-repeat limits below prevent one low-level MCP
# operation from consuming the whole turn.
tool_call_executions = 0
max_tool_call_executions = 12
max_executions_per_tool = 4
max_tool_call_executions = 40
max_executions_per_tool = 12
tool_execution_counts = {}
seen_tool_signatures = set()
tool_signature_counts = {}
max_tool_call_iterations = getattr(
"""
if source.count(needle) != 1:
@@ -65,12 +65,12 @@ replacement = """ response_tool_calls = tool_calls.pop(0)
skipped_tool_calls.append(candidate)
skip_reasons.append(f'per-tool budget reached for {tool_name}')
continue
if signature in seen_tool_signatures:
if tool_signature_counts.get(signature, 0) >= 2:
skipped_tool_calls.append(candidate)
skip_reasons.append(f'exact duplicate suppressed for {tool_name}')
skip_reasons.append(f'repeated identical call suppressed for {tool_name}')
continue
accepted_tool_calls.append(candidate)
seen_tool_signatures.add(signature)
tool_signature_counts[signature] = tool_signature_counts.get(signature, 0) + 1
tool_execution_counts[tool_name] = tool_execution_counts.get(tool_name, 0) + 1
response_tool_calls = accepted_tool_calls
if skipped_tool_calls:
@@ -115,7 +115,7 @@ replacement = """ # The upstream loop otherwise stops wit
and tool_call_iterations >= max_tool_call_iterations
)
or tool_call_executions >= max_tool_call_executions
or bool(skipped_tool_calls)
or bool(skipped_tool_calls and not response_tool_calls)
)
if force_final_response:
new_form_data.pop('tools', None)