---
title: AI coding agents
description: Get push notifications when Cursor, Claude Code, Codex, or other AI agents finish work — using hooks and Trigv.
---
# AI coding agents

Start a long agent task, walk away, get a push when Cursor, Claude Code, or Codex finishes — or when it needs your attention.

## How it works

<ol>
  <li>You save a small shell script that calls Trigv.</li>
  <li>Your AI tool runs that script when the agent stops (via "hooks").</li>
  <li>Trigv sends a push to your phone.</li>
</ol>

## Before you start

- API key exported as `TRIGV_API_KEY` in your shell ([create one](/docs/learn/api-keys))
- Optional: create an `agents` channel in the dashboard
- `curl` and `jq` installed (macOS: usually pre-installed or via Homebrew)

## Step 1 — Save the notify script

Create `~/.local/bin/trigv-notify.sh`:

```
#!/usr/bin/env bash
set -euo pipefail

TITLE="\${1:-Agent finished}"
DESCRIPTION="\${2:-}"
CHANNEL="\${TRIGV_CHANNEL:-agents}"
LEVEL="\${TRIGV_LEVEL:-info}"

: "\${TRIGV_API_KEY:?Set TRIGV_API_KEY}"

PAYLOAD=$(jq -n \
		--arg channel "$CHANNEL" \
		--arg title "$TITLE" \
		--arg description "$DESCRIPTION" \
		--arg level "$LEVEL" \
		--arg event_type "agent.completed" \
		'{channel: $channel, title: $title, description: $description, level: $level, event_type: $event_type}')

curl -sS -X POST https://api.trigv.com/api/v1/events \
		-H "Content-Type: application/json" \
		-H "Authorization: Bearer \${TRIGV_API_KEY}" \
		-d "$PAYLOAD" >/dev/null
```

Then run: `chmod +x ~/.local/bin/trigv-notify.sh`

## Step 2 — Test manually

```
export TRIGV_API_KEY=trgv_...
~/.local/bin/trigv-notify.sh "Test" "Hooks will work"
```

Check your phone before wiring hooks.

## Step 3 — Pick your tool

- [Cursor](/docs/learn/cursor) — hooks in `.cursor/hooks.json`
- [Claude Code](/docs/learn/claude-code) — hooks in settings
- [OpenAI Codex](/docs/learn/codex) — hooks in config.toml
- [Other agents](/docs/learn/other-agents) — wrapper scripts

<div>
  <strong>Keep keys out of git.</strong>
  Use environment variables — never commit API keys in hook config files.
</div>
