Skip to content

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

Description

@riccardo1512

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions