Get an AI Agent Notification on Your Phone When a Long Run Finishes
An AI agent notification hits your iPhone the moment a long agent run finishes, success or crash. Wrap your loop in four lines of Python.

You kick off an agent to refactor a module and open a PR. It starts churning through tool calls: read a file, run the tests, edit, run them again. You tab away to answer a Slack message. Twenty-five minutes later you glance back and realize you have no idea whether it finished, is still thinking, or died on a rate limit ten minutes ago.
That gap is the whole problem. An agent run isn't a script with a known runtime. Depending on how many steps it decides to take, the same task might wrap up in three minutes or grind for forty. So you either babysit the terminal, which defeats the point of an agent, or you walk away and lose the thread.
The fix is boring and it works: have the agent ping your phone the moment it stops. One HTTP POST at the end of your run, and you get an AI agent notification on your iPhone with the result. No SDK, no dashboard to keep open. Here's the whole thing.
The one call that pings you when the agent stops
Whatever framework you're using (a LangChain loop, a raw OpenAI or Anthropic tool loop, your own hand-rolled while loop), it eventually returns or raises. Wrap that in a try/except and fire one request. This is the entire integration:
import requests
API_KEY = "YOUR_API_KEY"
ENDPOINT = "https://thenotification.app/api/sendNotification"
def notify(title, body, link=None):
payload = {"title": title, "body": body}
if link:
payload["link"] = link
requests.post(ENDPOINT, headers={"app_key": API_KEY}, json=payload)
try:
result = run_agent(task="Refactor the auth module and open a PR")
notify("Agent done ✅", result.summary[:180])
except Exception as e:
notify("Agent crashed ❌", str(e)[:180])
Really just one header to set: app_key. The requests library adds Content-Type: application/json for you when you pass json=. Grab your key from the app after you sign in, drop it in, done. The full field list (title, body, and the optional link and image) is in the API reference.
Put the agent's actual answer in the notification
A ping that just says "done" makes you open the laptop to find out what happened. Skip that step: send the agent's final message as the notification body, so you can read the outcome from your lock screen and decide whether it's worth walking back to your desk.
final = result.messages[-1].content
notify(
title="Agent finished: auth refactor",
body=final[:180],
link="https://github.com/you/repo/pull/42",
)
Keep the body short: a notification isn't a log file. The first 180 characters of the agent's summary is plenty to tell "opened PR #42, all tests green" apart from "gave up, couldn't resolve the merge conflict." The link field makes the notification tappable, so one tap drops you straight onto the PR. There's a full Python guide if you want the longer version.
Not writing Python? Append it to the command
If you launch your agent as a command-line tool, you don't need to touch its code at all. Chain a curl onto the end with && so the ping only fires on a clean exit:
python run_agent.py && \
curl -s -X POST https://thenotification.app/api/sendNotification \
-H "app_key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"title":"Agent done","body":"run_agent.py exited cleanly"}'
Swap && for ; if you want the ping regardless of exit code. This is the same trick that works for any long-running script: an agent is just a script that decides its own length.
If you're running one specific client
The code above is deliberately framework-agnostic because most agent setups are homegrown. But if your "agent" is a named tool with a completion hook, use the hook instead of wrapping anything. It's cleaner. For terminal-based coding agents, the Claude Code notification setup uses a Stop hook that fires automatically when the run ends, no glue code required.
The real talk: watch your notification count
Fair warning: the free tier is 100 notifications total, not per month, total. That's fine for pinging yourself once at the end of each agent run. But if you drop a notify() inside the agent's step loop so it fires on every tool call, a single chatty run can eat 30 notifications and you'll hit the wall in an afternoon. Ping once per run, at the end. If you genuinely need more headroom, Pro is $2.99/month for 1,000 notifications a month: that's about 33 agent runs a day, every day, before you'd notice the ceiling.
Wire it up once
Agent runs are the perfect case for this: unpredictable length, easy to forget, and you actually care about the result. Add the four lines, walk away, and let your phone tell you when it's done. Worth a look if you're tired of alt-tabbing to a terminal to check on a robot, grab a key at thenotification.app and wire your next run up in five minutes.
New to this? Start with what an MCP server is.



