Published October 21, 2026
How to Know When Your AI Agent Stops Running
More and more scheduled work is being done by AI agents: a nightly agent that triages support tickets, a morning research digest, an agent that updates a CRM from emails, a bot that writes and posts content on a schedule. These run unattended, which is the point. It's also the problem, because when they stop, nobody's watching.
Agents fail in all the ways cron jobs do, plus a few new ones. This guide covers what those failures look like and a practical setup to catch them: heartbeats for "did it run," and output checks for "did it do anything useful."
How scheduled agents fail
It never started. The agent is triggered by cron, a GitHub Actions schedule, a Vercel cron, a workflow tool like n8n, or a hosted agent platform's scheduler. Any of those triggers can silently stop firing: a schedule disabled, a server that rebooted without the cron daemon, a deploy that dropped the config.
It crashed early. An expired API key, a changed SDK, a missing environment variable, or a provider outage. The process exits, the log line goes somewhere nobody reads, and the next run fails the same way.
It hung. A tool call waits on a network request with no timeout, a browser automation step sits on a page that never loads, or the agent loops between two tools. The process is technically alive, so a "did it crash" check sees nothing wrong.
It ran but did nothing. The LLM returned an empty or refused response, a retrieval step found zero documents, or the agent decided there was nothing to do every day for a week. Exit code 0, no output.
It ran and did the wrong thing. Output exists but is malformed, truncated, or off-task. This is the hardest to detect automatically, and you need some form of validation.
It ran out of budget. Hitting a spending cap or rate limit partway through can stop the work without a crash, depending on how your code handles 429s.
Layer 1: a heartbeat for "did it run and finish"
A heartbeat is a ping your agent sends to a monitor when it finishes a run successfully. CronNudge's default grace is 5 minutes. The form also offers 15 minutes and 1 hour, and the API accepts any whole number of seconds up to 7 days. If the ping doesn't arrive, you get an alert.
This catches "never started," "crashed," and "hung" in one go, because none of them reach the final ping.
Python agent
import sys
import urllib.request
HEARTBEAT_URL = "https://cronnudge.com/ping/<check-id>"
def ping():
try:
urllib.request.urlopen(HEARTBEAT_URL, timeout=10)
except Exception as e:
print(f"heartbeat failed: {e}", file=sys.stderr)
def main():
tickets = fetch_new_tickets()
results = run_triage_agent(tickets) # your agent loop
write_results(results)
return results
if __name__ == "__main__":
results = main() # any exception means no ping, and the monitor alerts
ping()
TypeScript agent
const HEARTBEAT_URL = process.env.HEARTBEAT_URL!;
async function main() {
const digest = await runResearchAgent(); // your agent loop
await publishDigest(digest);
}
main()
.then(() => fetch(HEARTBEAT_URL, { signal: AbortSignal.timeout(10_000) }))
.catch((err) => {
console.error(err);
process.exitCode = 1; // no ping, and the monitor will alert
});
From the scheduler, without touching agent code
If you can't change the agent, wrap it in the scheduler:
0 7 * * * cd /srv/agent && timeout 20m ./run-agent.sh && curl -fsS -m 10 --retry 3 https://cronnudge.com/ping/<check-id> > /dev/null
timeout 20m is important for agents. It turns a hang into a failure, so a stuck run doesn't hold everything up forever.
Layer 2: put timeouts everywhere
Hangs are the most common agent failure that looks like nothing is wrong. Set limits at every level:
- Whole run:
timeoutin the shell,timeout-minutesin GitHub Actions,maxDurationon Vercel. - Each LLM call: most SDKs accept a timeout. Set one explicitly rather than relying on defaults.
- Each tool call: HTTP requests, browser steps, and database queries all need their own timeouts.
- Agent loop: cap the number of steps or tool calls per run.
MAX_STEPS = 25
for step in range(MAX_STEPS):
action = llm.decide(state, timeout=60)
if action.type == "finish":
break
state = run_tool(action, timeout=30)
else:
raise RuntimeError(f"agent did not finish in {MAX_STEPS} steps")
The else on the for loop runs only if the loop never hit break, which turns a runaway loop into a clear failure, so no ping is sent.
Layer 3: check the output before you ping
A heartbeat proves the run finished. To catch "ran but did nothing," only send the ping when the output passes basic checks:
def output_is_sane(results) -> bool:
if not results:
return False # did nothing
if any(r.summary is None or len(r.summary) < 20 for r in results):
return False # empty or truncated
return True
results = main()
if output_is_sane(results):
ping()
else:
print("agent produced no usable output", file=sys.stderr)
sys.exit(1)
Good checks are cheap and boring:
- Count of items processed is above zero (or above a normal minimum).
- Required fields are present, and structured output parses as valid JSON against a schema.
- Length is within a sensible range.
- Output isn't identical to the previous run, if it's supposed to change.
Don't use another LLM call as your only check. It can fail in the same ways the agent did.
Layer 4: separate checks for separate stages
If your agent has distinct stages, like fetch, reason, and publish, give the critical ones their own check. A research digest might have:
- A check for "sources fetched" (pinged after retrieval).
- A check for "digest published" (pinged after posting).
If only the second one goes quiet, you know the problem is in the reasoning or publishing step, not the data source. One check per job is the minimum. One per critical stage is useful when runs are long.
Handle rate limits and outages on purpose
Decide how the agent should behave when the model provider is rate limiting or down:
- Retry with backoff on 429 and 5xx, with a cap on total retry time.
- Fail loudly when the cap is hit. An agent that quietly skips a run because of a 429 looks exactly like a successful empty run.
- Don't ping on a skipped run. Let the monitor alert you, and if outages are frequent and harmless, widen the grace period instead of hiding the failure.
What CronNudge records on an agent ping
The product accepts more than a bare URL hit. See scheduled agents for Python, Node, n8n, and cron, n8n for the HTTP nodes, and assertions, runs, and agents.
POST JSON to https://cronnudge.com/ping/<check-id> with status, duration_ms, steps, tokens, cost_usd, summary, and rows (or count as a query parameter). status of fail, failed, error, or down on the success URL is stored as a failure. GET, POST, and HEAD all count. The response is text/plain ok.
Ping /start when the run begins. If you set a max runtime and the finish ping never arrives, the check is marked stuck and alerts once. An assertion on count or rows can alert when a run exits successfully with an empty result. That is the output check CronNudge performs. It does not judge whether the prose is on-task.
Free includes assertions or run tracking on 3 checks. Pro removes that cap. Token and dollar limits are on Pro. Check counts stay 10 on Free and 100 on Pro. One alert when the check is down, and one when it recovers.
Where to send alerts
Agent failures are worth knowing about the same day. Free includes email and one Slack or Discord channel. Signed webhooks, which can forward into another incident tool, are on Pro. There is no SMS or phone alert, and no native pager integration.
A checklist for every scheduled agent
- Runs on a scheduler you can see and that's version-controlled.
- Has a timeout on the whole run, each LLM call, and each tool call.
- Caps the number of agent steps.
- Validates output before declaring success.
- Sends a heartbeat only after validated success.
- Has its own check, with a schedule and grace period that match reality.
- Logs enough context (inputs, step count, errors) to debug a failed run.
- Alerts go somewhere a person actually reads.
FAQ
How do I know if my AI agent ran today? Send a heartbeat ping at the end of every successful run and use a monitor that alerts you when the ping doesn't arrive on schedule.
My agent didn't crash, but it produced nothing. How do I catch that? Validate the output before pinging. If there's no usable output, exit non-zero and skip the ping, so the monitor treats it as a missed run.
What's the most common silent failure for agents? Hangs: a tool call or network request with no timeout. Add timeouts at every level and cap agent steps.
Can I monitor an agent on a no-code platform? If the platform can make an HTTP request as a final step, yes. Add a request to the ping URL at the end of the workflow.
Should I ping at the start of the run too? A start ping can help measure duration, but the important signal is the end ping after the work succeeds.
Is an LLM-based output check a good idea? It can supplement simple checks, but don't rely on it alone. Counts, schema validation, and length checks are cheaper and more predictable.
CronNudge watches scheduled jobs and agents with a ping URL. When a run is late or missing, you get an alert. Free covers 10 checks, with email and one Slack or Discord channel. Pro is $12 a month for 100 checks, and adds signed webhooks, the API, and agent cost alerts. Monitor your first agent.