子代理实战:用 `sessions_spawn` 内联附件把文件安全下发给隔离会话
问题/场景:需要把日志、配置片段、截图交给子代理处理,但不想手动落盘和暴露明文。前置条件:仅隔离子代理运行支持附件,且 `tools.sessions_spawn.attachments` 已配置额度。实施步骤:在 spawn 请求携带 base64/utf8 附件 → 子代理按回执路径读取 → 输出结果后自动清理。关键命令/配置:`sessions_spawn` + `tools.sessions_spawn.attachments`。验证方法:子代理可稳定读取附件,主会话 transcript 不泄露原文。风险与边界:超额文件或非法编码会被拒绝。来源归因:v2026.3.2-beta.1 Release Notes。
GITHUBDiscovered 2026-03-04Author openclaw
Prerequisites
- Isolated sub-agent runtime is enabled for `sessions_spawn`.
- Attachment limits are configured via `tools.sessions_spawn.attachments`.
Steps
- Prepare the file payload in utf8 or base64 with explicit filename and MIME metadata.
- Call `sessions_spawn` with attachment list and task instructions referencing those files.
- Inside sub-agent, read files from the provided attachment context instead of external paths.
- Capture result summary and only return distilled output to parent session.
- Confirm cleanup policy removed temporary files after run completion.
Commands
openclaw gateway statusopenclaw helpVerify
Attachment-backed subagent task completes, reads expected files, and leaves no leaked raw payload in transcript.
Caveats
- Large binary blobs may hit size limits; split or pre-filter before upload.
- Attachment availability in non-isolated runtimes is not guaranteed(需验证).
Source attribution
This tip is aggregated from community/public sources and preserved with attribution.
Open original source ↗