awslabs / awslabs/agentcore-samples

[Proposal] Add Multi-Gateway Tool Deduplication Sample in 01-features

Open
#1,619 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
3.4k
Forks
1.3k
Avg merge
1d 22h
Merged PRs (30d)
30

Description

### Problem
Whenever a developer wants to connect a single AgentCore Runtime to **more than one** AgentCore Gateway, they will encounter a tool identifier collision.

By design, AgentCore Gateways automatically inject built-in infrastructure tools (such as the `x_amz_bedrock_agentcore_search` semantic search tool). If a developer merges tools from multiple gateways and passes them directly to the `Agent` constructor, the framework crashes with a `ValueError: Tool name already exists`.

While a prominent use case for this is building advanced multi-agent architectures (e.g., separating a "DomainSpecific" gateway from a "SharedUtility" gateway to achieve high cohesion), this issue fundamentally affects *any* implementation attempting to consume multiple gateways simultaneously.

### Proposed Solution
I have already implemented a solution for this, and I will be submitting a Pull Request shortly to contribute it to the repository.

My PR will add a new sample under `01-features/07-centralize-and-govern-your-ai-infrastructure/01-gateway/04-advanced-concepts/multi-gateway-tool-deduplication/`.
The sample contains:
- A comprehensive `README.md` explaining the problem, the architectural context, and the exact error.
- A standalone `deduplicate.py` script demonstrating how to cleanly deduplicate tools by name before Agent initialization, preserving the original object and deeply logging the discarded duplicates.

Contributor guide

Open the contributing guide

Research direction

Start with the proposed path under 01-features/07-centralize-and-govern-your-ai-infrastructure/01-gateway/04-advanced-concepts/multi-gateway-tool-deduplication/. Review the requested README.md and deduplicate.py sample, then confirm that the documentation explains the tool-name collision and the script demonstrates deduplication before Agent initialization.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
documentation
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.