You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/guides/tips/index.md
+42Lines changed: 42 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -377,6 +377,48 @@ settings:
377
377
378
378
This model is used when you run `docker agent run` without a config file.
379
379
380
+
### Get Desktop Notifications with Hooks
381
+
382
+
Long-running agents shouldn't require staring at the terminal. Add [global hooks](../../configuration/hooks/index.md#global-user-level-hooks) to your user config so every agent notifies you when it needs attention or finishes:
383
+
384
+
```yaml
385
+
# ~/.config/cagent/config.yaml
386
+
settings:
387
+
hooks:
388
+
# Agent is waiting for your input (question, approval prompt, ...)
389
+
on_user_input:
390
+
- type: command
391
+
command: osascript -e 'display notification "Agent needs your input" with title "docker-agent"'
392
+
393
+
# Agent finished responding
394
+
stop:
395
+
- type: command
396
+
command: osascript -e 'display notification "Task finished" with title "docker-agent"'
397
+
```
398
+
399
+
On Linux, replace `osascript` with `notify-send`:
400
+
401
+
```yaml
402
+
command: notify-send "docker-agent" "Agent needs your input"
403
+
```
404
+
405
+
To also get alerted on errors and warnings, hook the `notification` event and read the message from the JSON payload on stdin:
osascript -e "display notification \"$MESSAGE\" with title \"docker-agent\""
416
+
```
417
+
418
+
If a sound is enough, set `settings: { sound: true }` instead — docker-agent plays a notification sound when a task that ran longer than `sound_threshold` seconds (default 10) succeeds or fails.
419
+
420
+
See the [Hooks documentation](../../configuration/hooks/index.md) for the full list of events and their payloads.
0 commit comments