把 coding agent 的 5 個回合合併成 1 個 Macro 工作流程
先說明:我是開源專案 Tura 的維護者。
給開發 coding agent 的人一個很簡單的想法:不要讓模型在可預測的每一步都重新醒來。
一般工具呼叫會變成 5 個 LLM 回合:
Turn 1 — 檢查
rg -n "TODO|command_run|handler" crates/
rg --files crates/runtime/src crates/tools/src
Turn 2 — 套用 patch
- // old command handler logic
+ // patched command handler logic
Turn 3 — 建置
cargo build -p runtime
Turn 4 — 測試
cargo test -p runtime --lib
Turn 5 — lint
cargo clippy -p runtime --all-targets
真正的額外成本,不只是這些命令,而是模型醒來 5 次,並且每次都要重新讀取越來越長的對話。
Tura 提供一個叫 command_run 的 Macro 工具。Agent 可以一次送出同一個工作流程:
{
"name": "command_run",
"arguments": {
"commands": [
{ "step": 1, "command_type": "shell_command", "command_line": "inspect files" },
{ "step": 2, "command_type": "apply_patch", "command_line": "apply patch" },
{ "step": 3, "command_type": "shell_command", "command_line": "cargo build -p runtime" },
{ "step": 4, "command_type": "shell_command", "command_line": "cargo test -p runtime --lib" },
{ "step": 4, "command_type": "shell_command", "command_line": "cargo clippy -p runtime --all-targets" }
]
}
}
建置、測試與 lint 都還是會執行,只是不需要在可預測的步驟之間再次呼叫 LLM。
在完整 DeepSWE 比較中,Balanced 比 Codex CLI 少 35.8% 回合、少 31.1% Token;Direct 少 69.1% 回合、少 77.5% Token。接近 80% 是這次 benchmark 的結果,不是每個任務的保證。
GitHub: github.com/Tura-AI/t...
Benchmark: turaai.net/benchmark
喜欢我的作品吗?别忘了给予支持与赞赏,让我知道在创作的路上有你陪伴,一起延续这份热忱!
- 来自作者