Bidirectional Multi-Agent Collaboration: Protocol Adaptation and Registry Governance

    This article explains how to build reliable bidirectional multi-agent collaboration by addressing gaps at the semantic, interaction, and governance layers. It covers capability descriptions, registry design, outbound and inbound protocol adapters, constrained capability selection, orchestration patterns, idempotency, timeout and cancellation handling, retries, security controls, observability, acceptance testing, and a phased rollout path.

    1. From Single Agents to Collaborative Networks

    A single agent can handle question answering, document preparation, or simple tool calls, but complex business processes often span multiple specialized domains. For example, an enterprise procurement assessment may require demand analysis, supplier risk evaluation, budget verification, and approval rule checks. Concentrating all responsibilities in one agent can lead to context bloat, excessive permissions, unclear responsibility boundaries, and results that are difficult to verify.

    The value of multi-agent collaboration is to decompose a complex task into subtasks with clear inputs, outputs, and constraints, then assign them to agents with different specialized capabilities. However, decomposition alone does not automatically produce reliability. If agents use different communication methods, state definitions, and identity systems, the system simply changes from “one complex application” into “multiple applications that are difficult to integrate.”

    Therefore, building a multi-agent system requires addressing three layers at the same time:

    • Semantic layer: Define what an agent can do, what inputs it accepts, and what results it returns.
    • Interaction layer: Standardize task submission, status queries, result return, and exception handling.
    • Governance layer: Unify identity, authorization, service discovery, runtime observability, and lifecycle management.

    Bidirectional collaboration adds a further requirement: an application must be able not only to call other agents but also to expose its own capabilities as standardized services. These two directions share part of the infrastructure, but their adaptation responsibilities and security boundaries are not the same.

    2. Why Collaboration Is Hard: The Missing Common Contract

    2.1 Being Able to Reach an Interface Does Not Mean Understanding Its Capability

    Knowing an agent’s network address only answers “where it is.” It does not answer “whether it is appropriate to call.” The caller also needs to understand its capability scope, input restrictions, output forms, authentication requirements, and supported interaction modes.

    An agent capability card can provide a machine-readable capability description, but it should not be treated as a simple promotional summary. A description used for automatic discovery and selection should be as structured as possible and should clearly state its version and scope of applicability.

    A capability description is also not proof of capability. Even if an agent claims it can perform risk assessment, the caller still needs to combine test results, historical success rates, and business rules when deciding whether to allow its use.

    2.2 Agent Tasks Are Not Necessarily One Synchronous Request

    Some tasks can return results immediately. Others must wait for external data, execute multiple steps, or request additional human input. If the only supported mode is “send a request and wait for the full response,” the system is likely to encounter connection timeouts, duplicate execution, and lost state.

    Task interaction therefore usually needs to distinguish among the following:

    • Whether the request has been accepted;
    • Whether the task is running;
    • Whether additional information is required;
    • Whether the task has completed or failed;
    • Whether the final artifact can be retrieved independently.

    These states should not be inferred only from natural-language text. They should have an explicit state model and transition rules.

    2.3 Dynamic Discovery Does Not Mean Arbitrary Invocation

    Allowing agents to dynamically select collaboration partners based on task needs can reduce hardcoding, but it also introduces new risks. If candidates are unauthorized, their descriptions are untrustworthy, or cost constraints are missing, automatic routing may lead to data leakage, privilege escalation, and unbounded delegation.

    Reliable dynamic selection should first use deterministic rules to limit the candidate scope, and only then allow a model to participate in adaptation decisions. The model should not directly decide all connections and permissions.

    3. Reference Architecture: Registry and Bidirectional Protocol Adaptation

    A general bidirectional collaboration architecture can be divided into an application runtime layer, a protocol adaptation layer, and a registry governance layer.

    The structure can be illustrated as follows:

    Local agent application → outbound invocation adapter → external agent service

    External caller → inbound service adapter → local agent application

    The registry and governance center provides capability search, metadata management, and access policy support for both sides.

    The registry is better suited to act as a control plane, responsible for “who provides what capability, and which callers can discover or use it.” Task execution belongs to the data plane and is usually completed directly by the caller and the service provider, or forwarded through a controlled gateway. The registry does not need to carry all business messages, which avoids creating an unnecessary traffic bottleneck.

    3.1 Registry: Managing Discoverable Capabilities

    A registry record can include information such as agent identifier, capability category, description version, access location, maintainer, and runtime environment. The specific fields should be determined by the adopted protocol and business contract. Internal custom fields should not be mistaken for standard protocol requirements.

    Registry management needs to address the following mechanisms:

    Lifecycle management. New capability publication, old capability retirement, and version switching should follow clear processes. Records that are unreachable or disabled should not remain in candidate results for long periods.

    Visibility scope control. The fact that a capability is allowed to register does not mean every caller can see it. Different tenants, business units, and environments may require different discovery scopes.

    Metadata validation. The system should check description completeness, whether the access location is valid, whether the capability version is identifiable, and whether registry records point to uncontrolled internal resources.

    Runtime status separation. The existence of a registry record only indicates that a service was once registered. It does not prove that the service is currently healthy. Static capability information and real-time health status need to be managed separately.

    3.2 Outbound Adapter: Letting Local Applications Call External Agents

    The outbound adapter mainly handles protocol conversion and invocation control:

    1. Receive task intent and input from the local workflow.
    2. Search for candidate capabilities within the permitted registry scope.
    3. Filter candidates based on input format, permissions, environment, and business constraints.
    4. Convert the request into a task request acceptable to the remote party.
    5. Handle immediate results, asynchronous states, and interaction exceptions.
    6. Normalize outputs into data that the local application can consume.

    The adapter should not silently change the meaning of a task. For example, when local input lacks required information, the correct approach is usually to return an explicit error or trigger a clarification process, rather than guessing critical business fields.

    3.3 Inbound Adapter: Exposing Local Applications as Controlled Services

    The inbound adapter needs to map external standardized tasks to the internal application’s execution entry point and handle external identity authentication, parameter checks, state persistence, and result conversion.

    Its focus is not simply exposing an address, but establishing a stable service contract:

    • Which internal functions can be exposed externally;
    • Which parameters are allowed to be passed in from outside;
    • Which data and tools an external identity can use;
    • How tasks are associated with internal execution records;
    • How cancellation requests and timeouts affect internal execution;
    • Which output content must be filtered or redacted.

    Therefore, bidirectional support does not mean the same conversion code can simply run in reverse. The inbound direction must take on more complete server-side responsibilities, especially authorization, resource isolation, and task persistence.

    4. Designing Capability Selection and Collaboration Orchestration

    4.1 Define Constraints First, Then Compare Fitness

    Capability selection can be divided into two stages.

    The first stage applies hard constraint filtering, such as tenant permissions, data residency requirements, input types, version compatibility, and environment isolation. Any candidate that fails these constraints should not enter the subsequent model-based selection process.

    The second stage compares semantic fitness, availability, historical quality, latency, and cost among qualified candidates. The scoring rules here should be explainable and auditable, and model-generated scores should not be treated as objective proof of quality.

    For high-risk business processes, it may be preferable to call verified capabilities in a fixed manner rather than pursuing fully dynamic routing.

    4.2 Choose Orchestration Based on Task Dependencies

    Common collaboration patterns include:

    Sequential orchestration. The output of one step becomes the input of the next, which suits tasks with clear dependencies. Intermediate output quality needs to be controlled to prevent errors from being amplified along the flow.

    Parallel orchestration. Multiple agents independently handle different subproblems, and their results are then aggregated. This suits information collection or independent verification, but it is necessary to define whether processing can continue when some parts fail.

    Hierarchical delegation. A main agent assigns tasks to specialized agents. Delegation depth, total invocation count, and budget limits should be set to prevent loops.

    Human confirmation. Before high-impact operations such as payments, permission changes, or other sensitive actions, a human should review and approve. Confirmation should be bound to specific operation parameters, not merely a vague “approved to execute” statement.

    When choosing an orchestration pattern, business dependencies should be the primary consideration. The goal is not to have as many agents or roles as possible.

    5. Task Reliability: Treat Exceptions as Normal Paths

    5.1 Idempotency and Duplicate Submission

    A network timeout does not mean the server did not execute the task. If the caller retries directly, it may cause duplicate processing or even duplicate business operations.

    An application-level idempotency identifier can be designed to map repeated submissions of the same business operation to an existing task. However, the scope, retention period, and conflict handling rules of the idempotency identifier must be explicit. It should not be assumed that the protocol naturally guarantees business idempotency.

    For operations with side effects, duplicate prevention mechanisms should also be established at the business layer where the action is actually executed.

    5.2 Timeouts and Cancellation

    A distinction should be made among connection timeouts, single-request timeouts, and overall task deadlines. The overall deadline can be propagated downstream so that the downstream does not continue running indefinitely after the upstream has stopped waiting.

    Cancellation is usually a best-effort request. A task may already have completed, or it may have produced external effects that cannot be undone. Therefore, the system should clearly distinguish among “cancellation requested,” “execution stopped,” and “business effect rolled back.” These three states must not be conflated.

    5.3 Retries and Degradation

    Retries are usually suitable for transient network failures or temporary resource shortages. Parameter errors, permission denials, and deterministic business failures should not be retried blindly.

    Retries need a maximum attempt count and a backoff strategy. When necessary, the system can switch to an authorized fallback capability or degrade to returning partial results. Missing content that is critical to the business should be explicitly stated rather than fabricated by an aggregation agent.

    6. Security Governance: Boundaries Beyond Protocol Interoperability

    Natural-language text, files, and tool suggestions returned by external agents should all be treated as untrusted input. Even if the communication protocol is valid, the content is not necessarily safe.

    First, identity authentication and authorization should be performed for every invocation. Identity information in registry records cannot directly replace validation at invocation time, and credentials should not be propagated within task text.

    Second, the principle of least data transfer should be followed. Only the fields required to complete the current subtask should be sent. When necessary, data should be redacted or replaced with restricted references, avoiding the transfer of the full business context to every collaboration partner.

    Third, prompt injection should be prevented. Instructions in external results such as “ignore restrictions” or “read credentials” should not be able to change local security policies. Text content and control instructions need to be separated, and sensitive operations must be validated by independent rules.

    Finally, the outbound access scope should be controlled. Access locations in registry records should be checked, redirects and internal network access should be restricted, and service discovery mechanisms should not be exploited as a channel for bypassing network boundaries.

    7. Observability and Acceptance: Proving the System Is Actually Usable

    A multi-agent chain involves multiple tasks and subtasks. Looking only at logs from one application makes it difficult to locate failures. It is advisable to establish correlation identifiers across invocation chains to connect capability search, routing decisions, protocol conversion, task execution, and result aggregation.

    Observability should cover at least the following:

    • Task success rates and the distribution of failure reasons;
    • Latency and queue time at each stage;
    • Retry counts, timeout rates, and cancellation outcomes;
    • Basis for candidate selection and the actual invocation target;
    • Message size, resource consumption, and budget usage;
    • Whether output structures comply with the contract;
    • Authorization and confirmation records for high-risk operations.

    Logs should record the necessary structured metadata where possible, while avoiding indiscriminate storage of sensitive inputs and full model outputs.

    Acceptance tests should not test only the normal completion path. They should also cover capability retirement, version incompatibility, identity expiration, duplicate submission, partial failure, abnormal artifacts, and cancellation races. For protocol compatibility, testing should be based on the actual adopted version rather than making a blanket claim of “full compatibility.”

    8. Implementation Sequence: From a Controlled Closed Loop to Dynamic Collaboration

    In the first stage, fix one caller and one service provider, complete bidirectional task mapping, identity verification, and result conversion, and validate the basic contract.

    In the second stage, introduce registry discovery and capability descriptions, establish publication, retirement, version management, and access scope control, and reduce the cost of manually maintaining connection information.

    In the third stage, add dynamic selection on top of hard constraint filtering, gradually support parallel processing, asynchronous tasks, and restricted delegation, and establish a quality evaluation mechanism.

    In the fourth stage, improve observability, failure recovery, budget control, and human confirmation so that the collaboration chain has the governance capabilities required for continuous operation.

    The maturity of a multi-agent system should not be measured by how many agents it connects. It should be measured by whether the system can clearly explain why a task was assigned to a particular capability, whether execution state is trustworthy, whether data is protected, and how recovery works after failure. Standardized communication, bidirectional adaptation, and registry governance jointly solve the foundation of collaboration. On top of that foundation, clear business contracts and verifiable engineering constraints are the key to stable implementation.