import { Agent, AgentScheduler } from 'praisonai-ts';
// Create agent
const agent = new Agent({
name: 'News Monitor',
instructions: 'Monitor and summarize AI news',
});
// Create scheduler
const scheduler = new AgentScheduler({
agent,
task: 'Check for latest AI news',
timeout: 300,
maxCost: 1.00,
});
// Start with interval
scheduler.start({
scheduleExpr: 'hourly',
maxRetries: 3,
runImmediately: true,
});
// Monitor
console.log(`Running: ${scheduler.isRunning}`);
console.log(`Stats: ${JSON.stringify(scheduler.getStats())}`);
// Stop
scheduler.stop();