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"] }
}
]
}
}
設定(可選)¶
{
"plugins": {
"entries": {
"llm-task": {
"enabled": true,
"config": {
"defaultProvider": "openai-codex",
"defaultModel": "gpt-5.2",
"defaultAuthProfileId": "main",
"allowedModels": ["openai-codex/gpt-5.3-codex"],
"maxTokens": 800,
"timeoutMs": 30000
}
}
}
}
}
allowedModels 是 provider/model 字串的允許清單。若已設定,任何請求
outside the list is rejected.
工具參數¶
prompt(string,必填)input(any,選填)schema(object,選填的 JSON Schema)provider(string,選填)model(string,選填)authProfileId(string,選填)temperature(number,選填)maxTokens(number,選填)timeoutMs(number,選填)
輸出¶
回傳 details.json,其中包含已解析的 JSON(若提供 schema,則會進行驗證)。
範例: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進行驗證,否則請將輸出視為不可信。 - Put approvals before any side-effecting step (send, post, exec).