Engineering · First-hand

Running scheduled AI agents in production: how do you catch a run that quietly failed?

An empty industrial control room with a long console of switches and gauges under a lit ceiling grid. Illustrative stock photo

Scheduled agents rarely fail loudly. A session crashes halfway and looks exactly like one that finished, a model returns an empty answer without reading the job, or a dead machine leaves work marked as taken. The fix is to stop trusting how a run ended and ask the server what actually got done.

Key takeaways
  • A quiet transcript tells you a session stopped, not that it finished. Check completion against server-side state.
  • Make the agent prove it read the job. Our server rejects any answer that lacks a receipt printed only inside the prompt.
  • Every claim a run takes on a piece of work needs an expiry, because a crashed machine never gives it back.
  • Retry until the server says the work is covered, cap the attempts, and stop after two attempts in a row that change nothing.
  • Leave people only the steps no API can do, and hand each one over as a link with the exact clicks.

Have an agent job running on a schedule today? This layer is part of what our AI web app service builds.

Where this comes from: on December 1, 2026 we read the scripts, server code and log folder behind the unattended runners of ConceptSEO, our SEO platform. A nightly runner opens one Claude Code session per website to work through the fixes its analyses filed, and a Monday runner opens sessions that write those analyses. Every count and date below was read from that folder or that code on that day. Anything we couldn't check, we left out.

What happens when an agent run exits early or stops halfway?

Usually nothing you would notice. Windows Task Scheduler starts our runner, the runner opens a Claude Code session per site, types the job in, and watches the session's transcript. It calls the session done when the last event is assistant text more than 120 seconds old and no subagent is still working. That rule is where most of our trouble began, because a session that crashed looks the same as one that finished.

On August 18, 2026, four attempts died mid-response on upstream API errors, and the runner scored all four as clean finishes. It now reads the last assistant text for an "API Error:" line, records a match as a crash, and gives that site another attempt.

The same night, one session asked a question. In an unattended run nobody answers, so it sat for the runner's full 900-second idle timer and was killed having shipped nothing. The question tool is now disabled when the session launches, and the job's instructions end with a standing rule: at any fork, take the most conservative option that can be undone, write down the choice, and keep going.

Time limits cut the other way too. In the nightly runner each attempt gets four hours and a whole run gets 24. On August 10, the Monday analysis runner's six-hour kill landed three minutes after a successful submit. The old loop treated any kill as fatal, so four sites went without an analysis that week with three retries unused.

How often a site needs more than one go: across 695 attempt logs from April 21 to December 1, 2026, covering 561 site-days on 22 projects, 89 site-days (16%) took a second attempt and 28 took three or more.

How unattended agent runs failed for us, and the check that now catches each one
FailureHow it shows upThe check that catches it
Session crashed mid-responseThe transcript goes quiet, just like a finishLast assistant text checked for an API error; scored as a crash and retried
Agent asked a questionA session waiting on an answer nobody will giveQuestion tool disabled at launch; a session that calls it is killed in seconds
Attempt killed after doing the workA timeout logged as a failure, and the retries skippedRetries decided by server coverage, not by how the attempt ended
Answer written without reading the jobA valid-looking empty resultServer rejects any answer missing the prompt's receipt
Machine died holding workItems stuck "in progress" for daysServer returns claims older than 24 hours to the queue
Deploy about to overwrite a client's editsNothing, until the edits are goneDrift check against production before any file is touched
Fix deployed but not liveItem marked done; the metric never movesA live fetch of the page before an item can be completed

How do you know a run really finished?

You ask something other than the run. The transcript can only tell you a session stopped. Whether the work is done is a fact the server holds, so that is where the runners look.

After every attempt, the Monday runner calls a read-only coverage endpoint that answers one question: does every site and analysis type in this week's cycle have an answer? If not, it starts another session, which picks up where the last one stopped. If two attempts in a row close nothing, it gives up rather than burn the budget. The nightly runner does the same per site and only logs "verified: 0 recs left" when nothing is waiting and nothing is still marked in progress.

Read-only is the important part. An earlier version checked liveness by calling the endpoint that hands out work, and every call created a row. By June that had left 45 orphaned failed rows behind.

Then there's the answer that looks right and isn't. On November 30, 2026, a session wrote an empty list of recommendations for 94 work units before it had fetched any of their prompts, and the server took it, so no site got the article it was owed that week. Each prompt now carries a short receipt, ten characters derived from the analysis id with a server-side key. An answer without the matching receipt gets an HTTP 422 telling the session to go read the prompt. A blind answer can't carry it.

