SuperX-代理网关编排器
Open-source infrastructure for multi-agent systems at scale
When to Use • Why SuperX • Features • Quick Start • Architecture • Documentation
______________________________________________________________________
🚀 SuperX(v0.1.0-alpha)简介
像Google ADK、LangGraph和AutoGen这样的代理框架已经帮助开发人员设计复杂的代理工作流、管理会话和添加可观察性。它们使构建和推理多智能体系统变得更加容易 *在给定的堆栈内*.
但随着系统的扩展,团队通常需要 共享基础设施层 坐着 *在...之间* 代理——尤其是当代理使用不同的框架构建、独立部署或单独扩展时。
谷歌的 A2A协议 定义了代理如何通信和交换上下文的通用标准。但是 仅靠协议无法处理运行时问题:路由、背压、弹性、持久性或实时协调。
这就是SuperX正在探索的差距。
你什么时候需要SuperX?
如果满足以下条件,您非常适合SuperX:
- ✅ 你有 多个AI代理 (2+)需要共同努力
- ✅ 代理人是 使用不同的框架构建 (LangGraph、AutoGen、自定义等)
- ✅ 代理人是 独立部署 或单独缩放
- ✅ 你需要 实时可见性 进入代理工作流程和失败
- ✅ 你想要的 内置弹性 --断路器、背压、任务持久性
- ✅ 你需要 动态路由 --没有硬编码哪个代理处理什么
如果你正在管理一个代理,或者所有代理都在一个框架内紧密耦合,那么你还不需要SuperX。
SuperX填补的空白
Agent Frameworks Protocols Infrastructure
───────────────── ───────── ──────────────
✅ LangGraph ✅ A2A Protocol ❓ Routing
✅ AutoGen ✅ Standards ❓ Load Balancing
✅ Google ADK ❓ Backpressure
✅ Custom ❓ Circuit Breakers
❓ Task Persistence
❓ Multi-Agent Coordination
SuperX fills this gap ↑SuperX扮演着 代理网关和编排器,处理代理逻辑本身之外的基础设施问题:
- 智能路由 --根据技能、可用性和负载将消息路由到代理
- 实时流媒体 --通过服务器发送的事件观察代理的进度
- 内置弹性 --断路器、背压和优雅降级
- 任务持久性 --跟踪多回合对话并处理失败
- 动态代理注册表 --无需重新启动即可注册/注销代理
- A2A协议支持 --完全支持Google的代理到代理协议
如果AI代理像 专业员工SuperX是 共享基础设施 --路由对话、管理故障,并在系统部分减慢或发生故障时保持工作进展。
解决方案
┌─────────────┐ ┌─────────────────────────────────────┐ ┌─────────────┐
│ │ │ SUPERX │ │ Agent A │
│ Your App │ ───► │ • Routing • Load Balancing │ ───► │ Agent B │
│ │ │ • Failover • Monitoring │ │ Agent C │
└─────────────┘ └─────────────────────────────────────┘ └─────────────┘
One endpoint. Many agents.
Any protocol. Hidden complexity.| 问题 | 手册 | 使用SuperX |
|---|---|---|
| 添加新代理 | 更新所有客户端代码 | 注册一次,随处可用 |
| 代理宕机 | 客户端应用程序失败 | 使用断路器自动故障转移 |
| 使用哪种代理? | 客户端硬编码 | 基于技能/负载的智能路由 |
| 多回合对话 | 自己管理状态 | 任务管理器处理它 |
| 代理过载 | 手动背压逻辑 | 内置每个代理的并发限制 |
| 监控健康状况 | 构建自定义仪表板 | 可观察性优先设计(第4+阶段) |
特性
处理基础设施问题
| 功能 | 为什么重要 |
|---|---|
| 智能路由 | 基于代理技能和负载而非硬编码端点路由消息 |
| 实时流媒体 | 通过服务器发送事件(SSE)监视代理正在进行的工作 |
| 任务管理 | 坚持多回合对话;代理失败后恢复 |
| 断路器 | 检测故障代理,快速故障,优雅恢复 |
| 背压 | 每个代理的并发限制可防止级联故障 |
| 动态注册表 | 在运行时注册/注销代理,无需重新启动 |
| A2A协议 | 完全支持Google的代理到代理协议 |
| 按请求Webhooks | 无需预先配置的临时通知 |
| 推送通知 | 使用HMAC、JWT或令牌身份验证的基于Webhook的通知 |
| 水平缩放 | 跨Erlang节点分布,无需外部数据库 |
| 聚类 | 通过八卦、DNS或Kubernetes自动发现 |
快速开始
使用Docker Compose(推荐)
# Clone the repository
git clone https://github.com/alfinjohnson/superx.git
cd superx
# Start PostgreSQL and the orchestrator
docker compose up -d
# Check health
curl http://localhost:4000/health
# View logs
docker compose logs -f orchestrator发展模式
cd orchestrator
mix deps.get
mix compile
# Start PostgreSQL (if not running)
docker compose up -d postgres
# Run database migrations
mix ecto.setup
# Start the server
mix run --no-halt配置代理
SuperX从YAML配置文件加载代理。创建或修改 agents.yml:
# samples/agents.yml
agents:
# A2A Protocol Agent
my_agent:
url: http://localhost:8001/a2a/my_agent # A2A RPC endpoint of your agent
bearer: "" # Optional: API token for authentication
protocol: a2a
protocolVersion: 0.3.0
metadata:
agentCard:
url: http://localhost:8001/a2a/my_agent/.well-known/agent-card.json
name: my_agent
description: Description of what this agent does
skills:
- id: skill_id
name: Skill Name
description: What this skill does
# Another A2A Agent
assistant_agent:
url: http://localhost:8002/a2a/assistant
protocol: a2a
protocolVersion: 0.3.0
metadata:
agentCard:
url: http://localhost:8002/a2a/assistant/.well-known/agent-card.json
name: assistant_agent
description: General purpose assistant agentURL配置:
url:代理服务器的A2A JSON-RPC端点(例如。,http://host:port/a2a/agent_name)agentCard.url:代理卡发现端点(通常{agent_url}/.well-known/agent-card.json)bearer:用于保护代理通信的可选身份验证令牌
注: 您需要一个在指定URL上运行的A2A兼容代理服务器。请参阅 谷歌A2A Python示例 例如实现。
设置 SUPERX_AGENTS_FILE 加载代理的环境变量:
# Using environment variable
$env:SUPERX_AGENTS_FILE="./samples/agents.yml"; mix run --no-halt
# Or in docker-compose.yml
environment:
- SUPERX_AGENTS_FILE=/app/config/agents.yml看 样品/试剂.yml 举一个完整的例子。
按请求Webhooks
在请求临时通知时直接传递webhook URL,无需预先配置:
curl -X POST http://localhost:4000/rpc \
-H "Content-Type: application/json" \
-d '{
"jsonrpc":"2.0",
"id":1,
"method":"message/send",
"params":{
"agentId":"my_agent",
"message":{"role":"user","parts":[{"text":"Hello"}]},
"metadata":{
"webhook":{
"url":"https://myapp.com/webhook",
"hmacSecret":"secret123",
"token":"bearer-token"
}
}
}
}'Webhook配置:
url(必需):接收通知的端点hmacSecret(可选):HMAC-SHA256签名的秘密token(可选):用于身份验证的承载令牌jwtClaims(可选):自定义JWT声明
根据请求,webhook优先于存储的webhook配置。
验证安装
# List registered agents
curl -X POST http://localhost:4000/rpc \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","id":1,"method":"agents/list","params":{}}'
# Send a message to an agent
curl -X POST http://localhost:4000/rpc \
-H "Content-Type: application/json" \
-d '{
"jsonrpc":"2.0",
"id":1,
"method":"message/send",
"params":{
"agent":"check_prime_agent",
"message":{"role":"user","parts":[{"text":"Is 17 a prime number?"}]}
}
}'建筑
┌─────────────────────────────────────────┐
│ SuperX Gateway │
│ │
┌──────────┐ │ ┌─────────────────────────────────┐ │
│ Client │ ──── A2A ────────┼─▶│ Router & Load Balancer │ │
└──────────┘ Protocol │ └────────────────┬────────────────┘ │
│ │ │
│ ┌──────────────┼──────────────┐ │
│ │ │ │ │
│ ▼ ▼ ▼ │
│ ┌──────┐ ┌──────┐ ┌──────┐ │
│ │Agent │ │Agent │ │Agent │ │
│ │Worker│ │Worker│ │Worker│ │
│ └──┬───┘ └──┬───┘ └──┬───┘ │
│ │ │ │ │
│ │ Circuit │ Circuit │ Circuit│
│ │ Breaker │ Breaker │ Breaker│
└────┼────────────┼────────────┼────────┘
│ │ │
▼ ▼ ▼
┌──────────┐ ┌──────────┐ ┌──────────┐
│ Agent A │ │ Agent B │ │ Agent C │
│ (Remote) │ │ (Remote) │ │ (Remote) │
└──────────┘ └──────────┘ └──────────┘关键组件
- 路由器:接收A2A协议请求并路由到适当的代理
- 代理工人:管理每个代理的状态、断路器和背压
- 任务管理器:保持任务状态并处理多回合对话
- 推送通知器:提供具有可配置安全性的webhook通知
部署
存储
SuperX使用 PostgreSQL+ETS混合缓存 具有耐久性和快速读取的架构。
| 特性 | 详细信息 |
|---|---|
| 直写式高速缓存 | 所有写入操作首先进入PostgreSQL,然后进入ETS缓存 |
| 亚毫秒读取 | ETS缓存提供约0.5ms的读取延迟 |
| 耐用的存储空间 | PostgreSQL确保数据在重启后仍然有效 |
| 自动缓存预热 | 启动时从数据库填充缓存 |
| 分布式就绪 | 分布式注册表和监控器的仓库 |
注: PostgreSQL是生产部署所必需的。ETS缓存提供快速读取,而PostgreSQL确保持久性。
码头工人
# Production mode
docker compose up orchestrator
# Development mode with hot reload
docker compose up orchestrator-dev环境配置
关键环境变量:
| 变量 | 默认值 | 描述 |
|---|---|---|
PORT | 4000 | HTTP服务器端口 |
DATABASE_URL | -- | PostgreSQL连接URL |
AGENTS_FILE | -- | 代理程序YAML配置路径 |
CLUSTER_STRATEGY | -- | 聚类: gossip, dns, kubernetes |
SECRET_KEY_BASE | -- | 加密操作的密钥(prod中需要) |
生产部署
# Set required environment variables
export PORT=4000
export DATABASE_URL=ecto://user:pass@host/superx_prod
export AGENTS_FILE=/etc/superx/agents.yml
export SECRET_KEY_BASE=$(openssl rand -base64 64)
# Pull and run
docker pull ghcr.io/anthropics/superx:latest
docker run -d \
--name superx \
-p 4000:4000 \
-e PORT \
-e DATABASE_URL \
-e AGENTS_FILE \
-e SECRET_KEY_BASE \
-v /etc/superx/agents.yml:/home/app/agents.yml:ro \
ghcr.io/anthropics/superx:latest代理配置
代理可以通过YAML文件或运行时API进行配置。
YAML配置
创建一个 agents.yml 文件:
agents:
- name: my_agent
url: https://agent.example.com/.well-known/agent.json
# Optional: bearer token for authenticated agents
bearer: "your-bearer-token"挂载文件并设置 AGENTS_FILE:
docker run -d \
-v ./agents.yml:/home/app/agents.yml:ro \
-e AGENTS_FILE=/home/app/agents.yml \
-e DATABASE_URL=ecto://user:pass@host/superx \
ghcr.io/anthropics/superx:latest运行时代理管理
# Register an agent
curl -X POST http://localhost:4000/rpc \
-H "Content-Type: application/json" \
-d '{
"jsonrpc":"2.0",
"id":1,
"method":"agents/upsert",
"params":{
"name":"my_agent",
"url":"https://agent.example.com/.well-known/agent.json"
}
}'
# Check agent health
curl -X POST http://localhost:4000/rpc \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","id":1,"method":"agents/health","params":{"name":"my_agent"}}'
# Refresh agent card
curl -X POST http://localhost:4000/rpc \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","id":1,"method":"agents/refreshCard","params":{"name":"my_agent"}}'项目结构
superx/
├── orchestrator/ # Main Elixir application
│ ├── lib/ # Source code
│ │ └── orchestrator/ # Core modules
│ │ ├── agent/ # Agent management (Store with ETS+PostgreSQL)
│ │ ├── task/ # Task management (Store, PubSub, Streaming)
│ │ ├── schema/ # Ecto schemas (Task, Agent, PushConfig)
│ │ ├── protocol/ # Protocol implementations
│ │ │ └── a2a/ # A2A protocol (Adapter, Proxy, PushNotifier)
│ │ └── web/ # Web layer (Router, Streaming, Handlers)
│ ├── priv/db/ # Database migrations
│ └── test/ # Test suite (430+ tests)
│ ├── protocol/ # Protocol-specific tests
│ └── stress/ # Stress and performance tests
├── docs/ # Documentation
│ ├── a2a-v030/ # A2A v0.3.0 specification
│ └── roadmap.md # Development roadmap
├── samples/ # Sample configurations
│ └── agents.yml # Example agent configuration
└── docker-compose.yml # Local development setup文档
用户指南
开发者文档
协议规范
- A2A协议 --Google的代理到代理协议规范
- A2A文件 --正式协议文件
- A2A Python示例 --代理实现示例
- A2A v0.3.0规格 --A2A规范的本地副本
技术栈
内置于 Elixir和OTP --专为我们需要的东西而设计:长时间运行、容错、高度并发的代理工作流。可靠性是头等大事,而不是事后的想法。
| 组件 | 技术 |
|---|---|
| 运行时 | Elixir 1.19+/OTP 28+(轻量级、并发、分布式) |
| 数据库 | PostgreSQL 15+,带Ecto(持久存储) |
| 缓存 | ETS(亚毫秒级读写直通缓存) |
| HTTP服务器 | Bandit(快速、兼容插件、流媒体支持) |
| 分布状态 | 部落(分布式注册表、监督员) |
| 聚类 | libcluster(八卦、DNS、Kubernetes) |
| 容器 | Docker(多阶段构建) |
| 测试 | ExUnit(430+测试,高覆盖率) |
贡献
- 克隆该仓库
- 创建要素分支(
git checkout -b feature/amazing-feature) - 运行测试(
mix test --exclude stress) - 提交更改(
git commit -m 'Add amazing feature') - 推送到分支(
git push origin feature/amazing-feature) - 打开拉取请求
许可证
MIT许可证-请参阅 许可证 了解详情。
