Skip to main content

Overview

An intervention fires when the attention score drops below the configured threshold and no intervention is already active. OnlookAI supports several intervention types — from simple nudges to AI-generated comprehension checks.

Built-in intervention: MCQ

The desktop app generates multiple-choice questions using GPT-4o-mini based on the content the user was viewing. The user must answer before the session resumes.
session.on('drop', async ({ score }) => {
  const question = await generateQuestion(context)
  showModal(question)
})

Webhook intervention

Push score-drop events to your backend and handle them however you like.
// In your onlook.config.ts
export default {
  webhooks: {
    onDrop: 'https://your-backend.com/attention/drop',
  }
}
The payload sent to your endpoint:
{
  "sessionId": "sess_8xK2mP9q",
  "userId": "alice@acme.com",
  "score": 34,
  "threshold": 40,
  "timestamp": "2026-04-28T14:32:08Z"
}

Cooldown

After an intervention resolves, a 60-second cooldown prevents immediate re-triggering. Configurable:
const session = track(userId, { interventionCooldown: 120 })