The last layer doesn't run on the runner's machine at all. The server checks on Monday at 10:00 for analysis types that never arrived, and on Friday at 16:00, an hour before the weekly reports go out, for any site with no finished work that week or with work claimed for more than a day. The comment above that Friday job says why it exists: "This is the check that does not depend on that machine being alive." A separate weekly check caught a client's Google Business Profile going 14 days without a post, from September 22 to October 7, even though every run in that stretch had finished cleanly and done what it was asked. Each run was right on its own terms, and the gap only showed up when someone counted across all of them.

The rest of the platform these checks protect is in the ConceptSEO case study.

What should you log for every unattended run?

Enough that you can tell, a week later, what the agent did and why. Ours keep five things.

  • One log file per attempt, named by date, project and try number, so a retry never overwrites the record of the failure before it. Each holds what was sent, the assistant's text, every tool call, and the runner's own decisions.
  • The raw model response, written to disk before it is submitted, so a failed submit can be read and replayed.
  • A run summary sent to a phone: duration, sites complete, partial and stalled, and minutes, tokens and attempts per site.
  • A record on every work item of the exact model that did it, notes on what it found, and the before and after of every visible field it changed. Since October 5, 2026 the command-line tool refuses to mark an item complete without that before-and-after list, or an explicit statement that nothing visible changed.
  • A deploy manifest with the size, timestamp and SHA-256 of each file as it was deployed. It's the baseline the next run compares production against.

How do you stop one failed job from corrupting the next?

Assume every run can die at any line, and make sure what it leaves behind can't mislead the next one.

Start with claims, and give every one an expiry. A session marks the items it is working on as in progress, so a second session won't take them too. On August 4, 2026 the runner machine lost power mid-queue, and eight of one site's items sat claimed for three days. There are two layers now. A new session hands back claims older than 30 minutes that one of our agent sessions made. And a server job at 04:00 every day returns anything claimed for more than 24 hours, a limit set well past the four-hour attempt cap so it can never take work from a live run.

The 30-minute rule had its own bug. The runner starts a retry seconds after a session ends, so every leftover was always under 30 minutes old and got skipped. On July 28, seven of eight sites burned an attempt reclaiming nothing. Retries now say they are retries, and the age check is dropped for them.

Next, check production before editing it. Some of these sites have a CMS their owners edit directly, and those edits never reach our repository. On August 27, 2026 a client rewrote four pages in the CMS, and the next deploy came within one save of reverting them. Every run now compares production against the deploy manifest first, commits any file that changed as the client's edit, and only then starts work.

Don't mark anything done that you can't see live. If the deploy fails, nothing in that batch is marked complete. Each fix is fetched from the live site before its item closes. When the thing being fixed is measured over a window, such as an error rate over a day, one good request proves nothing, so the item stays in progress until the windowed number moves.

And cap the loop. An item the agent sets aside is handed back to it on the next Monday, at most twice. If it gets set aside again after that, it goes to a person. That keeps one hard problem from eating every future run.

None of this is about the model API being down; we covered that in what our apps do when the model API goes down.

What should still need a human?

Less than you'd guess, but not nothing. In our runners, people keep four things:

  • Merging code. An agent can open a pull request and fix review comments; a teammate approves and merges it.
  • Approving new copy on sites whose owners asked to read it first.
  • Clicks that have no API, such as Search Console's "Validate fix" button or reconnecting a Google account. Each arrives as a Telegram card with a direct link, numbered steps, and a signed "Mark it done" link. It reminds every three days, at most twice.
  • Anything that can't be undone, such as deleting files or dropping a page that ranks. The agent doesn't take that step; it does the reversible part and leaves the rest.

Everything else, the agent decides, picks the option easiest to reverse, and writes down why. What those runs fixed over 20 weeks, 1,683 changes across eight sites, is in our audit benchmark.

Methodology, and reusing these figures

Every count on this page was read on December 1, 2026. The attempt figures come from the runner's log folder: we counted files named by date, project and try number (695 of them, April 21 to December 1, 2026), folded second-pass retries into their site-day, and counted site-days with more than one file. Time limits, the receipt check, claim expiry and the server's check schedule were read from the runner scripts and the ConceptSEO source. Incident dates and their counts are quoted from comments written into that code when each fix went in. The 20-week benchmark figure is from its own page.

The limit worth stating: this is one shop's runners, on one Windows machine, driving one agent tool. The failure shapes carry over to other schedulers and models. The thresholds are ours, tuned to our jobs, and yours will differ.

You may republish these figures with attribution and a link to https://concept211.com/articles/scheduled-ai-agents-in-production/. Every heading and table row above carries a stable id, so you can link to a single figure.

Photo by Pexels on Pixabay. Illustrative, and not our control room.

Work with us

Would you know if last night's agent run failed?

Completion checks, receipts, claims that expire and a short list of human steps are what decide whether you hear about a failed run the same day or a week later.

Start a project
All articles