Strands A2A Discovery and Invocation Pattern #270
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes Issue #232
Problem
The initial A2A (Agent-to-Agent) discovery pattern attempted to dynamically load discovered agents as native Strands tools. However, we encountered a fundamental limitation: Strands Agent tool lists are immutable after initialization.
When an Agent is created, the tools list becomes frozen as part of the LangGraph execution infrastructure. This means we cannot dynamically add newly discovered agents as tools at runtime, which breaks the original design where each discovered agent would become a callable tool.
Solution
We refactored the agent discovery pattern to use a local cache with predefined proxy tools instead of dynamic tool creation:
New Architecture
Local Agent Cache (
RemoteAgentCache)RemoteAgentClientinstances with lazy initializationThree Predefined Proxy Tools (CRUD-style interface)
discover_remote_agents(query, max_results)- Discover agents via semantic search and cache them locallyview_cached_remote_agents()- Read all cached agents and their metadatainvoke_remote_agent(agent_id, message)- Invoke a specific cached agent by IDBenefits
Testing
The testing approach validates the complete agent discovery workflow in a local Docker environment:
python3 agent_discovery_test.py --endpoint localEnvironment Setup
Test Scenarios
discover_remote_agents()to search the registry semanticallyview_cached_remote_agents()to inspect discovered agentsinvoke_remote_agent()to call the discovered agent and complete the taskKnown Issues
Docker Network Communication
404path resolution errors through nginx reverse proxy.Travel Agent -> RegistryCurrent Status: