Agent2Agent协议A2A详解:替代MCP的LLM时代新型AI Agent通信标准
摘要:想用AI Agent赚钱,却被MCP的JSON Schema卡住?Google刚发布的Agent2Agent Protocol(A2A)不是给MCP打补丁,而是彻底换掉通信底座——它想成为LLM时代的HTTP/2。 官方定义很清晰:A2A规范的是“client agent”和“remote agent”之间的双向契约。Client不用管API密钥、URL拼接或OpenAPI文档解析;只发一...

想用AI Agent赚钱,却被MCP的JSON Schema卡住?Google刚发布的Agent2Agent Protocol(A2A)不是给MCP打补丁,而是彻底换掉通信底座——它想成为LLM时代的HTTP/2。
官方定义很清晰:A2A规范的是“client agent”和“remote agent”之间的双向契约。Client不用管API密钥、URL拼接或OpenAPI文档解析;只发一个类似`a2a://remote-weather?lat=39.73&unit=c`的请求,remote agent就自动返回结构化JSON,或者流式`text/event-stream`。底层用gRPC+Protobuf,但开发者只需加一行装饰器:`@a2a.remote("weather.v1")`,序列化、超时、重试、OAuth2.0鉴权(基于Agent DID)全由协议栈处理。
我们上周用A2A搭了一条真实跑起来的赚钱流水线,三个现成Agent串在一起:
- Client Agent是本地FastAPI服务,监听飞书群消息;
- 高分线索触发`@a2a.remote("lead-scorer")`(Lambda上封装的Claude-3.5调用);
- 再把高分结果推给`@a2a.remote("wechat-push")`(企业微信Bot插件)——全程没写一行HTTP胶水代码,端到端延迟压在800ms以内。
Server开发也变简单了。以前写MCP Server得手动路由`tool_call`、校验参数、回传状态;现在用`a2a-server-cli init --proto weather.proto`生成骨架,填三行逻辑就够了:
weather_server.py
from a2a import RemoteAgent
class WeatherAgent(RemoteAgent):
def handle_request(self, req):
# req.lat, req.unit 已完成类型解析和校验
temp = fetch_openweathermap(req.lat, req.lon, req.unit)
return {"temperature": temp, "unit": req.unit} # 自动序列化
👉 Binance · OKX · Gate.io · HTX · Bitget
if name == "__main__":
WeatherAgent().serve(port=8080) # 自动注册到A2A Registry
部署更直接:`a2a-server-cli deploy --region us-east-1` → 自动生成Cloudflare Worker + Registry心跳。gRPC TLS、服务发现、版本兼容这些事,A2A Registry全包了。每个remote agent必须暴露`/healthz`和`/schema`端点,注册即验证,验证即可用。
商业效果已经落地。某跨境电商团队用A2A解耦了客服Agent(本地Llama-3.2)、库存Agent(Shopify API封装)、物流Agent(菜鸟面单生成)。原来MCP集成要维护6个API密钥、3套重试逻辑;现在删掉217行胶水代码,运维成本降63%,订单履约快2.4秒——按日均8000单算,年省人力约¥47万。
工具链已就位:龙虾官网yitb.com上线`a2a-devkit`(含VS Code插件、Registry沙箱、CLI调试器),OpenClaw v0.8.3起原生支持A2A client调用,Claude-3.5-sonnet模型内建A2A request parser(prompt里写`a2a://xxx`,自动触发调用)。
HTTP出来后,没人再用FTP传网页。A2A跑起来之后,MCP会变成迁移工具。
**下一步**:
1. 去 yitb.com/a2a 看协议规范,进沙箱环境;
2. 执行 `curl -X POST https://sandbox.yitb.com/v1/a2a/deploy -d '{"proto":"weather.proto"}'` 部署第一个remote agent;
3. 加入 Discord #a2a-builders,领「A2A赚钱模板包」(含飞书→LeadScorer→企微闭环源码+部署脚本)。