OOO
新增: /ooo 子agnet委托
为了防止 Home Assistant 的核心 LLM 在面对重度推理、多步诊断或长时间计算任务时发生线程阻塞或上下文溢出,本版本正式引入 /ooo (Out of Office) 异步多智能体委托系统。
该系统不再强制要求主会话智能体阻塞等待或承受上下文窗口超限的压力,而是通过并发启动相互解耦的子智能体(Subagents),在完全隔离的沙盒环境中运行。
工作流示例
- 任务分发:发送以
/ooo开头的复杂任务指令。例如:/ooo 分析客厅与主卧近一月的温湿度关联性,并给出节能自动化建议。 - 非阻塞启动:主智能体立即调用
DelegateTask工具,生成全局唯一的task_id并异步启动子智能体。 - 主智能体释放:主智能体在 1 秒内向用户返回
task_id,继续保持交互状态,随时准备处理后续的其他请求。 - 沙盒隔离运行:子智能体在完全独立的会话上下文(独立的
conversation_id)中运行,避免中间步骤的工具调用与冗长日志污染主会话的上下文窗口。 - 双向问答闭环:若子智能体在执行过程中遇到模糊参数或缺失变量,会通过
DelegateAskParent工具向主智能体发起提问。主智能体通过DelegateGetPendingQuestions捕获问题并向用户澄清,随后通过 [answer_subagent_question] 函数将答案回传给子智能体,实现双向通信闭环。
AI OOO核心委托工具集
- DelegateTask:异步启动单个子智能体,非阻塞秒回
task_id,支持自定义timeout_seconds和上下文context动态注入。 - DelegateBatch:通过并发信号量控制,并行启动多个子智能体进行矩阵级协同计算。
- DelegateStatus:查询活跃中或已完成的子智能体状态及最终摘要。传入
include_logs=true可查看详细、分步骤的后台搬砖进度轨迹。 - DelegateAskParent:供子智能体调用,暂停执行并向主对话(父代理)申请场外援助与数据澄清。
- DelegateGetPendingQuestions:供父代理全局扫描,捞出子智能体当前的待回答问题列表。
修复:
-
工具死循环拦截器 (Tool Execution Guard):,中集成了调用签名追踪机制。若智能体尝试以完全相同的参数连续重复调用同一工具,系统将自动拦截并触发
TOOL_REPEAT_WARNING,达到限制次数后直接强制终止该工具执行,防止产生无限循环、消耗系统 CPU 及 API 额度。 -
单轮对话状态重置 (Per-Turn State Reset):在 中引入
reset_execution_control_for_turn。每当新一轮用户对话开始时,thought 计数、step 计数以及临时的 tool_usage 调用链都会被安全重置。这确保了智能体在每一轮对话开始时都处于纯净、无污染的状态控制下,同时完美保留了聊天历史记录。 -
语义级安全隔离 (ReadFile 重命名):将原有的
ReadFile工具重命名为ReadRuntimeArtifact。这进一步在语义上限定了智能体只能访问特定的运行时临时日志和工件产物,严禁其尝试越权读取.storage/claw_assistant/workspace/下的敏感配置文件与工作区文档。 -
1200秒超长超时与心跳机制:将子智能体的最长存活时间从 300 秒延长至 1200 秒(20 分钟)以支持超重任务。支持在启动时动态传入
timeout_seconds自定义超时。此外,子智能体在执行期间每 30 秒会向 Home Assistant 事件总线(claw_subagent_progress)发送心跳,报告运行状态与已执行的工具计数。
Add: /ooo Async Delegation System
To prevent Home Assistant's core LLM from blocking during heavy reasoning, multi-step diagnostics, or long-running computations, this release officially introduces the /ooo (Out of Office) Async Multi-Agent Delegation System.
Instead of forcing the master conversation agent to block or run out of context window limits, the delegation system spawns decoupled subagents to run concurrently in fully isolated sandbox environments.
Workflow Example
- Task Dispatch: Send a complex task instruction prefixed with
/ooo. For example:/ooo Analyze the temperature and humidity correlation between the living room and master bedroom over the past month, and provide energy-saving automation suggestions. - Non-blocking Spawning: The master agent immediately calls the
DelegateTasktool, which generates a uniquetask_idand starts the subagent asynchronously. - Master Agent Released: The master agent returns the
task_idto the user in less than a second, remaining fully interactive and ready to handle subsequent requests. - Isolated Sandboxing: The subagent runs in a fully isolated context with a separate
conversation_id, preventing intermediate logs and tool calls from flooding the master conversation. - Bidirectional Q&A: If the subagent encounters ambiguous parameters or missing variables during execution, it uses
DelegateAskParentto ask a question. The master agent queries these viaDelegateGetPendingQuestions, prompts the user for clarification, and pipes the answer back to the subagent using theanswer_subagent_questionfunction, closing the loop.
AI OOO Core Delegation Tools
- DelegateTask: Spawns a single async subagent. Returns
task_idand statusspawnedimmediately. Supports customizabletimeout_secondsandcontextinjection. - DelegateBatch: Spawns multiple subagents in parallel with concurrency semaphore control for matrix-level parallel calculations.
- DelegateStatus: Queries the status and final summaries of active or recently completed subagents. Supports
include_logs=trueandlog_limitto return detailed, step-by-step progress history. - DelegateAskParent: Used by subagents to pause execution and request clarification or additional variables from the master conversation.
- DelegateGetPendingQuestions: Used by the parent agent to query unanswered questions originating from active subagents.
Fixed:
-
Tool Execution Guard: Integrated a call-signature tracking guard in
@/Users/knoopnu/core/config/custom_components/claw_assistant/runtime/agent/loop_controller.pyand@/Users/knoopnu/core/config/custom_components/claw_assistant/runtime/llm/internal_llm.py. If an agent attempts to execute a tool with identical parameters consecutively, the system intercepts the execution, registers aTOOL_REPEAT_WARNING, and blocks further attempts if limits are exceeded. This safeguards system CPU and API budget from runaway agent loops. -
Per-Turn State Reset: Introduced
reset_execution_control_for_turnin@/Users/knoopnu/core/config/custom_components/claw_assistant/runtime/agent/loop_controller.py. Every time a new user turn is registered, the step count, thought count, and temporary tool usage logs are reset. This ensures the agent begins each turn with pristine state controls while preserving chat history. -
Semantic Security Isolation (ReadFile rename): Renamed the original
ReadFiletool toReadRuntimeArtifactin@/Users/knoopnu/core/config/custom_components/claw_assistant/tools/registry.py. This restricts LLM disk access to specific runtime logs and temporary artifacts, preventing subagents or the master agent from attempting unauthorized reads on sensitive directory configurations or workspace documents under.storage/claw_assistant/workspace/. -
1200-Second Super Timeout and Heartbeats: Subagent survival limits extended from 300 seconds to 1200 seconds (20 minutes) to support high-latency tasks. Supports specifying
timeout_secondsper task dynamically. Additionally, subagents emit heartbeats every 30 seconds to the Home Assistant event bus asclaw_subagent_progressto report alive status and tool execution counts.
Full Changelog: v8.8.0...v8.9.0