LLM 任务插件
LLM 任务
Section titled “LLM 任务”llm-task 是一个 可选插件工具,它运行仅 JSON 的 LLM 任务并返回结构化输出(可选根据 JSON Schema 验证)。
这对于像 Lobster 这样的工作流引擎非常理想:您可以添加单个 LLM 步骤,而无需为每个工作流编写自定义 OpenClaw 代码。
- 启用插件:
{ "plugins": { "entries": { "llm-task": { "enabled": true } } }}- 将工具列入白名单(它以
optional: true注册):
{ "agents": { "list": [ { "id": "main", "tools": { "allow": ["llm-task"] } } ] }}配置 (可选)
Section titled “配置 (可选)”{ "plugins": { "entries": { "llm-task": { "enabled": true, "config": { "defaultProvider": "openai-codex", "defaultModel": "gpt-5.2", "defaultAuthProfileId": "main", "allowedModels": ["openai-codex/gpt-5.2"], "maxTokens": 800, "timeoutMs": 30000 } } } }}allowedModels 是 provider/model 字符串的白名单。如果设置,列表之外的任何请求都将被拒绝。
prompt(字符串, 必填)input(任意, 可选)schema(对象, 可选 JSON Schema)provider(字符串, 可选)model(字符串, 可选)authProfileId(字符串, 可选)temperature(数字, 可选)maxTokens(数字, 可选)timeoutMs(数字, 可选)
返回包含解析后的 JSON 的 details.json(并在提供 schema 时根据其验证)。
示例:Lobster 工作流步骤
Section titled “示例:Lobster 工作流步骤”openclaw.invoke --tool llm-task --action json --args-json '{ "prompt": "Given the input email, return intent and draft.", "input": { "subject": "Hello", "body": "Can you help?" }, "schema": { "type": "object", "properties": { "intent": { "type": "string" }, "draft": { "type": "string" } }, "required": ["intent", "draft"], "additionalProperties": false }}'- 该工具是 仅 JSON 的,并指示模型仅输出 JSON(无代码围栏,无评论)。
- 此运行未向模型暴露任何工具。
- 除非您使用
schema验证,否则将输出视为不可信。 - 将批准放在任何副作用步骤(发送、发布、执行)之前。