Multi-Agent Collaboration in Practice: Integrating the A2A Protocol with a Registry

    This article explains how to move from a single AI agent to multi-agent collaboration by combining agent-to-agent (A2A) protocol integration with a unified registry. It covers the limitations of single agents, a three-layer architecture with bidirectional protocol adapters, a registry and discovery layer, and orchestration and governance, along with key design points such as semantic capability selection, long-running and streaming interactions, declarative routing, and observability. It also provides practical rollout steps and pitfalls to avoid.

    1. Background: The Turning Point from Single Agents to Multi-Agent Systems

    As LLM applications evolve from conversational Q&A to task execution, the limitations of a single agent become increasingly clear in complex business scenarios: a limited context window, insufficient tool coverage, difficulty covering specialized domain knowledge, and instability in long-chain tasks. The common industry approach is to break a complex goal into multiple agents with different specialties and have them collaborate on subtasks such as planning, retrieval, coding, review, and execution. This is multi-agent collaboration.

    For collaboration to work in practice, the prerequisite is standardized communication. The industry has gradually converged on a layered approach centered on an agent-to-agent communication protocol: the upper layer handles capability description and discovery, the middle layer handles task dispatch and state synchronization, and the lower layer handles the actual transport. Capability descriptions typically take the form of a standardized “agent card” that declares the name, purpose, input/output schema, authentication method, and endpoint address. Task interactions use a “message-task-artifact” abstraction and support streaming feedback and polling for long-running tasks.

    In reality, however, many application platforms do not natively support these protocols, leaving developers with several concrete challenges:

    • Protocol incompatibility: The platform cannot parse standardized capability description files or handle compliant message structures, leaving it naturally isolated from the external agent ecosystem.
    • Difficult discovery: Agents are deployed across different networks and environments with no unified registration or query entry point, so every integration reinvents the wheel.
    • Rigid selection: Invocation targets are hard-coded, making it impossible to choose dynamically based on task semantics, load, and cost.
    • Complex orchestration: Multi-agent collaboration requires stacking large numbers of conditional branches and routing logic in the workflow, which raises maintenance costs and makes regression testing difficult.
    • Missing governance: Without a central registry, permissions, versioning, canary releases, and auditing are out of reach.
    • No external connectivity: Agents built inside the platform can only be used internally and cannot be discovered or invoked by external systems through a standard protocol.

    2. Target Architecture: Bidirectional Integration Plus a Unified Registry

    The solution can be abstracted into a three-layer architecture of “adaptation on both sides plus registration in the middle”:

    1. Protocol adaptation layer (bidirectional): One side is the consumer adapter, which parses external capability descriptions, builds compliant requests, and handles streaming and long-running tasks. The other side is the provider adapter, which wraps local agents as standard service endpoints and exposes their capability descriptions externally.
    2. Registry and discovery layer: A unified agent registry stores capability metadata, health status, versions, and tags, and supports retrieval by semantics, tags, region, cost, and other dimensions.
    3. Orchestration and governance layer: The workflow engine introduces dynamic selection nodes and routing nodes, together with authentication, rate limiting, auditing, and observability.

    An illustrative capability description (pseudocode, structure only):

    1. {
    2. "name": "research-agent",
    3. "description": "An agent for retrieving and summarizing technical material",
    4. "skills": [{"id": "search", "input": "query", "output": "summary"}],
    5. "endpoint": "https://internal.example/agents/research",
    6. "auth": {"type": "bearer"}
    7. }

    When the consumer side invokes an external agent, it is recommended to wrap a unified client interface that hides protocol details:

    1. # Pseudocode: invoking an external agent
    2. card = registry.resolve(query="technical material retrieval", top_k=3) # Select from the registry
    3. result = a2a_client.invoke(
    4. endpoint=card.endpoint,
    5. message={"role": "user", "parts": [{"text": task}]},
    6. stream=True
    7. )
    8. for chunk in result:
    9. emit_progress(chunk) # Forward streaming progress to the workflow

    The provider side exposes a local agent as a standard endpoint:

    1. # Pseudocode: exposing a local agent externally
    2. @app.post("/agents/summary/card")
    3. def agent_card():
    4. return {"name": "summary-agent", "skills": ["summarize"], "auth": {"type": "bearer"}}
    5. @app.post("/agents/summary/invoke")
    6. def invoke(msg: Message):
    7. return run_local_pipeline(msg) # Return a message, task, or streaming response

    3. Key Design Points

    3.1 Capability Descriptions and Semantic Selection

    A registry should store more than addresses; it should store searchable semantic metadata: domain tags, supported task types, input/output schemas, average latency ranges, cost tiers, and compliance regions. Selection should first apply rule-based filtering (authentication, region, compliance), then combine semantic similarity with load scoring for ranking. This avoids hotspot concentration caused by relying on similarity alone.

    3.2 Long-Running Tasks and Streaming Feedback

    Multi-agent tasks often take a long time, so interactions must be divided into three types: immediate messages, streamable messages, and long-running tasks. Immediate calls return directly; streaming calls return incremental chunks; long-running tasks return a task identifier that the caller polls or subscribes to for status changes. Timeouts, retries, and idempotency keys should be included to prevent duplicate execution.

    3.3 From Hard-Coded to Declarative Orchestration

    Extract “which agent to call” from workflow branches and replace it with a declarative policy: goal, constraints, and preferences. The workflow only describes “what is needed,” and the selector decides “who does it.” Adding a new agent then requires no workflow changes, only registration in the registry.

    1. # Pseudocode: declarative routing policy
    2. goal: "Generate a first draft of a technical solution"
    3. constraints: {auth: true, region: "cn", max_cost: "medium"}
    4. preferences: {latency: "low", quality: "high"}
    5. fallback: ["template-agent", "human-review"]

    3.4 Governance and Observability

    Bidirectional integration significantly expands the governance surface. Four things are recommended: unified authentication and key management, per-caller rate limiting and quotas, full-chain tracing (recording selection rationale, latency, and failure reasons), and versioning with canary releases (capability descriptions carry version numbers, supporting percentage-based traffic splitting and fast rollback).

    4. Rollout Steps and Pitfalls to Avoid

    1. Build the registry before collaboration: Without unified metadata and status, collaboration inevitably degrades into point-to-point hard connections.
    2. Roll out bidirectional decoupling: First enable “calling external agents,” then open “being called by external systems” to reduce integration complexity.
    3. Prioritize idempotency and compensation: Assume cross-agent calls will fail, and design idempotency keys, retry limits, and manual fallback.
    4. Shift security left: Avoid exposing internal network details in capability descriptions, route endpoints through a gateway for authentication, and minimize the transfer of sensitive data.
    5. Close the evaluation loop: Build a task-level evaluation set for each agent, run offline replay of the selection policy before launch, and continuously monitor quality and latency after launch.

    5. Conclusion

    The bottleneck in multi-agent collaboration is shifting from model capability to protocol interoperability and governance. An architecture centered on standardized capability descriptions, unified registry and discovery, and bidirectional protocol adaptation allows an application platform to be both a consumer and a provider of agents. With the general capabilities of cloud platforms such as Baidu AI Cloud (for example, a container platform hosting adapter services, a message queue handling long-running task events, and logging, monitoring, and alerting ensuring observability), developers can focus on business orchestration and quality optimization to build a sustainable, evolving multi-agent collaboration system.