Multi-Agent Bidirectional Collaboration: A2A Protocol Integration and Practice

    This article explores how to enable bidirectional collaboration between AI agents using the Agent-to-Agent (A2A) protocol. It examines why multi-agent collaboration is becoming essential for enterprise AI applications, the challenges existing application orchestration platforms face with A2A integration, and a practical solution combining a unified agent registry with bidirectional A2A plugin mechanisms, including architecture design and example code for dynamic agent discovery and invocation.

    Multi-Agent Bidirectional Collaboration: A2A Protocol Integration and Practice

    As large language models and AI Agent architectures evolve rapidly, single agents are increasingly showing capability limitations when handling complex business scenarios. Constrained by context window size, depth of domain-specific knowledge, and tool-calling boundaries, a single agent often struggles to complete cross-domain, multi-step complex tasks independently. As a result, multi-agent collaboration is becoming the mainstream trend for enterprise-grade AI applications. In this model, multiple agents with different specialties—such as data analysis, code generation, and natural language reasoning—work together through task decomposition and handoff to achieve shared business goals.

    To standardize communication between agents, the industry introduced the Agent-to-Agent (A2A) protocol standard in early 2025. The protocol provides a critical foundation for standardized agent-to-agent communication, clearly defining discovery mechanisms, capability description specifications, and task interaction workflows. Under the A2A standard, agents built on different underlying frameworks and from different sources can collaborate seamlessly in a standardized way, breaking the “silo” effect where AI application frameworks previously operated independently.

    2. Challenges Facing Existing Application Orchestration Platforms

    Although the A2A protocol paints an attractive picture of multi-agent collaboration, many mainstream AI application orchestration platforms do not natively support it. This leaves developers facing several serious technical challenges when building multi-agent applications:

    1. Protocol Incompatibility and Information Isolation
      Existing platforms do not natively support the A2A protocol and cannot parse the standard AgentCard (the agent capability profile) or handle the standard message formats defined by A2A. As a result, agents built within the platform are completely isolated from the broader external A2A agent ecosystem, and cannot directly invoke third-party agents that comply with the A2A standard.

    2. Difficult Agent Discovery and Governance
      In architectures where microservices and AI coexist, multiple A2A agents are often deployed across different environments or clusters. Without a standardized discovery mechanism, platform applications struggle to automatically detect and manage these agents. Each time a new external agent is onboarded, developers need to perform extensive hardcoding and custom development, driving up operational costs.

    3. Limited Dynamic Selection and Collaborative Orchestration
      In traditional orchestration modes, the platform can only invoke a single agent that is hardcoded in code or configuration. When business scenarios change, the system cannot dynamically select the most suitable agent from the agent pool based on the actual requirements of the current task. Meanwhile, in workflows requiring multiple agents to be chained together, developers must write extensive conditional logic and routing rules, making workflows bloated and hard to maintain.

    4. Closed Ecosystem and Inability to Expose Capabilities
      Beyond the inability to “call outward,” agents built on existing platforms can typically only be invoked within the platform itself and cannot expose their services externally via a standard protocol. This means valuable agent capabilities accumulated inside an enterprise cannot be discovered and reused by other agents in the A2A ecosystem, creating new data and capability silos.

    3. The Solution: Unified Registry + Bidirectional A2A Integration

    To overcome these bottlenecks, the industry has proposed a solution that combines a “unified service discovery platform” with a “bidirectional A2A plugin mechanism.” By introducing a registry for centralized governance, supplemented with bidirectional communication plugins, this approach fills the gap in A2A protocol support within orchestration platforms.

    1. Introduce a Unified AI Agent Registry

    Drawing on mature microservices governance practices, the existing unified service and configuration management platform can be upgraded so that—beyond supporting traditional model context registration—it also extends its management capabilities to A2A agents. Serving as the unified registry and discovery center for AI agents, the platform provides:

    • Dynamic registration: A2A agents built with any framework can automatically register their AgentCard, network address, and other metadata with the registry at startup.
    • Real-time discovery: Platform applications can obtain the current list of available agents and their capability descriptions in real time via subscription or polling.
    • Centralized governance: Common governance measures such as health checks and traffic control ensure the stability of multi-agent collaboration.

    2. A2A Discovery Plugin: Opening the Outbound Invocation Path

    By integrating an A2A Discovery plugin into the orchestration platform, applications can easily invoke external agents. The plugin embeds a complete A2A protocol stack, with the following core logic:

    • Protocol parsing: Automatically pulls and parses the target agent’s AgentCard from the registry, understanding its supported input/output formats and capability boundaries.
    • Message adaptation: Converts the platform’s internal task requests into A2A-compliant JSON-RPC message bodies for delivery to external agents, and handles receiving and parsing the returned results.
    • Dynamic routing: At runtime, automatically matches and invokes agents with the required capabilities based on the current node’s context, greatly simplifying routing design in workflows.

    3. A2A Endpoint Exposure: Opening Capabilities to the Outside

    To address the problem of “inability to expose capabilities outward,” the solution also provides reverse integration. The orchestration platform can automatically package internally built workflows or agents as A2A-compliant agent services and register their metadata with the unified registry. External systems or agents from other ecosystems can then discover and invoke the application through the standard A2A protocol, achieving true bidirectional interoperability.

    4. Technical Practice and Architecture Example

    In real-world deployments, combining a container platform with a microservices engine—such as those offered by Baidu AI Cloud—can provide highly available infrastructure for the multi-agent registry. The following simplified pseudocode demonstrates the dynamic invocation logic, showing how an application can dynamically select and invoke an A2A agent through the registry:

    1. # 1. Query the unified registry for agents with a specific skill
    2. def discover_agent_by_skill(skill_name):
    3. agents = registry_client.query_agents(skill=skill_name)
    4. if not agents:
    5. raise Exception("No available agent found for skill: " + skill_name)
    6. # Simple load balancing or priority-based selection strategy
    7. return agents[0]
    8. # 2. Build an A2A-standard task request
    9. def build_a2a_task(user_query, target_agent):
    10. task_payload = {
    11. "jsonrpc": "2.0",
    12. "method": "tasks/send",
    13. "params": {
    14. "id": generate_uuid(),
    15. "message": {
    16. "role": "user",
    17. "parts": [{"type": "text", "text": user_query}]
    18. }
    19. },
    20. "metadata": {
    21. "agent_card_url": target_agent.card_url
    22. }
    23. }
    24. return task_payload
    25. # 3. Execute the invocation and process the result
    26. def execute_multi_agent_task(user_query, required_skill):
    27. # Dynamic discovery
    28. target_agent = discover_agent_by_skill(required_skill)
    29. # Build a standard request
    30. task_payload = build_a2a_task(user_query, target_agent)
    31. # Send the request via the A2A plugin
    32. response = a2a_client.send_task(task_payload)
    33. return parse_response(response)

    With this architecture, developers no longer need to worry about low-level protocol parsing or network communication details. They simply declare the required skill in the business flow, and the system automatically handles agent discovery, selection, and collaboration.

    5. Conclusion

    Multi-agent collaboration is an essential step for AI applications moving into complex scenarios. By introducing a unified agent registry and a bidirectional A2A integration solution, existing application orchestration platforms can effectively break through protocol barriers and resolve pain points such as difficult agent discovery, restricted dynamic routing, and closed ecosystems. This decoupled architectural design not only significantly reduces the development and maintenance costs of multi-agent applications but also provides a solid technical foundation for enterprises to build highly scalable and flexible AI application ecosystems. Going forward, as standard protocols gain wider adoption, cross-platform and cross-framework agent collaboration will become increasingly smooth and efficient.