agent-factory
创建新的 OpenClaw Agent 并自动配置飞书机器人。当用户说"帮我创建 Agent"、"新建机器人"、"添加新 agent"、"配置新机器人"时触发。用户提供:agent 名称、飞书 appId、appSecret、角色定位。执行完毕后汇报结果。
Install via CLI (Recommended)
clawhub install openclaw/skills/skills/beyondbright/walter-agent-factoryagent-factory
自动创建新 OpenClaw Agent 并绑定飞书机器人。
输入参数
用户需提供:
| 参数 | 说明 | 示例 |
|---|---|---|
name | Agent 名称(英文,无空格) | baikexia |
displayName | 显示名称 | 百科虾 |
appId | 飞书机器人 App ID | cli_xxx |
appSecret | 飞书机器人 Secret | xxx |
identity | 角色定位描述 | 蜗牛公司问答助手 |
soul | 行为准则(可选) | 不准加没要求的功能、不准过度封装、不准瞎重构、不准假装测试通过、不准加装成功、先读再改不准盲改 |
skill | 要安装的 clawhub skill 名称(可选) | wikipedia |
执行流程
Step 1: 验证凭证
调用飞书 API 验证 appId/appSecret:
$body = @{
app_id = $appId
app_secret = $appSecret
} | ConvertTo-Json
$resp = Invoke-RestMethod -Uri "https://open.feishu.cn/open-apis/auth/v3/tenant_access_token/internal" `
-Method POST `
-Body $body `
-ContentType "application/json"
if ($resp.code -ne 0) { throw "凭证无效:$($resp.msg)" }
Step 2: 创建 Agent
openclaw agents add $name --workspace "$env:USERPROFILE\.openclaw\workspace-$name"
Step 3: 配置飞书账号
读取当前配置,追加新账号:
$config = Get-Content "$env:USERPROFILE\.openclaw\openclaw.json" -Raw | ConvertFrom-Json
$config.channels.feishu.accounts | Add-Member -NotePropertyName $name -NotePropertyValue @{
appId = $appId
appSecret = $appSecret
name = $displayName
}
Step 4: 配置路由规则
追加 binding(如已存在则跳过):
$existingBinding = $config.bindings | Where-Object {
$_.agentId -eq $name -and $_.match.accountId -eq $name
}
if (-not $existingBinding) {
$config.bindings += @{
type = "route"
agentId = $name
match = @{ channel = "feishu"; accountId = $name }
}
}
Step 5: 原子写入配置文件
先备份,再写入临时文件,最后 Move-Item 替换,防止写入损坏导致配置丢失:
$configPath = "$env:USERPROFILE\.openclaw\openclaw.json"
$backupPath = "$env:USERPROFILE\.openclaw\openclaw.json.bak"
$tempPath = "$env:USERPROFILE\.openclaw\openclaw.json.tmp"
Copy-Item $configPath $backupPath -Force
$config | ConvertTo-Json -Depth 100 -Compress | Set-Content $tempPath -NoNewline -Encoding UTF8
Move-Item $tempPath $configPath -Force
Step 6: 创建角色文件
在 $env:USERPROFILE\.openclaw\workspace-{name}/ 下创建:
IDENTITY.md— 名字、emoji、定位SOUL.md— 行为准则(用户提供的 soul 或默认模板)AGENTS.md— 工作手册(可选)USER.md— 用户占位符
Step 7: 安装 Skill(如有指定)
使用 clawhub install 将 skill 安装到新 agent 的 workspace 下,而非当前 active workspace:
clawhub install <skill-name> --workdir "$env:USERPROFILE\.openclaw\workspace-$Name"
注意:PowerShell 变量在字符串中需要用 " 包围双引号,或者先拼接路径再传入。
Step 8: 开启工具权限
openclaw config set channels.feishu.tools.wiki true
openclaw config set channels.feishu.tools.doc true
openclaw config set channels.feishu.tools.drive true
Step 9: 重启网关
openclaw gateway restart
完整脚本
提供两个版本:Windows (PowerShell) 和 Linux/macOS (Bash + jq)。
Linux / macOS (Bash)
将以下脚本保存为 create-agent.sh,执行 chmod +x create-agent.sh 后运行:
#!/usr/bin/env bash
# create-agent.sh — Linux/macOS 版(需安装 jq)
set -euo pipefail
Metadata
Not sure this is the right skill?
Describe what you want to build — we'll match you to the best skill from 16,000+ options.
Find the right skillPaste this into your clawhub.json to enable this plugin.
{
"plugins": {
"official-beyondbright-walter-agent-factory": {
"enabled": true,
"auto_update": true
}
}
}Related Skills
baikexia
蜗牛公司百科虾技能包。为员工解答公司相关问题(制度、福利、流程、组织架构等)。当用户询问公司相关问题时触发。知识库没有的问题一律不答,不编造,不联网搜索。
walter-info
获取全球五大洲主要城市天气预报与跨境电商热点资讯,并生成格式化Markdown文档和JSON数据文件。当用户需要查询天气、跨境电商资讯,或要求生成报告时触发。
Walter Product Research
Skill by beyondbright
Walter Competitor Monitor
Skill by beyondbright
walter-competitor
亚马逊竞品流量攻防智能分析。自动发现竞品、分析流量结构、识别弱点、生成攻击矩阵。无需手动提供ASIN,全自动竞品情报获取。