Agent Orchestrator:为您的 GitHub 项目自动化并行 AI 编码代理

Agent Orchestrator – 运行并行 AI 编码代理的终极工具

现代软件开发正越来越多地依赖智能代理。无论你使用的是 Claude Code、Codex 还是 Aider,在终端中运行单个代理都是简单的,但将其扩展到几十个代理同时处理 CI 失败、评审评论和新功能,却仍然是个协调难题。

引入 Agent Orchestrator —— 一个开源、插件驱动的框架,将孤立的代理变成协调一致的舰队。它可以管理工作树、分支、PR 和运行时环境,让你能够启动一个代理后 安然离开

重要性 —— 自动化代理生命周期,让你能在人为决策时保留人工参与,同时将重复的代码生成任务交给 AI,从而实现更快迭代、更少合并冲突、更可靠的发布。

Core Concepts

组件 默认 主要替代
运行时 tmux Docker, k8s, 单独进程
代理 Claude Code Codex, Aider, OpenCode
工作区 Git worktree Clone
跟踪器 GitHub Linear
通知器 Desktop Slack, Webhook
终端 iTerm2 Web

所有这些抽象都是可互换的。一个轻量级插件实现接口并暴露 PluginModule。在我们的 monorepo 中,这在 packages/core/src/types.ts 中定义。

What It Can Do

  • 并行 CI 修复 – 当 GitHub workflow 失败时,代理收到日志,写下修复,运行测试并打开 PR。
  • 评审评论自动回复 – 代理读取更改请求评论,更新代码并推送新分支。
  • 自动合并提示 – 当 CI 绿色后,你会收到友好的通知来审核并合并。
  • 多项目支持 – 在 agent-orchestrator.yaml 中定义若干项目,然后用一句命令在它们之间启动代理。
  • 可扩展性 – 可插入 Docker 作为无服务器运行时,Slack 用于通知,甚至自定义代理通过内部 API 交互。

Quick Start Guide

# 1️⃣  克隆仓库
git clone https://github.com/ComposioHQ/agent-orchestrator.git
cd agent-orchestrator

# 2️⃣  配置你的环境(Node 20+、Git 2.25+、tmux、gh)
bash scripts/setup.sh

# 3️⃣  指向你的仓库并初始化
cd ~/my-project && ao init --auto

# 4️⃣  运行 orchestrator 仪表板并启动代理
ao dashboard   # 打开 http://localhost:3000
ao spawn my-app 123   # 问题编号(GitHub、Linear 或 ad‑hoc)

ao status 命令会显示所有活跃会话,而 ao send <session> "Fix the tests" 允许你向正在运行的代理发送任意提示。

Architecture Snapshot

[Repo] ──► Gitworktree ──► Agent (Claude/Codex/Aider) ──► PR → GitHub
  │            │                          │             │
  └─ tmux session ──┬─ Notifier ─► Desktop/Slack
                     │
                  Runtime: Docker / Kubernetes

每个代理都有自己的 tmux 会话(或 Docker 容器),拥有专用功能分支,并将 PR 推回仓库。所有通信(CI 日志、评审评论)都通过 orchestrator 服务转发。

Customizing with agent-orchestrator.yaml

port: 3000

defaults:
  runtime: tmux
  agent: claude-code
  workspace: worktree
  notifiers: [desktop]

projects:
  my-app:
    repo: owner/my-app
    path: ~/my-app
    defaultBranch: main
    sessionPrefix: app

reactions:
  ci-failed:
    auto: true
    action: send-to-agent
    retries: 2
  changes-requested:
    auto: true
    action: send-to-agent
    escalatedAfter: 30m
  approved-and-green:
    auto: false
    action: notify

reactions 将触发器映射到动作。例如,当检测到 ci-failed 时,代理会被自动通知,并得到若干重试机会。

Extend the Agent Stack

Adding a new agent or runtime is just a matter of implementing an interface and registering the plugin:

export const myNewAgent: PluginModule = {
  name: 'my-new-agent',
  type: 'agent',
  init: async (config) => { /* … */ },
}

然后将 my-new-agent 添加到 agent-orchestrator.yaml

Real‑World Use Cases

场景 Agent Orchestrator 如何帮助
快速原型 为每个新功能工单启动一个代理;它会自动生成代码骨架和测试。
CI 驱动的 bug 修复 代理会自动回滚到失败分支,定位问题,编写修复并打开 PR。
代码重构扫面 为每个模块运行一个代理,以统一风格并在整个代码库中更新导入。
团队生产力 开发者将重复性任务委托给 AI,从而腾出时间做架构决策。

Getting Involved

本项目采用 MIT 许可证,欢迎贡献。插件架构使得添加新功能变得十分便捷:

  • 新的运行时(例如 Docker Compose 或 Kubernetes)
  • 替代通知器(Slack、Webhook、Composio 平台)
  • 支持其他问题追踪系统(Jira、ServiceNow)
  • 超出 Claude Code 与 Codex 的 AI 代理

欢迎提交 PR 或 issue,并参考 CLAUDE.md 文件以了解代码规范和架构细节。

Conclusion

Agent Orchestrator transforms the chaotic world of multiple AI agents into a well‑coordinated, scalable system. By abstracting runtime, workspace, and notification concerns, devs can focus on high‑level strategy while the orchestrator handles branch isolation, CI integration, and PR management. Whether you’re a solo developer or a team maintaining a large monorepo, Agent Orchestrator empowers you to unlock the full potential of AI‑driven coding at scale.

今天就来试试 – 克隆仓库,启动代理,观看你的 CI 问题自动解决。你将来会感谢自己解放了繁重的手工工作。

原创文章: 查看原文

分享本文