AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.
fix(backend): disambiguate duplicate tool names in OrchestratorBlock (#12555)
## Why The OrchestratorBlock fails with `Tool names must be unique` when multiple nodes use the same block type (e.g., two "Web Search" blocks connected as tools). The Anthropic API rejects the request because duplicate tool names are sent. ## What - Detect duplicate tool names after building tool signatures - Append `_1`, `_2`, etc. suffixes to disambiguate - Enrich descriptions of duplicate tools with their hardcoded default values so the LLM can distinguish between them - Clean up internal `_hardcoded_defaults` metadata before sending to API - Exclude sensitive/credential fields from default value descriptions ## How - After `_create_tool_node_signatures` builds all tool functions, count name occurrences - For duplicates: rename with suffix and append `[Pre-configured: key=value]` to description using the node's `input_default` (excluding linked fields that the LLM provides) - Added defensive `isinstance(defaults, dict)` check for compatibility with test mocks - Suffix collision avoidance: skips candidates that collide with existing tool names - Long tool names truncated to fit within 64-character API limit - 47 unit tests covering: basic dedup, description enrichment, unique names unchanged, no metadata leaks, single tool, triple duplicates, linked field exclusion, mixed unique/duplicate scenarios, sensitive field exclusion, long name truncation, suffix collision, malformed tools, missing description, empty list, 10-tool all-same-name, multiple distinct groups, large default truncation, suffix collision cascade, parameter preservation, boundary name lengths, nested dict/list defaults, null defaults, customized name priority, required fields ## Test plan - [x] All 47 tests in `test_orchestrator_tool_dedup.py` pass - [x] All 11 existing orchestrator unit tests pass (dict, dynamic fields, responses API) - [x] Pre-commit hooks pass (ruff, black, isort, pyright) - [ ] Manual test: connect two same-type blocks to an orchestrator and verify the LLM call succeeds --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Z
Zamil Majdy committed
914efc53e5ce3518a5dbd8d87f0a24e48919532f
Parent: 17e78ca
Committed by GitHub <noreply@github.com>
on 3/31/2026, 11:54:10 AM