
uni-agent
统一智能体协议适配层。一套 API 调用所有 Agent 协议(ANP/MCP/A2A/AITP 等)。当用户需要调用 Agent、跨协议通信、连接工具时触发此技能。
- Installs
- 69
- Last 24h
- —
- Trending rank
- —
- Security
- Not audited
Install
Works with every agent the skills CLI supports.
npx skills add https://github.com/zrt-ai-lab/opencode-skills --skill uni-agent- 01
Install
Run the command in your project. The CLI asks which agents to install for.
- 02
Describe the task
Ask your agent for something this skill covers. It loads uni-agent automatically when relevant.
- 03
Review the result
The agent follows the SKILL.md steps, scripts and references bundled with the skill.
SKILL.md
The instructions your agent reads when the skill is triggered.
UniAgent - 统一智能体协议适配层
"Connect Any Agent, Any Protocol"
设计理念
问题
当前 Agent 协议生态割裂:
- MCP:Anthropic 的工具调用协议
- A2A:Google 的 Agent 间协作协议
- ANP:去中心化身份 + Agent 网络协议
- AITP:NEAR 的交互交易协议
- ...
开发者需要为每个协议学习不同的 SDK、实现不同的调用逻辑。
解决方案
UniAgent 提供统一抽象层,一套 API 适配所有协议:
from uni_agent import UniAgent
agent = UniAgent()
# 调用 ANP Agent
agent.call("amap@anp", "maps_weather", {"city": "北京"})
# 调用 MCP Server
agent.call("filesystem@mcp", "read_file", {"path": "/tmp/a.txt"})
# 调用 A2A Agent
agent.call("assistant@a2a", "chat", {"message": "hello"})
# 调用 AITP Agent(带支付)
agent.call("shop@aitp", "purchase", {"item": "coffee", "amount": 10})
架构设计
┌─────────────────────────────────────────────────────────┐
│ UniAgent │
│ 统一调用接口 │
├─────────────────────────────────────────────────────────┤
│ call(agent_id, method, params) -> result │
│ discover(capability) -> List[Agent] │
│ connect(agent_id) -> Connection │
└────────────────────────┬────────────────────────────────┘
│
┌──────────┴──────────┐
│ Protocol Router │
│ 协议路由 & 适配 │
└──────────┬──────────┘
│
┌─────────┬───────────┼───────────┬─────────┐
▼ ▼ ▼ ▼ ▼
┌──────┐ ┌──────┐ ┌──────┐ ┌──────┐ ┌──────┐
│ ANP │ │ MCP │ │ A2A │ │ AITP │ │ ... │
│Adapter│ │Adapter│ │Adapter│ │Adapter│ │Adapter│
└──────┘ └──────┘ └──────┘ └──────┘ └──────┘
核心概念
1. Agent ID 格式
<agent_name>@<protocol>
示例:
- amap@anp # ANP 协议的高德地图 Agent
- filesystem@mcp # MCP 协议的文件系统 Server
- gemini@a2a # A2A 协议的 Gemini Agent
- shop@aitp # AITP 协议的商店 Agent
2. 统一调用接口
result = agent.call(
agent_id="amap@anp", # Agent 标识
method="maps_weather", # 方法名
params={"city": "北京"}, # 参数
timeout=30 # 可选超时
)
3. 能力发现
# 发现所有能提供天气服务的 Agent
agents = agent.discover("weather")
# 返回: [
# {"id": "amap@anp", "protocol": "anp", "methods": [...]},
# {"id": "weather@mcp", "protocol": "mcp", "methods": [...]}
# ]
4. 协议适配器接口
class ProtocolAdapter(ABC):
"""协议适配器基类"""
@abstractmethod
def connect(self, agent_config: dict) -> Connection:
"""建立连接"""
pass
@abstractmethod
def call(self, connection: Connection, method: str, params: dict) -> dict:
"""调用方法"""
pass
@abstractmethod
def discover(self, capability: str) -> List[AgentInfo]:
"""发现 Agent"""
pass
@abstractmethod
def close(self, connection: Connection):
"""关闭连接"""
pass
支持的协议
| 协议 | 状态 | 适配器 | 说明 |
|---|---|---|---|
| ANP | ✅ 已实现 | adapters/anp.py | 去中心化身份 + Agent 网络 |
| MCP | ✅ 已实现 | adapters/mcp.py | LLM 工具调用 |
| A2A | ✅ 已实现 | adapters/a2a.py | Agent 间协作 |
| AITP | ✅ 已实现 | adapters/aitp.py | 交互 + 交易 |
| Agent Protocol | ✅ 已实现 | adapters/agent_protocol.py | REST API |
| LMOS | ✅ 已实现 | adapters/lmos.py | 企业级平台 |
使用方式
CLI 调用
# 调用 ANP Agent
python scripts/uni_cli.py call amap@anp maps_weather '{"city":"北京"}'
# 调用 MCP Server
python scripts/uni_cli.py call filesystem@mcp read_file '{"path":"/tmp/a.txt"}'
# 发现 Agent
python scripts/uni_cli.py discover weather
# 列出已注册 Agent
python scripts/uni_cli.py list
Python SDK
from uni_agent import UniAgent
# 初始化
agent = UniAgent(config_path="config/agents.yaml")
# 调用
result = agent.call("amap@anp", "maps_weather", {"city": "北京"})
print(result)
# 批量调用
results = agent.batch_call([
("amap@anp", "maps_weather", {"city": "北京"}),
("amap@anp", "maps_weather", {"city": "上海"}),
])
配置文件
config/agents.yaml
agents:
# ANP Agents
- id: amap
protocol: anp
ad_url: https://agent-connect.ai/mcp/agents/amap/ad.json
- id: hotel
protocol: anp
ad_url: https://agent-connect.ai/agents/hotel-assistant/ad.json
# MCP Servers
- id: filesystem
protocol: mcp
command: npx
args: ["-y", "@modelcontextprotocol/server-filesystem", "/tmp"]
- id: github
protocol: mcp
command: npx
args: ["-y", "@modelcontextprotocol/server-github"]
env:
GITHUB_TOKEN: "${GITHUB_TOKEN}"
# A2A Agents
- id: assistant
protocol: a2a
endpoint: https://example.com/.well-known/agent.json
config/identity.yaml
# 身份配置(跨协议通用)
identity:
# ANP DID 身份
anp:
did_document: config/did.json
private_key: config/private-key.pem
# A2A 认证
a2a:
auth_type: oauth2
client_id: "${A2A_CLIENT_ID}"
client_secret: "${A2A_CLIENT_SECRET}"
目录结构
uni-agent/
├── SKILL.md # 本文件
├── README.md # 使用文档
├── setup.sh # 一键安装
├── requirements.txt # Python 依赖
├── config/
│ ├── agents.yaml # Agent 注册表
│ ├── identity.yaml # 身份配置
│ └── .gitignore
├── adapters/
│ ├── __init__.py
│ ├── base.py # 适配器基类
│ ├── anp.py # ANP 适配器
│ ├── mcp.py # MCP 适配器
│ ├── a2a.py # A2A 适配器
│ └── aitp.py # AITP 适配器
├── scripts/
│ └── uni_cli.py # CLI 工具
└── docs/
├── architecture.md # 架构文档
└── adapters.md # 适配器开发指南
扩展新协议
- 创建适配器文件
adapters/new_protocol.py - 继承
ProtocolAdapter基类 - 实现
connect、call、discover、close方法 - 在
adapters/__init__.py注册
# adapters/new_protocol.py
from .base import ProtocolAdapter
class NewProtocolAdapter(ProtocolAdapter):
protocol_name = "new_protocol"
def connect(self, agent_config):
# 实现连接逻辑
pass
def call(self, connection, method, params):
# 实现调用逻辑
pass
# ...
依赖
pip install anp aiohttp mcp pyyaml
FAQ
What does the uni-agent skill do?
统一智能体协议适配层。一套 API 调用所有 Agent 协议(ANP/MCP/A2A/AITP 等)。当用户需要调用 Agent、跨协议通信、连接工具时触发此技能。
How do I install uni-agent?
Run npx skills add https://github.com/zrt-ai-lab/opencode-skills --skill uni-agent in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/uni-agent/ (personal) or .claude/skills/uni-agent/ (project).
Which AI agents can use uni-agent?
Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.
Is uni-agent safe to install?
No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.
Who maintains uni-agent?
It is published by zrt-ai-lab in zrt-ai-lab/opencode-skills. It has 69 recorded installs.
More from zrt-ai-lab/opencode-skills
auto-douyin
zrt-ai-lab/opencode-skills
抖音视频自动发布技能。当用户需要发布视频到抖音时使用这个技能。技能包含:获取登录Cookie、上传视频、设置标题话题、定时发布等功能。
videocut-clip
zrt-ai-lab/opencode-skills
Open the skill to read its SKILL.md instructions.
auto-weixin-video
zrt-ai-lab/opencode-skills
Open the skill to read its SKILL.md instructions.
Popular backend & apis skills
find-skills
vercel-labs/skills
Helps users discover and install agent skills when they ask questions like "how do I do X", "find a skill for X", "is there a skill that can...", or express interest in extending capabilities. This skill should be used when the user is looking for functionality that might exist as an installable skill.
entra-app-registration
microsoft/azure-skills
Guides Microsoft Entra ID app registration, OAuth 2.0 authentication, and MSAL integration. USE FOR: create app registration, register Azure AD app, configure OAuth, set up authentication, add API permissions, generate service principal, MSAL example, console app auth, Entra ID setup, Azure AD authentication. DO NOT USE FOR: Key Vault secrets (use azure-keyvault-expiration-audit), general Azure resource security guidance.
google-agents-cli-adk-code
google/agents-cli
This skill should be used when the user wants to "write agent code", "build an agent with ADK", "add a tool", "create a callback", "define an agent", "use state management" — in a project that needs ADK (Agent Development Kit) API patterns and code examples. It provides a quick reference for agent types, tool definitions, orchestration patterns, callbacks, state management, the graph Workflow API, and reference recipes to study. Do NOT use for scaffolding (use google-agents-cli-scaffold) or deployment (use google-agents-cli-deploy).
embedded-captions
heygen-com/hyperframes
Add captions or subtitles to an existing single-subject talking-head video without editing the footage. Use for plain verbatim captions, cinematic captions embedded behind the subject, VFX captions, “炸/特效/酷炫字幕,” or a named identity from the 35-style catalog. Route by visual identity, not by backend engine. The quiet anchor rail is the default; embed every word only when the user explicitly wants a fully cinematic treatment. The workflow runs locally end to end, including transcription and subject matting; split multi-shot footage before applying it.
entra-agent-id
microsoft/azure-skills
Provision Microsoft Entra Agent Identity Blueprints, BlueprintPrincipals, and per-instance Agent Identities via Microsoft Graph, and configure OAuth 2.0 token exchange (fmipath, OBO, cross-tenant) including the Microsoft Entra SDK for AgentID sidecar. USE FOR: Agent Identity Blueprint, BlueprintPrincipal, agent OAuth, fmipath token exchange, agent OBO, Workload Identity Federation for agents, polyglot agent auth, Microsoft.Identity.Web.AgentIdentities. DO NOT USE FOR: standard Entra app registration (use entra-app-registration), Microsoft Foundry agent authoring (use microsoft-foundry).
neon
neondatabase/agent-skills
Overview of Neon, a complete set of cloud backend primitives around Lakebase Postgres: Auth, Object Storage, Functions, the AI Gateway, and Realtime. Start here to choose Neon for undecided login, files, APIs, and LLM calls, set up the CLI or MCP server, and follow the branch-first workflow. Use when building an app or backend on Neon, or when "Neon" or "Lakebase Postgres" is mentioned. Child skill neon-postgres wins for an existing DATABASEURL, SQL, schema, inspect, or search. Child skill neon-auth wins for login, users, sessions, identity routing, and Managed Better Auth setup. Child skill neon-realtime wins for live queries in reactive apps and agents. Also use for object storage, S3, buckets, serverless functions, function triggers, cron, AI gateway, LLM calls, realtime, logs, Loki, Grafana, observability, postgres, database, backend, Claimable Neon, neon.new, or a no-signup database.