> ## Documentation Index
> Fetch the complete documentation index at: https://onlook.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Interventions

> What happens when attention drops below threshold.

## 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.

```ts theme={null}
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.

```ts theme={null}
// In your onlook.config.ts
export default {
  webhooks: {
    onDrop: 'https://your-backend.com/attention/drop',
  }
}
```

The payload sent to your endpoint:

```json theme={null}
{
  "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:

```ts theme={null}
const session = track(userId, { interventionCooldown: 120 })
```
