AgentGuard is a trust middleware for Phase 1 hybrid authentication:
# Install globally
npm install -g agentguard
# Or use as OpenClaw skill
cp -r . ~/.openclaw/skills/agentguard
# Initialize vault
agentguard init
# Register an agent
agentguard register my-agent --owner "user@example.com"
# Store a credential
agentguard vault store my-agent OPENAI_API_KEY sk-xxx
# Define permission scope
agentguard scope set my-agent --level read --dangerous require-approval
# List agents
agentguard list
# Audit log
agentguard audit my-agent --last 24h
| Level | Auto-approve | Requires Human |
|---|---|---|
| ------- | -------------- | ---------------- |
read | ✅ Read operations | ❌ |
write | ✅ Read/Write | ❌ |
admin | ✅ Most operations | ⚠️ Dangerous only |
dangerous | ❌ All operations | ✅ Always |
When an agent attempts a dangerous operation:
~/.agentguard/config.json:
{
"vault": {
"encryption": "aes-256-gcm",
"keyDerivation": "pbkdf2"
},
"humanGate": {
"timeout": 300,
"channels": ["feishu", "telegram"],
"biometric": true
},
"audit": {
"retention": "30d",
"signLogs": true
}
}
const agentguard = require('agentguard');
// Check permission
const allowed = await agentguard.check('my-agent', 'send_email');
if (!allowed) {
// Request human approval
const approval = await agentguard.requestApproval({
agent: 'my-agent',
action: 'send_email',
details: { to: 'user@example.com', subject: 'Test' }
});
}
// Get credential
const apiKey = await agentguard.getCredential('my-agent', 'OPENAI_API_KEY');
// Log action
await agentguard.audit('my-agent', 'api_call', { endpoint: '/completions' });
~/.agentguard/ - Data directory~/.agentguard/vault/ - Encrypted credentials~/.agentguard/registry.json - Agent registry~/.agentguard/audit/ - Audit logs~/.agentguard/config.json - ConfigurationAgentGuard integrates with OpenClaw as a skill:
~/.openclaw/skills/agentguard/AGENTS.md:```
## AgentGuard
All external API calls require AgentGuard permission check.
Dangerous operations require human approval.
```
```javascript
const guard = require('agentguard');
await guard.checkOrApprove(agentId, operation, details);
```
Building trust infrastructure for the Agentic Era.
共 2 个版本