agents.*、multiAgent.*、session.*、messages.* 和 talk.* 下的代理作用域配置键。关于通道、工具、网关运行时以及其他顶级键,请参见 配置参考。
代理默认值
agents.defaults.workspace
默认值:设置了 OPENCLAW_WORKSPACE_DIR 时使用该值,否则使用 ~/.openclaw/workspace。
agents.defaults.workspace 值优先于
OPENCLAW_WORKSPACE_DIR。当你不想把该路径写入配置时,可使用环境变量将默认代理指向已挂载的工作区。
agents.defaults.repoRoot
可选的仓库根目录,会显示在系统提示词的 Runtime 行中。若未设置,OpenClaw 会从工作区向上遍历自动检测。
agents.defaults.skills
可选的默认技能白名单,适用于未设置 agents.list[].skills 的代理。
- 默认情况下省略
agents.defaults.skills,则不限制技能。 - 省略
agents.list[].skills可继承默认值。 - 将
agents.list[].skills设为[]表示没有技能。 - 非空的
agents.list[].skills列表就是该代理的最终技能集合;它不会与默认值合并。
agents.defaults.skipBootstrap
禁用自动创建工作区引导文件(AGENTS.md、SOUL.md、TOOLS.md、IDENTITY.md、USER.md、HEARTBEAT.md、BOOTSTRAP.md)。
agents.defaults.skipOptionalBootstrapFiles
在仍会写入必需引导文件的同时,跳过创建选定的可选工作区文件。有效值:SOUL.md、USER.md、HEARTBEAT.md 和 IDENTITY.md。
agents.defaults.contextInjection
控制工作区引导文件何时注入到系统提示词中。默认值:"always"。
"continuation-skip":安全的续接轮次(在完成一次助手回复之后)会跳过工作区引导的重新注入,从而减小提示词大小。心跳运行和压缩后重试仍会重建上下文。"never":在每一轮都禁用工作区引导和上下文文件注入。仅适用于完全自行管理提示词生命周期的代理(自定义上下文引擎、自己构建上下文的原生运行时,或专门的无引导工作流)。心跳和压缩恢复轮次也会跳过注入。
agents.list[].contextInjection。省略的值会继承
agents.defaults.contextInjection。
agents.defaults.bootstrapMaxChars
Max characters per workspace bootstrap file before truncation. Default: 20000.
agents.list[].bootstrapMaxChars。省略的值会继承
agents.defaults.bootstrapMaxChars。
agents.defaults.bootstrapTotalMaxChars
跨所有工作区引导文件注入的最大总字符数。默认值:60000。
agents.list[].bootstrapTotalMaxChars。省略的值会
继承 agents.defaults.bootstrapTotalMaxChars。
逐代理引导配置文件覆盖
当某个代理需要与共享默认值不同的提示词注入行为时,可使用逐代理引导配置文件覆盖。省略的字段会继承自agents.defaults。
agents.defaults.bootstrapPromptTruncationWarning
控制当引导上下文被截断时,代理可见的系统提示词通知。
默认值:"always"。
"off":从不向系统提示词注入截断通知文本。"once":针对每个唯一的截断特征注入一次简洁通知。"always":只要存在截断,就在每次运行时注入简洁通知(推荐)。
上下文预算所有权映射
OpenClaw 具有多个高容量的提示词/上下文预算,它们被有意按子系统拆分,而不是全部通过一个通用开关流转。agents.defaults.bootstrapMaxChars/agents.defaults.bootstrapTotalMaxChars: 正常的工作区引导注入。agents.defaults.startupContext.*: 一次性的重置/启动模型运行前奏,包括最近的每日memory/*.md文件。裸聊天/new和/reset命令会被确认,但不会调用模型。skills.limits.*: 注入系统提示词中的紧凑技能列表。agents.defaults.contextLimits.*: 有边界的运行时摘录和注入的运行时拥有块。memory.qmd.limits.*: 索引化的记忆搜索片段和注入大小。
agents.list[].skillsLimits.maxSkillsPromptCharsagents.list[].contextInjectionagents.list[].bootstrapMaxCharsagents.list[].bootstrapTotalMaxCharsagents.list[].contextLimits.*
agents.defaults.startupContext
控制在重置/启动模型运行时注入的首轮启动前奏。裸聊天 /new 和 /reset 命令会在不调用模型的情况下确认重置,因此不会加载这段前奏。
agents.defaults.contextLimits
有边界的运行时上下文表面的共享默认值。
memoryGetMaxChars:memory_get摘录截断前的默认上限,之后会添加元数据和续接通知。memoryGetDefaultLines:省略lines时memory_get的默认行窗口。toolResultMaxChars:用于持久化结果和溢出恢复的高级实时工具结果上限。若不设置,则使用模型上下文自动上限:低于 100K tokens 时为16000字符,100K+ tokens 时为32000字符,200K+ tokens 时为64000字符。有效上限仍限制在模型上下文窗口的大约 30% 以内。openclaw doctor --deep会打印有效上限,而 doctor 只会在显式覆盖已过期或不生效时发出警告。postCompactionMaxChars:用于压缩后刷新注入的 AGENTS.md 摘录上限。
agents.list[].contextLimits
针对共享 contextLimits 开关的逐代理覆盖。省略的字段会继承自 agents.defaults.contextLimits。
skills.limits.maxSkillsPromptChars
注入系统提示词中的紧凑技能列表的全局上限。这不会影响按需读取 SKILL.md 文件。
agents.list[].skillsLimits.maxSkillsPromptChars
针对技能提示词预算的逐代理覆盖。
agents.defaults.imageMaxDimensionPx
传递给提供方调用前,转录/工具图像块中最长边的最大像素尺寸。默认值:1200。
更低的值通常能减少视觉 token 用量,以及对截图密集型运行的请求载荷大小。
更高的值会保留更多视觉细节。
agents.defaults.imageQuality
从文件路径、URL 和媒体引用加载的图片的图像工具压缩/细节偏好。
默认值:auto。
OpenClaw adapts the resize ladder to the selected image model. For example, Claude Opus 4.8, OpenAI GPT-5.5, Qwen VL, and hosted Llama 4 vision models can use larger images than older/default high-detail vision paths, while multi-image turns are compressed more aggressively in auto mode to control token and latency cost.
可选值:
auto:根据模型限制和图像数量自适应。efficient:优先更小的图像,以降低 token 和字节使用量。balanced:使用标准的中间梯度。high:为截图、图表和文档图像保留更多细节。
agents.defaults.userTimezone
系统提示词上下文使用的时区(不是消息时间戳)。回退到宿主机时区。
agents.defaults.timeFormat
系统提示词中的时间格式。默认值:auto(操作系统偏好)。
agents.defaults.model
model: accepts either a string ("provider/model") or an object ({ primary, fallbacks }).- String form sets only the primary model.
- Object form sets primary plus ordered failover models.
imageModel: accepts either a string ("provider/model") or an object ({ primary, fallbacks }).- Used by the
imagetool path as its vision-model config. - Also used as fallback routing when the selected/default model cannot accept image input.
- Prefer explicit
provider/modelrefs. Bare IDs are accepted for compatibility; if a bare ID uniquely matches a configured image-capable entry inmodels.providers.*.models, OpenClaw qualifies it to that provider. Ambiguous configured matches require an explicit provider prefix.
- Used by the
imageGenerationModel: accepts either a string ("provider/model") or an object ({ primary, fallbacks }).- Used by the shared image-generation capability and any future tool/plugin surface that generates images.
- Typical values:
google/gemini-3.1-flash-image-previewfor native Gemini image generation,fal/fal-ai/flux/devfor fal,openai/gpt-image-2for OpenAI Images, oropenai/gpt-image-1.5for transparent-background OpenAI PNG/WebP output. - If you select a provider/model directly, configure matching provider auth too (for example
GEMINI_API_KEYorGOOGLE_API_KEYforgoogle/*,OPENAI_API_KEYor OpenAI Codex OAuth foropenai/gpt-image-2/openai/gpt-image-1.5,FAL_KEYforfal/*). - If omitted,
image_generatecan still infer an auth-backed provider default. It tries the current default provider first, then the remaining registered image-generation providers in provider-id order.
musicGenerationModel: accepts either a string ("provider/model") or an object ({ primary, fallbacks }).- Used by the shared music-generation capability and the built-in
music_generatetool. - Typical values:
google/lyria-3-clip-preview,google/lyria-3-pro-preview, orminimax/music-2.6. - If omitted,
music_generatecan still infer an auth-backed provider default. It tries the current default provider first, then the remaining registered music-generation providers in provider-id order. - If you select a provider/model directly, configure the matching provider auth/API key too.
- Used by the shared music-generation capability and the built-in
videoGenerationModel: accepts either a string ("provider/model") or an object ({ primary, fallbacks }).- Used by the shared video-generation capability and the built-in
video_generatetool. - Typical values:
qwen/wan2.6-t2v,qwen/wan2.6-i2v,qwen/wan2.6-r2v,qwen/wan2.6-r2v-flash, orqwen/wan2.7-r2v. - If omitted,
video_generatecan still infer an auth-backed provider default. It tries the current default provider first, then the remaining registered video-generation providers in provider-id order. - If you select a provider/model directly, configure the matching provider auth/API key too.
- The bundled Qwen video-generation provider supports up to 1 output video, 1 input image, 4 input videos, 10 seconds duration, and provider-level
size,aspectRatio,resolution,audio, andwatermarkoptions.
- Used by the shared video-generation capability and the built-in
pdfModel: accepts either a string ("provider/model") or an object ({ primary, fallbacks }).- Used by the
pdftool for model routing. - If omitted, the PDF tool falls back to
imageModel, then to the resolved session/default model.
- Used by the
pdfMaxBytesMb: default PDF size limit for thepdftool whenmaxBytesMbis not passed at call time.pdfMaxPages: default maximum pages considered by extraction fallback mode in thepdftool.verboseDefault: default verbose level for agents. Values:"off","on","full". Default:"off".toolProgressDetail: detail mode for/verbosetool summaries and progress-draft tool lines. Values:"explain"(default, compact human labels) or"raw"(append raw command/detail when available). Per-agentagents.list[].toolProgressDetailoverrides this default.reasoningDefault: default reasoning visibility for agents. Values:"off","on","stream". Per-agentagents.list[].reasoningDefaultoverrides this default. Configured reasoning defaults are only applied for owners, authorized senders, or operator-admin gateway contexts when no per-message or session reasoning override is set.elevatedDefault: default elevated-output level for agents. Values:"off","on","ask","full". Default:"on".model.primary: formatprovider/model(e.g.openai/gpt-5.5for OpenAI API-key or Codex OAuth access). If you omit the provider, OpenClaw tries an alias first, then a unique configured-provider match for that exact model id, and only then falls back to the configured default provider (deprecated compatibility behavior, so prefer explicitprovider/model). If that provider no longer exposes the configured default model, OpenClaw falls back to the first configured provider/model instead of surfacing a stale removed-provider default.models: the configured model catalog and allowlist for/model. Each entry can includealias(shortcut) andparams(provider-specific, for exampletemperature,maxTokens,cacheRetention,context1m,responsesServerCompaction,responsesCompactThreshold, OpenRouterproviderrouting,chat_template_kwargs,extra_body/extraBody).- Use
provider/*entries such as"openai/*": {}or"vllm/*": {}to show all discovered models for selected providers without manually listing every model id. - Add
agentRuntimeto aprovider/*entry when every dynamically discovered model for that provider should use the same runtime. Exactprovider/modelruntime policy still wins over the wildcard. - Safe edits: use
openclaw config set agents.defaults.models '<json>' --strict-json --mergeto add entries.config setrefuses replacements that would remove existing allowlist entries unless you pass--replace. - Provider-scoped configure/onboarding flows merge selected provider models into this map and preserve unrelated providers already configured.
- For direct OpenAI Responses models, server-side compaction is enabled automatically. Use
params.responsesServerCompaction: falseto stop injectingcontext_management, orparams.responsesCompactThresholdto override the threshold. See OpenAI server-side compaction.
- Use
params: global default provider parameters applied to all models. Set atagents.defaults.params(e.g.{ cacheRetention: "long" }).paramsmerge precedence (config):agents.defaults.params(global base) is overridden byagents.defaults.models["provider/model"].params(per-model), thenagents.list[].params(matching agent id) overrides by key. See Prompt Caching for details.models.providers.openrouter.params.provider: OpenRouter-wide default provider-routing policy. OpenClaw forwards this to OpenRouter’s requestproviderobject; per-modelagents.defaults.models["openrouter/<model>"].params.providerand agent params override by key. See OpenRouter provider routing.params.extra_body/params.extraBody: advanced pass-through JSON merged intoapi: "openai-completions"request bodies for OpenAI-compatible proxies. If it collides with generated request keys, the extra body wins; non-native completions routes still strip OpenAI-onlystoreafterward.params.chat_template_kwargs: vLLM/OpenAI-compatible chat-template arguments merged into top-levelapi: "openai-completions"request bodies. Forvllm/nemotron-3-*with thinking off, the bundled vLLM plugin automatically sendsenable_thinking: falseandforce_nonempty_content: true; explicitchat_template_kwargsoverride generated defaults, andextra_body.chat_template_kwargsstill has final precedence. Configured vLLM Qwen and Nemotron thinking models expose binary/thinkchoices (off,on) instead of the multi-level effort ladder.compat.thinkingFormat: OpenAI-compatible thinking payload style. Use"together"for Together-stylereasoning.enabled,"qwen"for Qwen-style top-levelenable_thinking, or"qwen-chat-template"forchat_template_kwargs.enable_thinkingon Qwen-family backends that support request-level chat-template kwargs, such as vLLM. OpenClaw maps disabled thinking tofalseand enabled thinking totrue, and configured vLLM Qwen models expose binary/thinkchoices for these formats.compat.supportedReasoningEfforts: per-model OpenAI-compatible reasoning effort list. Include"xhigh"for custom endpoints that truly accept it; OpenClaw then exposes/think xhighin command menus, Gateway session rows, session patch validation, agent CLI validation, andllm-taskvalidation for that configured provider/model. Usecompat.reasoningEffortMapwhen the backend wants a provider-specific value for a canonical level.params.preserveThinking: Z.AI-only opt-in for preserved thinking. When enabled and thinking is on, OpenClaw sendsthinking.clear_thinking: falseand replays priorreasoning_content; see Z.AI thinking and preserved thinking.localService: optional provider-level process manager for local/self-hosted model servers. When the selected model belongs to that provider, OpenClaw probeshealthUrl(orbaseUrl + "/models"), startscommandwithargsif the endpoint is down, waits up toreadyTimeoutMs, then sends the model request.commandmust be an absolute path.idleStopMs: 0keeps the process alive until OpenClaw exits; a positive value stops the OpenClaw-spawned process after that many idle milliseconds. See Local model services.- Runtime policy belongs on providers or models, not on
agents.defaults. Usemodels.providers.<provider>.agentRuntimefor provider-wide rules oragents.defaults.models["provider/model"].agentRuntime/agents.list[].models["provider/model"].agentRuntimefor model-specific rules. OpenAI agent models on the official OpenAI provider select Codex by default. - Config writers that mutate these fields (for example
/models set,/models set-image, and fallback add/remove commands) save canonical object form and preserve existing fallback lists when possible. maxConcurrent: max parallel agent runs across sessions (each session still serialized). Default: 4.
运行时策略
id:"auto","openclaw", a registered plugin harness id, or a supported CLI backend alias. The bundled Codex plugin registerscodex; the bundled Anthropic plugin provides theclaude-cliCLI backend.id: "auto"lets registered plugin harnesses claim supported turns and uses OpenClaw when no harness matches. An explicit plugin runtime such asid: "codex"requires that harness and fails closed if it is unavailable or fails.id: "pi"is accepted only as a deprecated alias foropenclawto preserve shipped configs from v2026.5.22 and earlier. New config should useopenclaw.- Runtime precedence is exact model policy first (
agents.list[].models["provider/model"],agents.defaults.models["provider/model"], ormodels.providers.<provider>.models[]), thenagents.list[]/agents.defaults.models["provider/*"], then provider-wide policy atmodels.providers.<provider>.agentRuntime. - Whole-agent runtime keys are legacy.
agents.defaults.agentRuntime,agents.list[].agentRuntime, session runtime pins, andOPENCLAW_AGENT_RUNTIMEare ignored by runtime selection. Runopenclaw doctor --fixto remove stale values. - OpenAI agent models use the Codex harness by default; provider/model
agentRuntime.id: "codex"remains valid when you want to make that explicit. - For Claude CLI deployments, prefer
model: "anthropic/claude-opus-4-8"plus model-scopedagentRuntime.id: "claude-cli". Legacyclaude-cli/claude-opus-4-7model refs still work for compatibility, but new config should keep provider/model selection canonical and put the execution backend in provider/model runtime policy. - This only controls text agent-turn execution. Media generation, vision, PDF, music, video, and TTS still use their provider/model settings.
agents.defaults.models 中时适用):
| 别名 | 模型 |
|---|---|
opus | anthropic/claude-opus-4-6 |
sonnet | anthropic/claude-sonnet-4-6 |
gpt | openai/gpt-5.5 |
gpt-mini | openai/gpt-5.4-mini |
gpt-nano | openai/gpt-5.4-nano |
gemini | google/gemini-3.1-pro-preview |
gemini-flash | google/gemini-3-flash-preview |
gemini-flash-lite | google/gemini-3.1-flash-lite |
--thinking off or define agents.defaults.models["zai/<model>"].params.thinking yourself.
Z.AI models enable tool_stream by default for tool call streaming. Set agents.defaults.models["zai/<model>"].params.tool_stream to false to disable it.
Anthropic Claude Opus 4.8 keeps thinking off by default in OpenClaw; when adaptive thinking is explicitly enabled, Anthropic’s provider-owned effort default is high. Claude 4.6 models default to adaptive when no explicit thinking level is set.
agents.defaults.cliBackends
用于纯文本回退运行(无工具调用)的可选 CLI 后端。适合作为 API 提供方失败时的备用方案。
- CLI 后端是以文本优先的;工具始终禁用。
- 当设置了
sessionArg时支持会话。 - 当
imageArg接受文件路径时支持图像透传。 reseedFromRawTranscriptWhenUncompacted: true允许后端在第一个压缩摘要存在之前,从受限的原始 OpenClaw 转录尾部恢复被失效化的安全会话。认证配置文件或凭据 epoch 的变化仍然不会进行 raw reseed。
agents.defaults.promptOverlays
Provider-independent prompt overlays applied by model family on OpenClaw-assembled prompt surfaces. GPT-5-family model ids receive the shared behavior contract across OpenClaw/provider routes; personality controls only the friendly interaction-style layer. Native Codex app-server routes keep Codex-owned base/model instructions instead of this OpenClaw GPT-5 overlay, and OpenClaw disables Codex’s built-in personality for native threads.
"friendly"(默认)和"on"会启用友好交互风格层。"off"只会禁用友好层;带标签的 GPT-5 行为契约仍保持启用。- 当此共享设置未设置时,仍会读取旧的
plugins.entries.openai.config.personality。
agents.defaults.heartbeat
定期心跳运行。
every: duration string (ms/s/m/h). Default:30m(API-key auth) or1h(OAuth auth). Set to0mto disable.includeSystemPromptSection: when false, omits the Heartbeat section from the system prompt and skipsHEARTBEAT.mdinjection into bootstrap context. Default:true.suppressToolErrorWarnings: when true, suppresses tool error warning payloads during heartbeat runs.timeoutSeconds: maximum time in seconds allowed for a heartbeat agent turn before it is aborted. Leave unset to useagents.defaults.timeoutSecondswhen set, otherwise the heartbeat cadence capped at 600 seconds.directPolicy: direct/DM delivery policy.allow(default) permits direct-target delivery.blocksuppresses direct-target delivery and emitsreason=dm-blocked.lightContext: when true, heartbeat runs use lightweight bootstrap context and keep onlyHEARTBEAT.mdfrom workspace bootstrap files.isolatedSession: when true, each heartbeat runs in a fresh session with no prior conversation history. Same isolation pattern as cronsessionTarget: "isolated". Reduces per-heartbeat token cost from ~100K to ~2-5K tokens.skipWhenBusy: when true, heartbeat runs defer on that agent’s extra busy lanes: its own session-keyed subagent or nested command work. Cron lanes always defer heartbeats, even without this flag.- Per-agent: set
agents.list[].heartbeat. When any agent definesheartbeat, only those agents run heartbeats. - Heartbeats run full agent turns — shorter intervals burn more tokens.
agents.defaults.compaction
mode:defaultorsafeguard(chunked summarization for long histories). See Compaction.provider: id of a registered compaction provider plugin. When set, the provider’ssummarize()is called instead of built-in LLM summarization. Falls back to built-in on failure. Setting a provider forcesmode: "safeguard". See Compaction.timeoutSeconds: maximum seconds allowed for a single compaction operation before OpenClaw aborts it. Default:900.keepRecentTokens: agent cut-point budget for keeping the most recent transcript tail verbatim. Manual/compacthonors this when explicitly set; otherwise manual compaction is a hard checkpoint.identifierPolicy:strict(default),off, orcustom.strictprepends built-in opaque identifier retention guidance during compaction summarization.identifierInstructions: optional custom identifier-preservation text used whenidentifierPolicy=custom.qualityGuard: retry-on-malformed-output checks for safeguard summaries. Enabled by default in safeguard mode; setenabled: falseto skip the audit.midTurnPrecheck: optional tool-loop pressure check. Whenenabled: true, OpenClaw checks context pressure after tool results are appended and before the next model call. If the context no longer fits, it aborts the current attempt before submitting the prompt and reuses the existing precheck recovery path to truncate tool results or compact and retry. Works with bothdefaultandsafeguardcompaction modes. Default: disabled.postCompactionSections: optional AGENTS.md H2/H3 section names to re-inject after compaction. Reinjection is disabled when unset or set to[]. Explicitly setting["Session Startup", "Red Lines"]enables that pair and preserves the legacyEvery Session/Safetyfallback. Enable this only when the extra context is worth the risk of duplicating project guidance already captured in the compaction summary.model: optionalprovider/model-idoverride for compaction summarization only. Use this when the main session should keep one model but compaction summaries should run on another; when unset, compaction uses the session’s primary model.maxActiveTranscriptBytes: optional byte threshold (numberor strings like"20mb") that triggers normal local compaction before a run when the active JSONL grows past the threshold. RequirestruncateAfterCompactionso successful compaction can rotate to a smaller successor transcript. Disabled when unset or0.notifyUser: whentrue, sends brief notices to the user when compaction starts and when it completes (for example, “Compacting context…” and “Compaction complete”). Disabled by default to keep compaction silent.memoryFlush: silent agentic turn before auto-compaction to store durable memories. Setmodelto an exact provider/model such asollama/qwen3:8bwhen this housekeeping turn should stay on a local model; the override does not inherit the active session fallback chain. Skipped when workspace is read-only.
agents.defaults.runRetries
Outer run loop retry iteration boundaries for the embedded agent runtime to prevent infinite execution loops during failure recovery. Note that this setting currently only applies to the embedded agent runtime, not ACP or CLI runtimes.
base:外层运行循环的基础重试迭代次数。默认值:24。perProfile:每个回退配置候选额外获得的重试迭代次数。默认值:8。min:重试迭代次数的最小绝对限制。默认值:32。max:防止失控执行的重试迭代次数最大绝对限制。默认值:160。
agents.defaults.contextPruning
在发送给 LLM 之前,从内存上下文中清理旧的工具结果。不会修改磁盘上的会话历史。
cache-ttl 模式行为
cache-ttl 模式行为
mode: "cache-ttl"启用清理轮次。ttl控制清理在上次缓存触碰后多久可以再次运行。- 清理会先对过大的工具结果进行软裁剪,然后在需要时对更旧的工具结果进行硬清除。
softTrimRatio和hardClearRatio接受从0.0到1.0的值;配置校验会拒绝超出该范围的值。
...。硬清除会用占位符替换整个工具结果。注意:- 图像块绝不会被裁剪/清除。
- 比例按字符计算(近似值),不是精确的 token 数。
- 如果存在的助手消息少于
keepLastAssistants,则跳过清理。
块流式输出
- 非 Telegram 通道需要显式的
*.blockStreaming: true才能启用块回复。 - 通道覆盖:
channels.<channel>.blockStreamingCoalesce(以及按账号的变体)。Signal/Slack/Discord/Google Chat 默认minChars: 1500。 humanDelay:块回复之间的随机暂停。natural= 800–2500ms。逐代理覆盖:agents.list[].humanDelay。
输入指示器
- 默认值:直接聊天/提及时为
instant,未被提及的群聊为message。 - 按会话覆盖:
session.typingMode、session.typingIntervalSeconds。
agents.defaults.sandbox
嵌入式代理的可选沙箱。完整指南请参见 沙箱。
沙箱详情
沙箱详情
sandbox.docker.binds 仅适用于 Docker。
构建镜像(从源码检出构建):
docker build 命令。
agents.list(逐代理覆盖)
使用 agents.list[].tts 为某个代理提供其自己的 TTS 提供方、语音、模型、风格或自动 TTS 模式。代理块会在全局 messages.tts 之上进行深度合并,因此共享凭据可以保留在一个地方,而各个代理只覆盖它们需要的语音或提供方字段。当前活动代理的覆盖会应用于自动语音回复、/tts audio、/tts status 和 tts 代理工具。提供方示例和优先级请参见 文字转语音。
id:稳定的代理 id(必填)。default:当设置了多个默认时,最先设置的生效(会记录警告)。如果都未设置,则列表中的第一个条目为默认。model:字符串形式会设置严格的逐代理主模型,不带模型回退;对象形式{ primary }也同样是严格的,除非你添加fallbacks。使用{ primary, fallbacks: [...] }可为该代理启用回退,或使用{ primary, fallbacks: [] }显式表示严格行为。仅覆盖primary的 cron 任务仍会继承默认回退,除非你设置fallbacks: []。params:逐代理流参数,会覆盖agents.defaults.models中所选模型条目。可用于诸如cacheRetention、temperature或maxTokens之类的代理特定覆盖,而无需复制整个模型目录。tts:可选的逐代理文字转语音覆盖。该块会在messages.tts之上进行深度合并,因此请将共享的提供方凭据和回退策略保留在messages.tts中,并只在此处设置与角色相关的值,例如提供方、声音、模型、风格或自动模式。skills:可选的逐代理技能允许列表。若省略,则在设置了agents.defaults.skills时继承它;显式列表会替换默认值而不是合并,[]表示没有技能。thinkingDefault:可选的逐代理默认思考级别(off | minimal | low | medium | high | xhigh | adaptive | max)。当没有逐消息或会话覆盖时,会覆盖该代理的agents.defaults.thinkingDefault。所选提供方/模型配置文件决定哪些值有效;对于 Google Gemini,adaptive会保留提供方拥有的动态思考(Gemini 3/3.1 上省略thinkingLevel,Gemini 2.5 上thinkingBudget: -1)。reasoningDefault:可选的逐代理默认推理可见性(on | off | stream)。当没有逐消息或会话推理覆盖时,会覆盖该代理的agents.defaults.reasoningDefault。fastModeDefault:可选的逐代理快速模式默认值(true | false)。在没有逐消息或会话快速模式覆盖时生效。models:可选的逐代理模型目录/运行时覆盖,按完整的provider/modelid 键入。使用models["provider/model"].agentRuntime表示逐代理运行时例外。runtime:可选的逐代理运行时描述符。若代理默认应使用 ACP 框架会话,可使用带有runtime.acp默认值(agent、backend、mode、cwd)的type: "acp"。identity.avatar:工作区相对路径、http(s)URL 或data:URI。identity派生默认值:ackReaction来自emoji,mentionPatterns来自name/emoji。subagents.allowAgents:用于显式sessions_spawn.agentId目标的已配置代理 id 允许列表(["*"]= 任意已配置目标;默认:仅同一代理)。如果允许自我目标agentId调用,请包含请求者 id。已删除其代理配置的过期条目会被sessions_spawn拒绝,并从agents_list中省略;运行openclaw doctor --fix可清理它们,或者如果希望该目标仍可在继承默认值的同时保持可生成,可添加一个最小的agents.list[]条目。- 沙箱继承保护:如果请求者会话已经处于沙箱中,
sessions_spawn会拒绝那些会在非沙箱中运行的目标。 subagents.requireAgentId:为true时,阻止省略agentId的sessions_spawn调用(强制显式配置文件选择;默认:false)。
多代理路由
在一个 Gateway 中运行多个彼此隔离的代理。参见 Multi-Agent。绑定匹配字段
type(可选):正常路由使用route(缺省时默认为 route),持久化 ACP 会话绑定使用acp。match.channel(必需)match.accountId(可选;*= 任意账户;省略 = 默认账户)match.peer(可选;{ kind: direct|group|channel, id })match.guildId/match.teamId(可选;按渠道不同)acp(可选;仅适用于type: "acp"):{ mode, label, cwd, backend }
match.peermatch.guildIdmatch.teamIdmatch.accountId(精确匹配,不含 peer/guild/team)match.accountId: "*"(覆盖整个渠道)- 默认代理
bindings 条目获胜。
对于 type: "acp" 的条目,OpenClaw 会按精确会话身份(match.channel + account + match.peer.id)解析,不使用上面的路由绑定层级顺序。
每个代理的访问配置
完全访问(无沙箱)
完全访问(无沙箱)
只读工具 + 工作区
只读工具 + 工作区
无文件系统访问(仅消息功能)
无文件系统访问(仅消息功能)
会话
会话字段详情
会话字段详情
消息
回复前缀
按频道/账户覆盖:channels.<channel>.responsePrefix、channels.<channel>.accounts.<id>.responsePrefix。
解析顺序(越具体优先级越高):账户 → 频道 → 全局。"" 表示禁用并停止级联。"auto" 会派生为 [{identity.name}]。
模板变量:
| 变量 | 说明 | 示例 |
|---|---|---|
{model} | 简短模型名 | claude-opus-4-6 |
{modelFull} | 完整模型标识 | anthropic/claude-opus-4-6 |
{provider} | 提供方名称 | anthropic |
{thinkingLevel} | 当前思考级别 | high、low、off |
{identity.name} | 代理身份名称 | (与 "auto" 相同) |
{think} 是 {thinkingLevel} 的别名。
确认反应
- 默认为活动代理的
identity.emoji,否则为"👀"。设置""可禁用。 - 按频道覆盖:
channels.<channel>.ackReaction、channels.<channel>.accounts.<id>.ackReaction。 - 解析顺序:账户 → 频道 →
messages.ackReaction→ identity 回退。 - 范围:
group-mentions(默认)、group-all、direct、all。 removeAckAfterReply:会在支持 reaction 的频道(如 Slack、Discord、Telegram、WhatsApp 和 iMessage)中,在回复后移除确认反应。messages.statusReactions.enabled:在 Slack、Discord、Telegram 和 WhatsApp 上启用生命周期状态反应。 在 Slack 和 Discord 上,如果不设置,当确认反应启用时状态反应仍保持启用。 在 Telegram 和 WhatsApp 上,必须显式设为true才会启用生命周期状态反应。messages.statusReactions.emojis:覆盖生命周期 emoji 键:queued、thinking、compacting、tool、coding、web、deploy、build、concierge、done、error、stallSoft和stallHard。 Telegram 只允许固定的 reaction 集合,因此不受支持的已配置 emoji 会回退到 该聊天中最接近的受支持状态变体。
入站防抖
将来自同一发送者的快速纯文本消息批量合并为一次代理轮次。媒体/附件会立即刷新。控制命令会绕过防抖。TTS(文本转语音)
auto控制默认自动 TTS 模式:off、always、inbound或tagged。/tts on|off可覆盖本地偏好,/tts status会显示生效状态。summaryModel会为自动摘要覆盖agents.defaults.model.primary。modelOverrides默认启用;modelOverrides.allowProvider默认为false(需显式启用)。- API 密钥会回退到
ELEVENLABS_API_KEY/XI_API_KEY和OPENAI_API_KEY。 - 捆绑的语音提供方由插件拥有。如果设置了
plugins.allow,请包含你想使用的每个 TTS 提供方插件,例如用于 Edge TTS 的microsoft。旧的edge提供方 id 也可作为microsoft的别名接受。 providers.openai.baseUrl会覆盖 OpenAI TTS 端点。解析顺序为配置,其次OPENAI_TTS_BASE_URL,然后https://api.openai.com/v1。- 当
providers.openai.baseUrl指向非 OpenAI 端点时,OpenClaw 会将其视为兼容 OpenAI 的 TTS 服务器,并放宽模型/语音验证。
Talk
Talk 模式(macOS/iOS/Android)的默认设置。talk.provider在配置了多个 Talk 提供方时,必须与talk.providers中的某个键匹配。- 旧版扁平化 Talk 键(
talk.voiceId、talk.voiceAliases、talk.modelId、talk.outputFormat、talk.apiKey)仅用于兼容性。运行openclaw doctor --fix可将持久化配置重写为talk.providers.<provider>。 - 语音 ID 会回退到
ELEVENLABS_VOICE_ID或SAG_VOICE_ID。 providers.*.apiKey接受明文字符串或 SecretRef 对象。- 仅当未配置 Talk API 密钥时,才会应用
ELEVENLABS_API_KEY回退。 providers.*.voiceAliases允许 Talk 指令使用友好名称。providers.mlx.modelId选择 macOS 本地 MLX helper 使用的 Hugging Face 仓库。如果省略,macOS 将使用mlx-community/Soprano-80M-bf16。- macOS MLX 播放会通过随附的
openclaw-mlx-ttshelper(如果存在)或PATH上的可执行文件运行;OPENCLAW_MLX_TTS_BIN会在开发时覆盖 helper 路径。 consultThinkingLevel控制 Control UI Talk realtimeopenclaw_agent_consult调用背后完整 OpenClaw agent 运行的思考级别。保持未设置可保留正常的会话/模型行为。consultFastMode为 Control UI Talk realtime consult 设置一次性 fast-mode 覆盖,而不会更改会话的正常 fast-mode 设置。speechLocale设置 iOS/macOS Talk 语音识别使用的 BCP 47 区域设置 ID。保持未设置可使用设备默认值。silenceTimeoutMs控制 Talk 模式在用户静默后等待多久再发送转录文本。未设置时保留平台默认的暂停窗口(macOS 和 Android 为700 ms,iOS 为900 ms)。realtime.instructions会将面向提供方的系统指令追加到 OpenClaw 内置的 realtime 提示词中,因此可以在不丢失默认openclaw_agent_consult指南的情况下配置语音风格。realtime.consultRouting控制当 realtime 提供方在没有openclaw_agent_consult的情况下生成最终用户转录时的 Gateway relay 回退:provider-direct保留直接的提供方回复,而force-agent-consult会将最终请求路由通过 OpenClaw。