← 返回
开发者工具 中文

ACP Background Runs

Route requests for ACP or external coding agents such as Codex, Claude Code, Gemini CLI, and OpenCode into non-blocking OpenClaw background ACP runs instead...
将ACP或外部编码代理(如Codex、Claude Code、Gemini CLI、OpenCode)的请求路由至非阻塞的OpenClaw后台ACP运行...
ambition0802
开发者工具 clawhub v0.1.2 1 版本 99857.5 Key: 无需
★ 1
Stars
📥 681
下载
💾 8
安装
1
版本
#latest

概述

ACP / Codex Background Runs

When a user asks to use ACP or an external coding agent such as Codex, Claude Code, Gemini CLI, or OpenCode, do not execute the task synchronously in the current chat. Route it through the ACP runtime instead.

Default Rules

  • Prefer sessions_spawn and set runtime: "acp" with the appropriate agentId
  • Default to mode: "run"
  • Only use thread: true or mode: "session" when the user explicitly asks for an ongoing interactive or thread-bound session
  • Set cwd when the target repository or directory is known
  • Prefer absolute paths for cwd; do not pass ~ directly, expand it first
  • Use a relaxed runTimeoutSeconds for longer tasks; do not mechanically default to 300
  • Do not wait in the current conversation and do not poll for progress
  • Reply immediately after submission that the task has been accepted and is running in the background
  • Rely on sessions_spawn completion notifications to send the final result back to the current conversation
  • Only add streamTo: "parent" when the user explicitly asks for progress updates

Default Handling

If the user is simply dispatching an ACP / Codex task and does not explicitly request a persistent interactive session, treat it as a one-shot background run. Do not block the current conversation. Send the result back only when the background run completes.

Timeout Guidance

  • Quick read-only checks, short analysis, light tasks: runTimeoutSeconds: 120-300
  • Normal coding tasks, project inspection, small scoped edits: runTimeoutSeconds: 600
  • Research, code changes, file generation, test runs, longer reports: runTimeoutSeconds: 1200
  • Clearly long-running tasks: increase further to 1800-3600 as needed
  • Do not default to 0; only use 0 when the user explicitly wants no timeout

mode / thread Decision Rules

  • If the user only wants the external agent to finish a task in the background, use mode: "run"
  • If the user explicitly wants to continue talking to the same external-agent context afterward, use thread: true
  • If the user explicitly asks for a persistent session, thread session, or long-lived context, use both thread: true and mode: "session"
  • If there is no explicit need for ongoing interaction, do not open mode: "session"

cwd Rules

  • If the target repository, project directory, or work directory is known, set cwd
  • Prefer absolute paths
  • Expand ~ before passing the path into sessions_spawn
  • If the user did not give a directory but the task clearly targets a known repo, resolve the actual path from context before spawning

Fallback When ACP Is Unavailable

  • Try runtime: "acp" first
  • Only fall back to runtime: "subagent" when the ACP target agentId is clearly unavailable, unconfigured, or ACP cannot be used in the current environment
  • When falling back, tell the user explicitly that the task is being run via subagent, not a native ACP session
  • Do not silently fall back

Reply After Submission

Use this short confirmation by default:

Task accepted. It is running in the background and will report back here when complete.

If streamTo: "parent" is enabled, also say that key progress updates will be streamed back.

Prohibited Actions

  • Do not execute external coding-agent tasks synchronously in the current conversation when they should go through ACP
  • Do not poll after submission
  • Do not call sessions_list, sessions_history, or similar tools to track child-session progress
  • Do not use sleep or timer-based waiting to fake background orchestration
  • Rely on the sessions_spawn completion / announce mechanism for the final result

Recommended Parameter Template

{
  "task": "<user request>",
  "runtime": "acp",
  "agentId": "<codex|claude|gemini|opencode|...>",
  "mode": "run",
  "cwd": "/abs/path/if-known",
  "runTimeoutSeconds": 300
}

When To Adjust

  • Need ongoing multi-turn context: add thread: true and, if needed, mode: "session"
  • Task may run for many minutes: increase runTimeoutSeconds
  • Task is only a quick read-only check: keep runTimeoutSeconds small
  • User explicitly wants progress relayed back: add streamTo: "parent"
  • ACP is unavailable but the task should still run in the background: explain the fallback and use runtime: "subagent"

版本历史

共 1 个版本

  • v0.1.2 当前
    2026-03-29 16:10 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

developer-tools

Github

steipete
使用 `gh` CLI 与 GitHub 交互,通过 `gh issue`、`gh pr`、`gh run` 和 `gh api` 管理议题、PR、CI 运行及高级查询。
★ 672 📥 324,555

research-summary

ambition0802
英文卖方研报/行业报告转中文投研快讯。适合科技股、互联网、半导体赛道。 当用户提到"研报"、"研报总结"、"卖方报告"、"投行分析"、"research report"、"analyst"、"180k"、"投研快讯"、"预期差摘要"时激活。
★ 0 📥 407
developer-tools

CodeConductor.ai

larsonreever
AI驱动平台,提供快速全栈开发、智能体、工作流自动化及低代码AI集成的可扩展产品创建。
★ 68 📥 180,499