Event-driven agents beat scheduled agents — here's the pattern that changes everything
Most people run their agents on cron jobs. Check email every 15 minutes. Scan for new GitHub issues every hour. Generate reports at 9 AM daily.
This is backwards. Your agent should react to events, not poll for them.
Here's why: polling burns tokens checking for nothing 90% of the time, creates lag when something actually happens, and scales terribly as you add more data sources.
Event-driven agents flip this. They sleep until something happens, then wake up instantly with full context about what changed.
The webhook-first pattern
Start with services that push events to you:
// Your agent's webhook endpoint
app.post('/webhook/github', (req, res) => {
const { action, issue, repository } = req.body;
if (action === 'opened' && issue.labels.includes('bug')) {
agent.handle({
type: 'github_bug_reported',
data: { issue, repo: repository.name },
context: 'immediate_triage_needed'
});
}
});Your agent gets the exact issue that needs attention, with full context, the moment it's created. No polling. No delay. No wasted tokens.
The calendar trigger pattern
For time-based events, use calendar webhooks instead of cron:
// Google Calendar webhook for "Prep weekly review"
app.post('/webhook/calendar', (req, body) => {
const event = req.body;
if (event.summary.includes('weekly review')) {
agent.handle({
type: 'review_prep_due',
data: { meeting_time: event.start.dateTime },
context: 'gather_week_metrics_and_blockers'
});
}
});Now your agent prepares for meetings based on your actual calendar, not arbitrary schedules.
The email trigger pattern
Instead of checking email every 15 minutes, set up email forwarding rules:
Gmail filter: "from:important-client@company.com" → forward to agent-inbox@yourdomain.com
Your agent processes VIP emails in seconds, not minutes.
The file watcher pattern
For local workflows, use filesystem events:
const chokidar = require('chokidar');
chokidar.watch('./reports/*.csv').on('add', (path) => {
agent.handle({
type: 'new_data_file',
data: { file_path: path },
context: 'analyze_and_summarize'
});
});Why this matters now
Microsoft just announced Outlook agents that respond to email events in real-time. Slack's workflow builder triggers agents on message patterns. GitHub Copilot Workspace activates on issue creation.
The platforms are moving toward event-driven agent activation. Get ahead of this pattern now.
Implementation priority
- Start with one high-value event (new customer emails, critical alerts)
- Set up the webhook endpoint first, agent logic second
- Test with manual webhook calls before connecting real services
- Add logging so you can see what events your agent is missing
Event-driven agents feel magical because they respond instantly to what matters. Polling agents feel sluggish because they're always checking for yesterday's problems.
Your users will notice the difference immediately.