Agent SDK Automation
Real-Time Notifications
Real-time notifications keep teams informed while an agent runs. You can stream progress to Slack, send email summaries, or call a webhook when milestones complete.
Notification strategies
- Stream events - forward message_update and tool_end events to a channel for live progress.
- Session summary - collect output and send one message when the session ends.
- Alerts - watch for error and permission_request events and notify operators immediately.
Slack notification example
The following TypeScript handler sends a message to Slack when a session ends.
Hooks versus SDK events
If you only need notifications, configure shell hooks in .autohand/config.json. Use SDK events when you need to transform the payload, route to different channels, or conditionally suppress messages.
Best practices
- Batch rapid events to avoid rate limits.
- Include the session ID and a link to full logs in every message.
- Do not send secrets or file contents in notifications.
- Provide a quiet mode for sensitive sessions.