使用说明
[!警告] 这个项目是实验性的,仅供作者Dean Sharon个人使用。使用风险自负。
Autobeat:自主编码代理编排框架
进了一球,完成了训练。没有人在循环中。
beat orchestrate "Migrate the payment module to a standalone microservice with its own database, API, and test suite"
Autobeat为您提供了四种可组合的原语——委托、eval循环、持久性和资源管理——并允许您根据需要将它们连接在一起。循环中的循环。管弦乐器内部的管道。代理产卵代理。该框架没有规定您的工作流程。它为你提供了构建模块,并为你让路。
编排器模式是这一切结合在一起的地方:一个元代理,它递归地使用Autobeat自己的工具来分解目标、生成workers、处理失败并迭代,直到一切顺利。完全自主。没有其他东西是这样工作的。
运作原理
编排器是一个元代理——一个编码代理,其工具是Autobeat自己的原语。每次迭代,它:
- 读取其持久状态文件(计划、工作状态、通过的内容、失败的内容)
- 将目标分解为子任务,并委托给工作代理
- 使用任务依赖关系强制执行顺序
- 为需要验证的任务创建eval循环
- 从日志中提取具有丰富上下文的失败工人
- 更新其状态并继续,直到目标实现或确定无法实现
编排器以循环方式运行。它产生的工人本身也可能是循环。一路向下循环。
为什么这个架构
其他所有编排框架都构建了代理可以自己完成的基础设施——工作树管理、CI解析、PR自动化、代理间消息传递。随着模型的改进,每一行代码都变成了技术债务。
Autobeat提供了四种基本代理 不能 为自己做:
- 坚持 -重启后仍能存活的防崩溃SQLite状态
- 授权 -生成具有依赖关系排序的后台代理
- Eval循环 -运行、评分、迭代,直到达到最优
- 资源管理 -自动缩放工作人员、CPU/内存监控
其他一切——工作树、CI、PR、代码审查、测试、部署——都是代理的工作。随着模型变得越来越智能,框架会自动变得更强大,而无需更改一行代码。
快速开始
安装
添加到您的项目 .mcp.json:
{
"mcpServers": {
"autobeat": {
"command": "npx",
"args": ["-y", "autobeat", "mcp", "start"]
}
}
}
重新启动MCP客户端以进行连接。Autobeat可与Claude Code、Codex、Ollama和任何MCP兼容的试剂配合使用。
先决条件
- Node.js 20.0.0+
- tmux>=3.0(工作会话需要)
- 至少安装了一个编码代理CLI(
claude或codex)
首次运行
# Initialize — detects installed agents, sets defaults, installs agent skills
beat init
# Orchestrate -fire and forget
beat orchestrate "Add real-time collaborative editing to the document editor"
# Or run a single task in the foreground
beat run "Fix the failing test in parser.test.ts" -f
编排模式
旗舰。一个命令,自主执行。
# Detached (default) -runs in the background
beat orchestrate "Set up a GraphQL API with subscriptions, pagination, and integration tests"
# Foreground -blocks and shows progress, Ctrl+C cancels
beat orchestrate "Migrate the database schema" --foreground
# Interactive -foreground TTY session with live output
beat orchestrate -i "Build the auth system"
# With options
beat orchestrate "Redesign the dashboard" \
--agent claude \
--max-workers 5 \
--max-iterations 50 \
--max-depth 3 \
--system-prompt "Use functional patterns, no classes"
自定义编排器
使用状态文件、退出条件和系统提示构建自定义编排器:
beat orchestrate init "Migrate payments to microservice"
监控和控制
beat orchestrate status <id> # Plan, steps, iteration count
beat orchestrate list # All orchestrations
beat orchestrate cancel <id> # Stop gracefully
Eval循环
编码代理的Karpathy循环。运行一个任务,评估结果,迭代直到达到最优。
重试策略 -运行直到条件通过:
beat loop "Fix the failing tests" --until "npm test"
优化策略 -得分输出,寻求最佳结果:
beat loop "Optimize the bundle size" \
--eval "node measure-bundle.js" \
--direction minimize \
--max-iterations 10
代理评估 -让AI来判断结果,而不是shell命令:
beat loop "Fix the failing tests" --eval-mode agent --strategy retry
beat loop "Optimize the algorithm" --eval-mode agent --strategy optimize --maximize \
--eval-prompt "Score the solution on correctness and efficiency (0-100)"
管道回路 -重复多步骤工作流:
beat loop "Implement and verify the feature" \
--pipeline \
--step "Implement the changes" \
--step "Run the test suite" \
--step "Fix any failures" \
--until "npm test"
默认情况下,每次迭代都从新的上下文开始。该循环跟踪最佳结果,恢复故障,并在满足退出条件或达到安全限制时停止。
任务分配
生成具有依赖关系排序的背景编码代理:
# Fire and forget
beat run "npm run build" --priority P1
# → task-abc123
# Chain with dependencies
beat run "npm test" --deps task-abc123
beat run "npm run deploy" --deps task-def456
# Execution: build → test → deploy
会话继续 通过链传递输出上下文:
const build = await DelegateTask({ prompt: "npm run build" });
const test = await DelegateTask({
prompt: "npm test",
dependsOn: [build.taskId],
continueFrom: build.taskId // receives build's checkpoint context
});
多代理管道
跨不同代理的链式步骤。在cron上安排它们。
# Sequential pipeline
beat pipeline "Design the API schema" \
--step "Implement the endpoints" \
--step "Write integration tests" \
--step "Review for security issues"
# Scheduled pipeline -runs every day at 2am
beat schedule create "Run nightly checks" \
--cron "0 2 * * *" \
--pipeline \
--step "Run the full test suite" \
--step "Check for security vulnerabilities" \
--step "Generate coverage report"
每个步骤都可以使用不同的代理、工作目录和优先级。
调度
# Cron schedule
beat schedule create "Backup the database" --cron "0 2 * * *" --timezone "America/New_York"
# One-time schedule
beat schedule create "Deploy to production" --at "2026-04-01T08:00:00Z"
# Manage
beat schedule list
beat schedule pause <id>
beat schedule resume <id>
beat schedule cancel <id>
代理配置
支持两种代理运行时: 克劳德 和 法典两者均支持 奥拉玛 用于本地LLM执行。每个代理都可以配置一个API密钥、基本URL、默认模型、代理和运行时。
beat agents list # Show available agents
beat agents check # Auth status for all agents
API密钥
默认情况下代理使用基于CLI登录的身份验证(例如。, claude login).要使用您自己的API密钥,请执行以下操作:
beat agents config set claude apiKey "sk-ant-your-key"
beat agents config set codex apiKey "sk-your-openai-key"
身份验证解析顺序: 环境变量 > 存储配置 > CLI登录.
| 代理 | 环境变量(最高优先级) |
|---|---|
| 克劳德 | ANTHROPIC_API_KEY |
| 法典 | OPENAI_API_KEY |
模型选择
为每个代理设置默认模型,或为每个任务覆盖:
# Default model for all Claude tasks
beat agents config set claude model "claude-sonnet-4-5-20250514"
# Override per task
beat run "Fix the tests" --agent claude --model "claude-sonnet-4-5-20250514"
beat orchestrate "Refactor auth" --agent claude --model "claude-sonnet-4-5-20250514"
解决顺序: 每项任务 --model > 代理配置模型 > CLI默认值.
自定义基本URL
通过代理、网关或本地端点路由请求:
beat agents config set claude baseUrl "https://my-proxy.example.com/v1"
beat agents config set codex baseUrl "http://localhost:8080/v1"
或者通过环境变量(优先于配置):
特工是Env。
|-------|---------|
|克劳德| ANTHROPIC_BASE_URL |
|法典| OPENAI_BASE_URL |
备注:Claude的基于登录的身份验证不适用于自定义 baseUrl --您还必须设置 apiKey。如果发生以下情况,Autobeat会发出警告 baseUrl 没有设置。
API翻译代理
在任何与OpenAI兼容的后端(OpenRouter、Together、vLLM等)上运行Claude目标代理。代理将Anthropic消息API透明地转换为OpenAI聊天完成格式。
beat agents config set claude proxy openai
beat agents config set claude baseUrl "https://openrouter.ai/api/v1"
beat agents config set claude apiKey "sk-or-your-key"
Ollama运行时
包裹剂产卵 ollama launch 用于本地LLM执行。运行时与代理一起管理Ollama流程生命周期。
beat agents config set claude runtime ollama
beat agents config set claude model "llama3:8b"
代理和运行时是互斥的——设置一个会清除另一个。
使用本地LLM
大多数本地推理服务器(Ollama、llama.cpp、vLLM、LM Studio)都公开了与OpenAI兼容的API。将codex代理指向本地服务器:
beat agents config set codex baseUrl "http://localhost:11434/v1"
beat agents config set codex apiKey "any-string"
beat agents config set codex model "llama3"
beat run --agent codex "Refactor the utils module"
管理配置
beat agents config show # Show all agent configs
beat agents config show claude # Show config for one agent
beat agents config reset claude # Clear all stored config for an agent
配置存储在 ~/.autobeat/config.json.
所有MCP工具
| 工具 | 它做什么 |
|---|---|
| 创建编排器 | 员工管理下的自主目标执行 |
| 编排器状态 | 编排计划、步骤和迭代状态 |
| 列表编排器 | 列出带有状态过滤器的业务流程 |
| 取消编排器 | 取消编排及其工作进程 |
| InitCustomOrchestrator | 构建自定义编排器(状态文件、退出条件、系统提示) |
| 委托任务 | 生成背景编码代理 |
| 任务状态 | 实时任务状态 |
| 任务日志 | 执行日志 |
| 取消任务 | 取消并清理 |
| 重试任务 | 重试任务 |
| 简历任务 | 从检查点恢复 |
| CreateLoop | 迭代评估循环(重试或优化) |
| 循环状态 | 循环细节和迭代历史 |
| ListLoops | 带有状态过滤器的列表循环 |
| 取消循环 | 取消循环 |
| 编辑 / 简历循环 | 暂停和恢复循环 |
| 调度循环 | 安排一个循环 |
| CreatePipeline | 顺序多步流水线 |
| 管道状态 | 管道细节和步骤进度 |
| 列表管道 | 列出带有状态过滤器的管道 |
| 取消管道 | 取消管道及其正在进行的任务 |
| 计划任务 | Cron或一次性任务计划 |
| 进度管道 | 预定管道 |
| 列表时间表 / 进度状态 | 进度管理 |
| 暂停时间表 / 简历时间表 | 计划生命周期 |
| 取消日程安排 | 取消日程安排和可选的飞行任务 |
| 列表代理 | 列出具有身份验证状态和配置的代理 |
| 配置代理 | 检查、设置或重置代理配置(apiKey、baseUrl、模型、代理、运行时) |
所有CLI命令
beat orchestrate <goal> [options] Autonomous orchestration (detached)
beat orchestrate <goal> -f Foreground orchestration
beat orchestrate -i <goal> Interactive TTY session
beat orchestrate init <goal> Scaffold custom orchestrator
beat orchestrate status <id> Orchestration details
beat orchestrate list List orchestrations
beat orchestrate cancel <id> Cancel orchestration
beat run <prompt> [options] Single task (detached or -f foreground)
beat list List tasks
beat status [id] Task status
beat logs <id> Task logs
beat cancel <id> Cancel task
beat retry <id> Retry task
beat resume <id> Resume from checkpoint
beat loop <prompt> --until <cmd> Retry loop
beat loop <prompt> --eval <cmd> Optimize loop
beat loop list List loops
beat loop status <id> Loop details
beat loop pause <id> Pause loop
beat loop resume <id> Resume loop
beat loop cancel <id> Cancel loop
beat schedule create <prompt> Create schedule
beat schedule list List schedules
beat schedule status <id> Schedule details
beat schedule pause/resume/cancel Schedule lifecycle
beat pipeline <prompt> --step ... Create pipeline
beat agents list List available agents
beat agents check Auth status for all agents
beat agents config show [agent] Show agent config
beat agents config set <agent> <key> <value> Set agent config
beat agents config reset <agent> Clear agent config
beat dashboard Interactive terminal dashboard
beat init Interactive setup
beat config show|set|reset|path Configuration
beat help Help
配置
配置优先级: 环境变量>配置文件>默认值.
beat config show # Show resolved config
beat config set timeout 300000 # Set a value
beat config reset timeout # Revert to default
| 变量 | 默认值 | 描述 |
|---|---|---|
TASK_TIMEOUT |
1800000(30分钟) | 任务超时(毫秒) |
MAX_OUTPUT_BUFFER |
10485760(10MB) | 输出缓冲区大小 |
CPU_CORES_RESERVED |
2 | 系统预留CPU核 |
MEMORY_RESERVE |
2684354560(2.5GB) | 内存保留(以字节为单位) |
LOG_LEVEL |
info | 记录详细信息 |
建筑
事件驱动系统,具有自动伸缩的workers和SQLite持久性。组件通过中央EventBus与专门的处理程序进行通信。
任务生命周期: Queued → Running → Completed / Failed / Cancelled
两个代理运行时:Claude和Codex,都有Ollama对当地LLM的支持。API翻译代理启用跨平台代理执行。按任务选择代理。故障恢复功能可在重新启动时恢复所有飞行中的工作。
看 架构文档 了解详情。
发展
npm run dev # Development mode with auto-reload
npm run build # Build TypeScript
npm run test:core # Core tests (~3s)
npm run test:all # Full suite (3,600+ tests)
看 功能.md 查看完整的功能列表和 ROADMAP.md 接下来是什么。
许可证
麻省理工学院
支持
- 问题: GitHub问题
- 与 模型上下文协议SDK
