Vercel Sandbox adds session lifecycle webhooks
Brief
Vercel Sandbox can now notify your backend or agent as a session starts, nears its timeout, or stops.
Lifecycle events
- Subscribe in team webhook settings to
sandbox.session.started,sandbox.session.expiring, andsandbox.session.stopped. - Expiring notifications arrive one minute before timeout by default, or at the configured
expiryNotificationLeadTime; extending a session triggers a new warning before its updated timeout. - Stopped events include the stop reason, session duration, active CPU time, and network transfer.
Handling sessions
- Use events to update application state, extend an agent session, or trigger cleanup. Agents can subscribe through Vercel MCP and call
extend_session_timeoutafter an expiring event. - Webhook events may be delivered more than once; key handlers by session ID and, for expiring events,
sandbox.expiresAt. - Workflows can wait for lifecycle events and extend a session while an agent is working, without polling.
Generated by AI from the original article. Check the source for full details.