-
Notifications
You must be signed in to change notification settings - Fork 46k
Fix duplicate tool names in Smart Decision Maker block for Anthropic API compatibility #11056
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Conversation
✅ Deploy Preview for auto-gpt-docs canceled.
|
Here's the code health analysis summary for commits Analysis Summary
|
- Use customized_name from node metadata when available - Fallback to block/graph name with node ID suffix for uniqueness - Update frontend getToolFuncName to match backend logic - Add test to verify unique tool names for duplicate blocks - Fixes Anthropic API error when multiple blocks of same type are used Co-authored-by: ntindle <[email protected]>
Thanks for working on this fix for the duplicate tool names issue with Smart Decision Maker! The implementation looks solid, adding appropriate unique identifiers to tool names when needed. Before this can be merged:
The implementation approach looks good - using customized_name when available and falling back to adding node ID suffixes is a clean solution. I particularly appreciate the comprehensive test case you added to verify uniqueness when duplicate blocks are used. |
Thanks for working on this issue! Here's some feedback to get this PR ready for merging:
Once you've addressed these items, particularly updating the PR title to follow conventional commit format and removing the WIP tag when ready, this should be good to go! |
- Set mock_node.metadata = {} to avoid Mock object being returned - Set mock_node.id to provide fallback naming for tests - All smart decision maker tests now pass Co-authored-by: ntindle <[email protected]>
Thank you for your PR addressing the duplicate tool names issue with the Smart Decision Maker block. The implementation looks good, using the customized_name from metadata when available and falling back to node ID suffixes for uniqueness. Before this can be merged:
Your implementation looks solid and the tests are thorough. The approach of using customized names when available and falling back to node ID suffixes is a good solution that addresses the issue while maintaining readability. |
Thanks for this PR addressing the duplicate tool names issue with the Smart Decision Maker block. The implementation looks solid and I appreciate the comprehensive test coverage. Before this can be merged:
The implementation approach looks sound:
Once the title is updated and you confirm this is ready for review (by removing [WIP]), this PR should be good to go! |
@coderabbitai review |
@claude make sure this is high quality |
Claude finished @ntindle's task —— View job Working on code review... Todo List
Code Review AnalysisAfter reviewing the PR thoroughly, here's my assessment: ✅ Strengths
📝 Suggestions for Improvement1. Minor Code OrganizationIn @staticmethod
def _get_node_suffix(node_id: str) -> str:
"""Get the first segment of UUID for unique suffix."""
return node_id.split("-")[0] 2. Documentation EnhancementConsider adding a docstring comment explaining the naming strategy at the class level or in the 3. Test AssertionsIn # Verify it's a valid hex string
try:
int(parts[1], 16)
except ValueError:
pytest.fail(f"Node ID segment should be hex, got {parts[1]}") 4. Edge Case ConsiderationThe current implementation uses the first 8 characters of the UUID. While collision is extremely unlikely, consider documenting this limitation or adding a collision check if critical. ✅ Overall AssessmentThis is a high-quality fix that:
The implementation is production-ready. The suggestions above are minor improvements that would enhance code maintainability but are not blockers. Great work on this fix! 👍 |
This pull request has conflicts with the base branch, please resolve those so we can evaluate the pull request. |
✅ Deploy Preview for auto-gpt-docs-dev canceled.
|
Conflicts have been resolved! 🎉 A maintainer will review the pull request shortly. |
Problem
The Smart Decision Maker block was generating duplicate tool names when multiple blocks of the same type (e.g., two
StoreValueBlock
s) or agents with the same graph were connected to it. This caused the Anthropic API to reject requests with the error:Root Cause: The tool naming logic used only the block name (
block.name
) or graph name (sink_graph_meta.name
), which resulted in identical tool names for multiple instances of the same block type.Solution
Implemented a three-tier naming strategy that ensures unique tool names while respecting user customization:
For Block Nodes:
customized_name
from node metadata (when user renames the block in the UI){block_name}_{node_id_prefix}
wherenode_id_prefix
is the first 8 characters of the node's UUIDFor Agent Nodes:
customized_name
from node metadataagent_name
from the node's input configuration{graph_name}_{node_id_prefix}
Example:
Before (causes error):
After (unique names):
With user customization:
Changes
Backend (
smart_decision_maker.py
)_create_block_function_signature()
to use metadata-based naming with UUID fallback_create_agent_function_signature()
to prioritize customized names and agent_nameFrontend (
useAgentGraph.tsx
)getToolFuncName()
to match backend naming logicTests
test_smart_decision_maker_function_signature
to expect node ID suffixestest_smart_decision_maker_unique_tool_names_for_duplicate_blocks
to verify uniquenesstest_smart_decision_maker_dict.py
Benefits
✅ Resolves Anthropic API error: Tool names are now guaranteed to be unique
✅ Backward compatible: Works with OpenAI and other LLM providers
✅ User-friendly: Respects user-customized block names from metadata
✅ Deterministic: Node ID suffixes ensure consistent naming across runs
✅ Minimal changes: Only affects naming logic, no changes to execution flow
Testing
All 8 smart decision maker tests pass, including the new test specifically for duplicate block handling.
Fixes #10761
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.