3
start decisions
GO, SKIP, or FATAL before expensive AI work can begin.
Deep-dive case study
This overnight content system does not start with an expensive AI call. It checks whether there is healthy, worthwhile work first, respects daily capacity, and stops after a fixed time and number of attempts.
It also cannot fail silently. A terminal problem or missing report evidence triggers an explicit notification and heartbeat path, so your team does not have to guess what happened overnight.
At a glance
3
GO, SKIP, or FATAL before expensive AI work can begin.
7
Four publishing properties and three refresh properties are checked first.
3.5h
The entire overnight run has one firm outer time limit.
3
Recovery is bounded instead of turning into open-ended retrying.
The problem
Starting an AI job just because a timer fires is not a business process. There may be no approved work, no remaining capacity, or a connected system may already be unhealthy.
The second worry is quiet failure. When there is no morning update, your team should not have to reverse-engineer whether the queue was empty, a service was unavailable, the model stalled, or the report never happened.
This design solves both problems outside the AI prompt. It uses clear checks, hard limits, recorded state, and defined notifications so the automation behaves like an accountable operating process.
The business rule
Do not spend on AI until the system can show there is useful work to do. If it stops, tell someone clearly rather than making silence look normal.
How it works
Every step answers a simple question: should this system continue, and what evidence will show the team what happened?
A scheduled overnight controller starts the job and makes sure another copy cannot work on the same queue at the same time. That prevents competing changes and gives the team one clear record for the night.
Produces
One accountable run with a dated log and a single owner for the work window.
If something goes wrong
Missing setup or an unavailable lock stops the run. The system will not work around the controls that keep jobs from overlapping.
The daily cron invocation starts a shell runner on the dedicated automation machine. It loads its environment, takes an exclusive flock lock, and records a dated log.
A second invocation exits rather than competing for the queue. The same lock prevents daytime refill work from overlapping the core run; missing configuration or lock failure is terminal.
Before any expensive AI call, the system checks access, queue status, available daily capacity, and the health of seven connected work areas. It then returns GO, SKIP, or FATAL.
Produces
A deliberate start, no-work, or stop decision that a business operator can understand.
If something goes wrong
A broken safety dependency, failed sign-in, or no viable workstream blocks the expensive path. One unhealthy property can be set aside while the healthy work continues.
Before the agent invocation, the read-only precheck verifies required local tools, validates dashboard access, probes all configured databases with constrained retries, reads queue state, and calculates remaining daily publishing and refresh capacity.
It checks four publishing properties and three refresh properties. The result is GO, SKIP, or FATAL; one failed property can be excluded without discarding viable work elsewhere.
Only a GO decision reaches the work plan. The system starts from work already in the review queue, respects daily limits, carries forward approved unfinished items, and uses inexpensive checks before image work or other higher-cost tasks.
Produces
A short, prioritized plan for work that is eligible and worth doing tonight.
If something goes wrong
If a low-cost prerequisite check fails, the item is held before expensive work begins. A temporary read problem does not incorrectly erase the possibility that needed work exists.
The controller limits the entire run to 3.5 hours and no more than three attempts. It records state-changing work as it happens, watches for repeated early errors, and only changes providers for recognized infrastructure problems.
Produces
Bounded progress with a reliable point to resume from if the night ends early.
If something goes wrong
Editorial, quality, or publishing problems do not prompt a costly provider switch. If time or attempts run out, unfinished work remains visible instead of being forced through.
The runner removes token-metered API-key fallbacks, applies a 3.5-hour outer budget, and caps the run at three attempts. It watches for early stagnant errors and changes providers only for classified infrastructure failures.
Editorial, quality, and publishing failures do not switch providers. The persisted date-based ledger records state-changing actions so a later attempt can resume from known state.
A quality check reviews work before and after publishing. The run must leave the required report evidence and send its summary; outside monitoring also receives a heartbeat that says the system is alive.
Produces
A quality-gated result with a durable record and an operator-facing summary or failure message.
If something goes wrong
A missing report is treated as failure, not as success by silence. Terminal failures and missing evidence enter an explicit notification-and-heartbeat path.
A Python quality-control pass checks articles before and after publishing. The prompt must produce a standalone report sentinel only after its summary email is accepted, while the runner posts a heartbeat for independent observation.
If the report sentinel is absent, the runner enters the failure-email path rather than accepting a quiet exit as success. Terminal paths call the failure-email helper and log notification-delivery problems explicitly.
What the night looks like to an operator
You get one of three understandable outcomes: work began because it was justified, no work was needed, or a problem stopped the run and triggered a defined alert. There is no mystery charge for an empty queue.
The decision comes first
SKIP is a healthy outcome when there is no eligible work. FATAL is a visible stop when a required condition is broken.
Before the AI call
How the pieces fit together
The AI runner has a defined place in a wider operating system. Separate components decide readiness, keep state, check quality, and prove that the run reached an outcome.
Cron · Bash · flock
A daily overnight controller owns the work window and prevents a second run from changing the same queue.
Why it matters
One owner avoids conflicting work and makes the status of the night easy to explain.
Shell precheck · health checks · read-only data queries
A first pass checks access, connection health, queues, and daily capacity without changing content.
Why it matters
The system can decide whether to spend money from facts, before an AI model is asked to do anything.
Account-authenticated Claude runner · classified fallback
The AI runner is reachable only after approval, with token-metered fallback keys removed from its environment.
Why it matters
Premium model capacity cannot become the automatic first step for every scheduled night.
Python quality checks · JSON ledger · structured logs
A dated record captures each state-changing action, while quality checks cover links, anchors, images, formatting, and the published result.
Why it matters
The next attempt knows what has already happened instead of guessing or repeating work.
Transactional email · heartbeat endpoint · monitor snapshots
The controller sends summaries and terminal-failure messages while separate monitoring receives status snapshots.
Why it matters
A quiet morning cannot be mistaken for a successful run when a job actually stopped.
Automations and safeguards
The system checks for value before spending, caps its own time and recovery, and proves that a finished-looking run actually left the evidence an operator needs.
The executable precheck runs before the AI command. If the check is missing or cannot run, that is a FATAL condition, so the expensive path cannot accidentally bypass the gate.
GO starts eligible work. SKIP reports that no work is needed and sends a healthy heartbeat. FATAL blocks the run and starts the alert path.
The plan begins with queue state and low-cost checks. It does not inspect images or reopen broad content work until the practical prerequisites pass.
Per-property publishing and refresh limits are read before action. Approved unfinished work is carried forward as known state instead of being rediscovered by another AI pass.
Actions have retry limits, a property can trip a hard-failure breaker, and broad repeated failures stop the portfolio rather than multiplying bad actions.
Terminal failures call the failure-email helper. If notification itself cannot be delivered, the controller logs that failure clearly rather than pretending the operator was informed.
Decision
What the team can expect
GO
Eligible work is ready, so the controlled run starts within its 3.5-hour and three-attempt limits.
SKIP
There is no worthwhile work tonight. The system reports that result and sends a healthy heartbeat without paying for AI work.
FATAL
A required safety condition failed. The run stops before expensive work and uses the explicit notification path.
The guardrail in one sentence
The automation must prove that a task is worth doing, stay within its budget, and leave either evidence of success or an explicit alert. It cannot quietly run forever or quietly disappear.
In other words, the budget is enforced by the operating system around the AI work, not by asking the model to spend carefully after the fact.
What it replaces
Before
An overnight job can start simply because a timer fired, even when nothing is eligible, capacity is gone, or a dependency is unhealthy.
After
A tier-0 precheck records GO, SKIP, or FATAL before the AI-capable runner is allowed to begin.
Before
An AI service can spend time revisiting completed work, looking at assets too early, or retrying without an overall limit.
After
The plan proves work is necessary with low-cost checks first, while the controller enforces attempt and time budgets.
Before
A failed overnight run may be discovered only after someone investigates an unexplained lack of output.
After
Precheck failure, exhausted attempts, and missing report evidence each have defined notification and heartbeat behavior.
Before
A partial run can leave staff unsure what was approved, published, or still waiting for attention.
After
A dated daily ledger records state changes as they happen, creating a precise resume point and a reliable record.
The system uses a wall-clock budget, a persisted daily ledger, and heartbeats to make overnight work observable.
What this means for your business
Every technical term used on this page, explained without jargon.
Build for the quiet hours
AK Internet Consulting designs AI operations around explicit gates, finite budgets, durable state, and failure paths a real team can operate.