@shieldai-xyz/sdk
v0.1.0-alpha
Published
Runtime security SDK for autonomous AI agents — spend controls, anomaly detection, MCP gateway, EU AI Act compliance
Maintainers
Readme
@shieldai/sdk
Before your AI agent spends your money, someone should be watching.
Runtime security SDK for autonomous AI agents — spend controls, anomaly detection, MCP gateway, EU AI Act compliance.
Install
npm install @shieldai/sdkQuickstart
import { ShieldAI } from '@shieldai/sdk'
const shield = new ShieldAI({
agentWallet: '0xYourAgentWallet',
dailyLimit: 50, // USD
whitelist: ['0x...'], // approved counterparties
})
shield.watch() // that's it — agent is now monitoredValidate Transactions
const result = await shield.validate({
from: agentWallet,
to: '0xRecipient',
amountUSD: 10,
timestamp: Date.now()
})
if (result.allowed) {
executeTransaction()
} else {
console.log('BLOCKED:', result.reason)
// reason: 'Daily limit exceeded' | 'Counterparty not whitelisted' | 'Anomaly detected' | ...
}MCP Gateway
// Intercept every MCP tool call before execution
const mcpResult = await shield.interceptMCP({
tool: 'uniswap_swap',
params: { tokenIn: '0x...', amountIn: '1000000' }
})
if (mcpResult.allowed) {
executeMCPCall()
}
// Blocks: high-velocity attacks, non-whitelisted contracts, critical toolsAgent Status
const status = await shield.getStatus()
// {
// status: 'safe' | 'warn' | 'frozen',
// anomalyScore: 0.03,
// txToday: 12,
// spentToday: 18.50,
// remainingLimit: 31.50,
// complianceScore: 100
// }Freeze / Unfreeze
// Manual kill switch
await shield.freeze('Suspicious activity detected')
// Unfreeze when safe
shield.unfreeze()
// Auto-freeze on anomaly — happens automaticallyAlerts
shield.onAlert((alert) => {
console.log('ALERT:', alert.type, alert.severity)
// Send to Slack, PagerDuty, Telegram, etc.
})EU AI Act Compliance
// Generate compliance report (Art. 9, 13, 14, 72)
const report = shield.getComplianceReport()
console.log(report.score) // '83%'
console.log(report.articles) // array of compliance checks
// Export as JSON for regulatory inspection
const json = shield.exportCompliance()
fs.writeFileSync('compliance_report.json', json)Advanced Config
const shield = new ShieldAI({
agentWallet: '0x...',
dailyLimit: 100, // USD daily limit
perTxLimit: 25, // USD per transaction
whitelist: ['0x...'], // approved counterparties only
anomalyThreshold: 0.8, // 0-1, default 0.8
alertWebhook: 'https://...', // POST alerts here
rpcUrl: 'https://...', // custom RPC
euAiActLogging: true, // EU AI Act compliance logging
mcpGateway: true, // MCP tool call interception
})Security Features
| Feature | Description | |---------|-------------| | SpendGuard | Daily + per-tx limits enforced on every transaction | | Whitelist | Only approved counterparties can receive funds | | Anomaly Detection | Isolation Forest baseline — auto-freeze on anomaly | | MCP Gateway | Intercepts every tool call before execution | | Kill Switch | Manual freeze + auto-freeze on critical anomaly | | EU AI Act Logs | Auto-generates Art. 9, 13, 14, 72 compliance evidence |
On-Chain Contract
SpendGuard.sol is deployed and verified on Arbitrum One:
Contract: 0xE03C389DF391549E44c2aa807576c9eE2956C2d8
Network: Arbitrum One
Verified: 2026-04-04 · Exact Match ✓
Block: #448899709Links
- 🌐 Website: getshieldai.xyz
- 📊 Dashboard: getshieldai.xyz/dashboard.html
- 🐙 GitHub: shield-xyz-lab/ShieldAi
- 🐦 Twitter: @ShieldAI2026
- 💜 Giveth: giveth.io/project/shieldai
License
MIT © 2026 ShieldAI
