• 请不要在回答技术问题时复制粘贴 AI 生成的内容
yohjisakamoto
V2EX  ›  程序员

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

  •  
  •   yohjisakamoto · 4h 14m ago · 316 views
    先说明:我是开源项目 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
    No Comments Yet
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   5468 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 35ms · UTC 01:20 · PVG 09:20 · LAX 18:20 · JFK 21:20
    ♥ Do have faith in what you're doing.