Skip to main content

Cross-platform notifications for long-running agentic CLI tools

Project description

agent-notify

agent-notify sends notifications when long-running CLI/agent tasks finish.

It supports two usage styles:

  1. Wrap a command (agent-notify run -- ...)
  2. Receive task-level events from interactive agents (Codex, Claude Code, Gemini, Ollama pipelines)

Why People Use This

  • You can keep coding in one window and get notified when a background task completes.
  • Notifications include success/failure, duration, and exit code.
  • Works on macOS and Windows (with console fallback when desktop notifications are unavailable).

Install

Recommended:

pipx install agent-notify

Alternative:

pip install agent-notify

From source:

python -m pip install -e .

Confirm install:

agent-notify --help
agent-notify test-notify --channel console

2-Minute Quickstart

Run any long command through the wrapper:

agent-notify run -- python3 -c "import time; time.sleep(8)"

If the command fails, the notification title changes to Failed.

Choose Your Mode

Mode A: Task-Level Notifications (Recommended for interactive CLIs)

This notifies when an agent turn/task completes inside Codex/Claude/Gemini flows. You do not need to exit the CLI session.

Mode B: Shell Exit Notifications (shell-init)

This notifies when shell commands end. For interactive agents, that usually means on CLI exit. Use this only if you want process-exit behavior.

Interactive Tool Setup

Codex CLI

Codex provides a notify hook. Use the included bridge:

chmod +x examples/codex_notify_bridge.sh
BRIDGE_PATH="$(realpath examples/codex_notify_bridge.sh)"
echo "$BRIDGE_PATH"

Add to ~/.codex/config.toml:

notify = [
  "/absolute/path/to/examples/codex_notify_bridge.sh"
]

Optional debug logs:

export AGENT_NOTIFY_DEBUG=1

Log location: ~/.agentnotify/logs/codex_notify.log

Claude Code

Configure hooks in .claude/settings.local.json (or user settings):

{
  "hooks": {
    "Stop": [
      {
        "matcher": "*",
        "hooks": [
          {
            "type": "command",
            "command": "agent-notify claude-hook --event Stop --name claude-code --channel both --quiet-when-focused --chime ping"
          }
        ]
      }
    ],
    "SubagentStop": [
      {
        "matcher": "*",
        "hooks": [
          {
            "type": "command",
            "command": "agent-notify claude-hook --event SubagentStop --name claude-code --channel both --quiet-when-focused --chime ping"
          }
        ]
      }
    ]
  }
}

Gemini CLI

Configure AfterAgent hook:

{
  "hooksConfig": {
    "enabled": true
  },
  "hooks": {
    "AfterAgent": [
      {
        "matcher": "*",
        "hooks": [
          {
            "type": "command",
            "command": "agent-notify gemini-hook --name gemini --channel both --quiet-when-focused --chime ping",
            "timeout": 10000
          }
        ]
      }
    ]
  }
}

Ollama

  • Pure interactive ollama run currently has no native per-turn completion hook.
  • If you use ollama launch codex or ollama launch claude, configure Codex/Claude hooks above.
  • For non-interactive JSON output (--format json), pipe into agent-notify ollama-hook.

Example:

ollama run llama3 --format json | agent-notify ollama-hook --name ollama --channel both

Core Commands

agent-notify run -- <cmd...>

  • Run and notify on completion.
  • Wrapper exits with the same exit code as the wrapped command.

agent-notify watch --pid <pid>

  • Watch an existing process ID until exit.

agent-notify test-notify

  • Send a sample notification.

agent-notify tail --file <path> --pattern <text>

  • Notify when a log pattern appears.

agent-notify shell-init

  • Generate shell hook script for process-exit notifications.

Hook bridge commands used by integrations:

  • agent-notify gemini-hook
  • agent-notify claude-hook
  • agent-notify codex-hook
  • agent-notify ollama-hook

Common Customizations

Suppress notifications while terminal is focused (macOS):

agent-notify gemini-hook --quiet-when-focused

Add sound:

agent-notify claude-hook --chime ping

Force console output:

agent-notify run --channel console -- your-command

Configuration

Environment variables:

  • AGENT_NOTIFY_TITLE_PREFIX="Agent"
  • AGENT_NOTIFY_CHANNELS="desktop,console"
  • AGENT_NOTIFY_TAIL_LINES=20
  • AGENT_NOTIFY_POLL_INTERVAL=1.0

Optional TOML config at ~/.agentnotify/config.toml:

title_prefix = "Agent"
channels = ["desktop"]
tail_lines = 20
poll_interval = 1.0

Environment variables override file values.

Troubleshooting

I only get notifications when I exit the CLI

You are likely using shell-init mode. That is process-exit based.

Use task-level hooks (codex-hook, claude-hook, gemini-hook) instead and remove shell-init lines from your shell startup file.

Desktop notifications do not appear

  1. Test fallback path:
    • agent-notify test-notify --channel console
  2. Verify platform backend:
    • macOS uses osascript
    • Windows uses PowerShell/BurntToast (with win10toast fallback)

Codex notifications not firing

  1. Confirm notify is configured in ~/.codex/config.toml.
  2. Confirm bridge script is executable: chmod +x examples/codex_notify_bridge.sh.
  3. Enable bridge debug logs with AGENT_NOTIFY_DEBUG=1 and inspect ~/.agentnotify/logs/codex_notify.log.

Platform Notes

macOS:

  • Desktop notifications via Notification Center (osascript).

Windows:

  • Primary backend: PowerShell + BurntToast.
  • Optional fallback dependency: pip install "agent-notify[windows]".

For Maintainers

Development checks:

python -m pip install -e ".[dev]"
ruff check .
pytest -q
python -m build
twine check dist/*

Release checklist:

  • docs/release_checklist.md

Project/process docs:

  • docs/project_charter.md
  • docs/scrum_working_agreement.md
  • docs/assumptions.md
  • docs/commit_plan.md
  • SECURITY.md

License

MIT (LICENSE)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

agent_notify-0.1.1.tar.gz (26.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

agent_notify-0.1.1-py3-none-any.whl (30.2 kB view details)

Uploaded Python 3

File details

Details for the file agent_notify-0.1.1.tar.gz.

File metadata

  • Download URL: agent_notify-0.1.1.tar.gz
  • Upload date:
  • Size: 26.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.8

File hashes

Hashes for agent_notify-0.1.1.tar.gz
Algorithm Hash digest
SHA256 39d0ff74c185f39f7f74355c60c4f835e05c7aa9090332f7420355599166190f
MD5 df33252df43a6d5b9819c9f281f45b88
BLAKE2b-256 254d728809d693f9bc72b553bcda8e40b9ab0726974dc164f909d3af9faccdf4

See more details on using hashes here.

File details

Details for the file agent_notify-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: agent_notify-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 30.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.8

File hashes

Hashes for agent_notify-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 8e9b357e4af01e5d118a4eca230d55d384ee873d9f6de2bc40c7fa6e3d2c4936
MD5 2bb92b4c5a9edf2345adf85bdc3e217d
BLAKE2b-256 053f4e58261708d26d1bc9ac2892f33a32e28e47062af710b0bc44ba2b47e32a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page