Cloud Native 12 min read

How AgentScope Leverages A2A and Nacos for Cross‑Language Multi‑Agent Collaboration

AgentScope integrates Google’s A2A protocol with Nacos as a default registry to enable unified discovery, governance, and cross‑framework collaboration of agents across diverse language stacks, addressing challenges of multi‑team coordination, protocol heterogeneity, and production‑grade deployment.

Alibaba Cloud Native
Alibaba Cloud Native
Alibaba Cloud Native
How AgentScope Leverages A2A and Nacos for Cross‑Language Multi‑Agent Collaboration

AgentScope builds a unified agent ecosystem by combining the Agent‑to‑Agent (A2A) open standard with Nacos as the default A2A registry, allowing agents written in different languages and frameworks to be discovered, managed, and orchestrated seamlessly.

Why A2A and Nacos?

Language‑stack diversity: Enterprises often have core services in Java or Go while algorithm teams use Python, creating friction in agent integration.

Fragmented agent frameworks: Projects use LangChain, AutoGPT, AgentScope, etc., each with its own APIs, making cross‑framework calls difficult.

Multi‑team collaboration: Agents are spread across services, projects, and teams, requiring a unified discovery and management solution.

Inconsistent protocols: REST, gRPC, custom protocols increase integration cost and maintenance overhead.

A2A Protocol Overview

A2A, proposed by Google, defines a universal message format and capability description so that agents—regardless of language, framework, or runtime—can be discovered, invoked, and composed. It supports rich interactions such as text dialogue, thinking, multimodal content, and tool calls, enabling a "define once, use everywhere" model.

AgentScope Features with A2A

Eliminate agent silos: Any A2A‑compatible agent can interoperate with AgentScope agents, breaking technology barriers.

Unified development experience: Local and remote A2A agents share the same API; the framework handles protocol conversion, retries, and routing automatically.

Production‑grade governance: Integrated Nacos 3.0 provides service discovery, health checks, and namespace isolation, leveraging proven enterprise operations.

Core Components

A2AAgent: Represents an agent that can call other agents via A2A.

AgentCardResolver: Pluggable discovery mechanism; implementations include FixedAgentCardResolver, FileAgentCardResolver, WellKnownAgentCardResolver, and NacosAgentCardResolver.

A2ARegistry: Abstract interface for registering agents; Nacos is the default implementation.

Using A2A in AgentScope (Python Example)

from agentscope.agent import A2AAgent
from agentscope.a2a import NacosAgentCardResolver
from agentscope.message import Msg
# Create Nacos resolver
nacos_resolver = NacosAgentCardResolver(
    remote_agent_name="my-remote-agent",
    nacos_client_config=ClientConfig(
        server_addresses="http://localhost:8848"
    )
)
# Build A2AAgent using the resolver
agent = A2AAgent(agent_card=await nacos_resolver.get_agent_card())

Java Integration Example

import io.agentscope.agent.A2AAgent;
import io.agentscope.extensions.a2a.nacos.NacosAgentCardResolver;
import java.util.Properties;
import com.alibaba.nacos.api.PropertyKeyConst;
import com.alibaba.nacos.api.ai.AiFactory;
import com.alibaba.nacos.api.ai.AiService;

Properties properties = new Properties();
properties.put(PropertyKeyConst.SERVER_ADDR, "localhost:8848");
AiService aiService = AiFactory.createAiService(properties);
NacosAgentCardResolver resolver = new NacosAgentCardResolver(aiService);
A2AAgent agent = A2AAgent.builder()
    .name("MyAgent")
    .agentCardResolver(resolver)
    .build();

AgentScope Runtime and Service Registration

AgentScope Runtime exposes A2A services automatically. By configuring a2a_config with a registry field, developers can register agents to Nacos without manual code changes. Two configuration methods are supported:

Direct parameter configuration in code (e.g., passing a NacosRegistry instance to AgentApp).

Environment‑variable based configuration via a .env file (e.g., A2A_REGISTRY_ENABLED=true, A2A_REGISTRY_TYPE=nacos, NACOS_SERVER_ADDR=localhost:8848).

Spring Boot Starter for Java

Adding the Maven dependency

io.agentscope:spring-boot-starter-agentscope-runtime-a2a-nacos:1.0.3

and configuring application.yaml enables automatic exposure of a JSON‑RPC endpoint ( /a2a/jsonrpc) and a well‑known AgentCard endpoint ( /.well-known/agent-card.json), with built‑in routing, message conversion, and task timeout handling.

Summary

AgentScope’s full support for the A2A protocol and Nacos registry creates a production‑ready, cloud‑native foundation for large‑scale multi‑agent systems. It unifies discovery, governance, and cross‑language interaction, allowing enterprises to transition from isolated POC agents to an open, interoperable agent ecosystem.

cloud-nativeservice discoveryNacosMulti-agentA2AAgentScope
Alibaba Cloud Native
Written by

Alibaba Cloud Native

We publish cloud-native tech news, curate in-depth content, host regular events and live streams, and share Alibaba product and user case studies. Join us to explore and share the cloud-native insights you need.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.