@aiagentwatch/sdk
v1.0.8
Published
The Node.js SDK for AgentWatch. Stream exactly what your agent is doing to the AgentWatch dashboard in real-time.
Maintainers
Readme
@aiagentwatch/sdk
The Node.js SDK for AgentWatch. Stream exactly what your agent is doing to the AgentWatch dashboard in real-time.
Installation
npm install @aiagentwatch/sdkQuickstart
import { AgentWatcher } from '@aiagentwatch/sdk';
// Initialize the watcher
const watcher = new AgentWatcher({
apiKey: 'your-api-key', // Found on the dashboard
agentId: 'your-agent-id', // Found on the dashboard
relayUrl: 'https://your-project.cloudfunctions.net'
});
// Start monitoring file changes and stdout
await watcher.start();
// ... Your agent's logic ...
// Report token usage when calling LLMs
watcher.reportTokenUsage(1200, 400, 'claude-sonnet-4-6');
// Pause execution and ask for human approval before dangerous actions
const decision = await watcher.checkpoint('Delete all files in /tmp/build');
if (decision === 'rejected') {
console.log('Action rejected by human.');
process.exit(0);
}
// Ensure events are flushed
await watcher.stop();