GoForum🌐 V2EX

coding agent 的 5 个回合 vs 1 次 command_run:完整例子

yohjisakamoto · 2026-08-04 05:09 · 0 次点赞 · 0 条回复

先说明:我是开源项目 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": "rg -n \"TODO|command_run|handler\" crates/" },

{ “step”: 1, “command_type”: “shell_command”, “command_line”: “rg –files crates/runtime/src crates/tools/src” },

  { "step": 2, "command_type": "apply_patch", "command_line": "*** Begin Patch\n*** Update File: crates/tools/src/command_run/handler.rs\n@@\n-    // old command handler logic\n+    // patched command handler logic\n*** End 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: https://github.com/Tura-AI/tura

Benchmark: https://turaai.net/benchmark

0 条回复
添加回复
你还需要 登录 后发表回复

登录后可发帖和回复

登录 注册
主题信息
作者: yohjisakamoto
发布: 2026-08-04
点赞: 0
回复: 0