AgentGate - Enterprise Security Firewall for OpenClaw
OpenClaw 企业级安全防火墙,实时拦截工具调用并按策略返回允许/拒绝/需审批。
安装 / 下载方式
TotalClaw CLI推荐
totalclaw install totalclaw:totalclaw~wiserautomation-agentgate-securitycURL直接下载,无需登录
curl -fsSL https://skills.taituai.com/api/skills/totalclaw%3Atotalclaw~wiserautomation-agentgate-security/file -o wiserautomation-agentgate-security.md## 概述(中文)
OpenClaw 企业级安全防火墙,实时拦截工具调用并按策略返回允许/拒绝/需审批。
## 技能正文
# AgentGate - OpenClaw 企业级安全防火墙
AgentGate 是实时策略执行层,在 OpenClaw 智能体每次工具调用执行前进行拦截。它根据 Firestore 中人工定义的正则规则评估调用,并返回三种决策之一:ALLOW、DENY 或 REQUIRE_APPROVAL。
## 为何存在
OpenClaw 智能体默认拥有完整工具访问权限。一次幻觉就可能导致执行 rm -rf、发送未授权邮件、调用 Stripe API、将有问题的代码推上生产,或向外端点渗出数据。AgentGate 在执行前拦截每次工具调用。
## 架构
AgentGate 用中间件模式包装智能体的 executeTool 方法。每次工具调用时向 AgentGate Firebase Cloud Function 发送 POST,携带智能体 API 密钥、工具名与序列化参数。函数验证密钥、评估正则策略、写入审计日志,并在 80ms 内返回决策。
## 决策类型
ALLOW:工具正常执行。
DENY:工具被阻止。智能体收到结构化错误:「AgentGate: Action blocked by policy [policy_id]. Do not retry.」
REQUIRE_APPROVAL:执行暂停。Telegram webhook 向操作员发送批准/拒绝按钮。智能体每 2 秒轮询 Firestore,最长 5 分钟。
## 支持的工具类型
- bash:shell 命令执行
- browser:基于 Playwright 的 Web 自动化
- fetch:出站 HTTP 请求
- fs:文件系统读写
- email:SMTP 与 SendGrid 集成
- stripe:支付 API 调用
## 策略格式
agentId: string
toolName: string(如 "bash")
condition: string(对 JSON.stringify(args) 评估的正则)
ruleType: "ALLOW" | "DENY" | "REQUIRE_APPROVAL"
priority: integer(越小越先评估)
示例 - 阻止破坏性 bash:
toolName: "bash"
condition: "rm\\s+-rf|DROP\\s+TABLE"
ruleType: "DENY"
示例 - Stripe 超过 $100 需审批:
toolName: "stripe"
condition: "\"amount\":\\s*[1-9][0-9]{4,}"
ruleType: "REQUIRE_APPROVAL"
示例 - 出站 fetch 白名单:
toolName: "fetch"
condition: "^(?!.*(api\\.github\\.com|agent-gate-rho\\.vercel\\.app)).*$"
ruleType: "DENY"
## SDK 用法
npm install @agentgate/openclaw-guard
import OpenClaw from 'openclaw';
import { withAgentGate } from '@agentgate/openclaw-guard';
const agent = new OpenClaw({ model: 'claude-3-5-sonnet', tools: ['bash', 'browser', 'fetch'] });
const securedAgent = withAgentGate(agent, {
apiKey: process.env.AGENTGATE_API_KEY,
endpoint: 'https://agent-gate-rho.vercel.app/api/evaluate-action',
onDeny: (toolName, args, policyId) => console.log('Blocked:', toolName, policyId),
onApprovalRequired: (toolName, args) => console.log('Awaiting approval:', toolName)
});
await securedAgent.run('Research competitors and update the CRM');
## 控制台
https://agent-gate-rho.vercel.app 提供:
- 智能体管理与 API 密钥轮换
- AI 策略向导:用自然语言描述规则,Gemini 生成正则
- 通过 Firestore onSnapshot 的实时审计日志
- 带一键批准/拒绝的审批队列
## 入门
1. 在 https://agent-gate-rho.vercel.app 免费注册
2. 创建智能体并复制 API 密钥
3. npm install @agentgate/openclaw-guard
4. 用 withAgentGate 包装智能体
5. 在控制台用 AI 向导定义策略
6. 智能体运行时查看实时审计日志
## 定价
免费:1 个智能体、每月 500 次评估、7 天审计日志。无需信用卡。