Skip to Content
👋 欢迎来到 HowToUseMoltbot 快速入门
工具LLM Task

LLM Task

llm-task可选插件工具,用于运行仅 JSON 的 LLM 任务并返回结构化输出(可选按 JSON Schema 校验)。适用于 Lobster 等工作流引擎:可添加单步 LLM 而无需为每个工作流编写自定义 Moltbot 代码。

启用插件

  1. 启用插件:
{ "plugins": { "entries": { "llm-task": { "enabled": true } } } }
  1. 将工具加入白名单(该工具以 optional: true 注册):
{ "agents": { "list": [ { "id": "main", "tools": { "allow": ["llm-task"] } } ] } }

配置(可选)

{ "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 } } } } }

allowedModelsprovider/model 字符串的白名单。若设置,则拒绝不在列表中的请求。

工具参数

  • prompt(字符串,必填)
  • input(任意,可选)
  • schema(对象,可选 JSON Schema)
  • provider(字符串,可选)
  • model(字符串,可选)
  • authProfileId(字符串,可选)
  • temperature(数字,可选)
  • maxTokens(数字,可选)
  • timeoutMs(数字,可选)

输出

返回 details.json,包含解析后的 JSON(提供 schema 时会进行校验)。

示例:Lobster 工作流步骤

clawd.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 校验,否则将输出视为不可信。
  • 在有副作用的步骤(发送、发布、exec)前应加审批。
最后更新于: