Monitor a scheduled AI agent or LLM job
More and more scheduled jobs call an AI model: a nightly summary of yesterday's tickets, an agent that sorts incoming email, a script that asks a model to classify new rows. They run unattended, so when one stops working nobody notices until someone asks where the report went.
Why AI jobs fail quietly
An AI job is a normal scheduled script with one fragile step in the middle: a call to a model's API. That step fails in ways a scheduler can't see:
- The API is busy or you hit a limit. The model providers return errors such as "rate limit" (429) or "overloaded" (529, on the Claude API). Many scripts catch the error, log it and exit normally.
- The quota or credit ran out. Both the OpenAI and Claude API docs say these errors keep failing until you add credit or raise the limit; retrying doesn't help. A job that retries quietly can fail every night for weeks.
- The answer is empty. One developer describes an agent that returned exit code 0 with an empty response when its quota ran out, so everything around it treated the run as a success (DEV Community, 2026).
- The job never started. A missing API key in the scheduler's environment, a different shell, a machine that was asleep: SD Times calls it the most common case, "your agents aren't failing, they're not running" (2026).
Tracing tools and the provider's dashboard show the calls that happened. Neither tells you about the run that didn't happen, or the run that "worked" and produced nothing.
Let the job report its own run
Add a few lines to the script: a ping when it starts, a ping when it finishes, and a failure ping with the error message when the model call (or anything else) fails. TaskBeacon knows the schedule, so it also notices when no ping arrives at all.
# --- TaskBeacon: top of the script (standard library only) ---
import json, traceback, urllib.request
TB = "https://taskbeacon.io/ping/your-job-id"
def tb_ping(path="", data=None):
body = json.dumps(data).encode() if data else None
req = urllib.request.Request(TB + path, data=body, headers={"Content-Type": "application/json"})
try:
urllib.request.urlopen(req, timeout=10)
except Exception as e:
print("TaskBeacon ping failed:", e)
tb_ping("/start")
try:
# --- your code here ---
df = [1, 2, 3] # example data: replace with your own (e.g. pandas.read_csv)
except Exception as e:
# the error and the last 20 lines of the traceback go with the failure
tb_ping("/fail", {"error": f"{type(e).__name__}: {e}"[:200],
"log": "\n".join(traceback.format_exc().splitlines()[-20:])[-4000:]})
raise
# --- TaskBeacon: end of the script ---
tb_ping("", {"rows": len(df)})In the app, the Code tab of your job gives you this code with the job's own address instead of your-job-id, and you can untick the parts you don't need.
Then add one number that says the job did its work, for example how many items it summarised or classified, or the length of the answer. A rule on that number turns a run that finished with nothing into Odd data: see alert on an empty or too-short answer.
Rather not edit the script yourself? On your job's Code tab, click Copy prompt for your AI. It copies a ready message with your job's own lines; paste it into ChatGPT, Claude or Copilot, add your script at the end, and the assistant returns the script with the pings in place. Read the result before you run it.
What you get
- Failed with the error text, when the API call fails and the script reports it.
- Missed when the job didn't run at its time, including the nights it never started.
- Late when a run hangs, for example on a model call that never returns.
- Odd data when it finished but the number you send is 0 or far below usual.
Without TaskBeacon
Make the job fail loudly: don't swallow API errors, exit with a non-zero code when the model call fails or the answer is empty, and let the scheduler's own alerting report it. Set a spending alert at the provider so a used-up quota is noticed. For runs that never start you still need something outside the job that knows when it should have run, which is the part a script can't do for itself.
Connected Claude or ChatGPT to TaskBeacon? Ask it "what failed last night, and why?" and it answers from your jobs. How that works.
Related
In the Docs: Your own number · Statuses · Python.
- Get an alert when an AI job returns an empty or too-short answerExit code 0 with an empty answer is still a broken run.
- Find out when a scheduled job didn't run at allA run that never happened leaves no error to alert on.
- Get an alert when a Python cron job or scheduled script failscron reports output, not success or failure; Task Scheduler shows 0x1 to nobody.
- Ask Claude or ChatGPT what failed last nightOne question covers every job on every machine.
TaskBeacon is free to start, with every feature open for now and no credit card. Create a job, paste the code, and the first ping shows up on the job page.
Start free View live demoSources
- Claude API docs: HTTP errors (429 rate_limit_error, 529 overloaded_error) (undated; checked 2026-11-12)
- OpenAI API docs: Error codes (429 rate limits and quota) (undated; checked 2026-11-12)
- SD Times: Your agents aren't failing, they're not running (2026-08-03)
- DEV Community: The model worked, the cron job almost killed my AI agent (2026-05-21)
Page checked against its sources on 2026-11-09. Menus and limits of other products change; if something here no longer matches, write to support@taskbeacon.io.