Get protection in 30 seconds.
# NPM (recommended)
npm install agent-guard
# Or download directly
curl -O https://raw.githubusercontent.com/dipampaul17/AgentGuard/main/agent-guard.jsconst agentGuard = require('agent-guard');
await agentGuard.init({ limit: 10 });
// Your existing agent code...
// AgentGuard now protects everything belownode verify-installation.jsWatch the cost counter: 💸 $0.12... $0.45... $0.89...
const guard = await require('agent-guard').init({
limit: 50, // Kill at $50
webhook: 'https://hooks.slack.com/...', // Slack alerts
silent: false // Show cost updates
});
// Check costs anytime
console.log(`Current: $${guard.getCost()}`);<script src="agent-guard.js"></script>
<script>
AgentGuard.init({ limit: 25 });
// Your browser agent code...
</script>// Add at the top of your RAG agent
await require('agent-guard').init({ limit: 100 });
// Your existing code
async function processDocument(doc) {
const chunks = await chunkDocument(doc);
for (const chunk of chunks) {
// These API calls are now protected
const embedding = await openai.embeddings.create({...});
const response = await openai.chat.completions.create({...});
// AgentGuard tracks each call automatically
console.log('Processed chunk:', response);
}
}💸 $0.23... $1.45... $4.67... $9.89
⚠️ AGENTGUARD: Approaching limit ($10)
🛑 AGENTGUARD: KILLED PROCESS - Saved you $90
- ✅ OpenAI API calls (all models)
- ✅ Anthropic/Claude API calls
- ✅ Any API response logged to console
- ✅ Fetch/axios requests to AI APIs
- ✅ Real-time token & cost calculation
- 🛡️ Infinite loops calling AI APIs
- 🛡️ Expensive model calls (GPT-4, Claude Opus)
- 🛡️ Accidentally high token usage
- 🛡️ Recursive agent calls
- 🛡️ Development debugging sessions
"Not tracking my API calls"
- Make sure you
console.log()the API responses - Or use fetch/axios for automatic interception
"Kills too early"
- Adjust limit:
guard.setLimit(100) - Check pricing accuracy for your model
"Want to exclude certain calls"
- Initialize multiple guards for different components
- Use
silent: truemode for non-critical calls
- 📧 GitHub Issues - Report bugs or request features
- 💬 GitHub Discussions - Community support
- 📖 Full Documentation - Complete API reference
Stop losing money. Start shipping safely. 🛡️