• agents
  • operations

Agents Don't Sleep

The rise of autonomous agents that run 24/7, initiate actions on their own, and why guardrails matter more than capabilities.

My phone buzzed at 3:14 AM. Not a call, not a text. A notification from a system I'd built three weeks earlier.

The agent had been monitoring a client's ad campaign performance data, running autonomously on a loop, checking metrics every fifteen minutes. At 3:11 AM, it detected a pattern: cost-per-acquisition had spiked 340% in the last two hours on a specific ad group, while conversion rate had dropped to near zero. Something was wrong. A landing page had gone down, and the ads were still running, burning budget on clicks that led nowhere.

The agent paused the affected campaigns, drafted a summary of what it found and what it did, and sent me the notification. By the time I read it over coffee at 7 AM, it had already saved the client several thousand dollars.

I didn't ask it to do any of this. It decided on its own, based on rules and thresholds I'd configured weeks ago. And that right there is the fundamental shift.

From Reactive to Proactive

For the entire history of software, programs have been reactive. They wait for input. A user clicks a button, an API receives a request, a cron job fires on schedule. The software responds. It never initiates.

Agents break this model. An agent is software that observes its environment, makes decisions, and takes actions without being asked. It doesn't wait for a button click. It watches, evaluates, and acts.

This sounds like a small architectural difference. It's not. It changes everything about how you design, test, deploy, and monitor a system.

The Anatomy of an Agent

At its core, an agent is an event loop with judgment. Here's what that looks like in practice:

  • Observation: The agent ingests data from its environment. API responses, database queries, webhook events, monitoring metrics. Whatever it needs to understand the current state of the world.
  • Evaluation: It passes that data through an LLM (or a chain of them) along with its instructions, context, and memory. The model assesses: is anything happening that requires action?
  • Decision: Based on the evaluation, the agent decides what to do. Often, the answer is "nothing." The interesting part is when the answer is "something."
  • Action: The agent executes its decision. Sends an email. Pauses a campaign. Updates a record. Creates a ticket. Whatever it's been configured to do.
  • Memory: The agent logs what it did and why, updating its context for the next loop iteration.

This cycle runs continuously. At 2 PM and at 2 AM. On weekdays and weekends. The agent doesn't sleep because it doesn't need to.

The Retry Problem

Here's where it gets interesting and where it gets dangerous. In traditional software, if an API call fails, you retry it. Simple. The operation is idempotent, the retry is safe, the worst case is a slight delay.

When an agent retries, it might make a different decision. The LLM is non-deterministic. The context has changed since the last attempt. A retry isn't just "do the same thing again." It's "re-evaluate the entire situation with slightly different inputs."

This means your retry logic can't be the standard exponential backoff you learned in distributed systems class. You need state machines that track where the agent is in its decision process. You need idempotency checks that verify the action is still appropriate, not just that it hasn't been performed yet. You need circuit breakers that prevent an agent from entering a loop where it keeps taking actions based on its own previous actions.

An agent that detects a problem, takes an action, then detects the action's side effects as a new problem, and takes another action... that's not autonomy. That's a feedback loop. And feedback loops at 3 AM with no human watching are how you get very expensive mornings.

Human in the Loop

The most important design pattern in agentic systems isn't technical. It's philosophical: autonomy requires responsibility.

An agent that can do anything but shouldn't do most of it is more dangerous than an agent with narrow, well-defined capabilities. The power of an agent is proportional to the harm it can cause. The art is in calibrating the boundary between autonomous action and human approval.

We use a tiered checkpoint system. Low-risk actions (logging, monitoring, alerting) happen automatically. Medium-risk actions (pausing campaigns, updating configurations) happen automatically but generate notifications. High-risk actions (spending money, sending external communications, modifying production data) require human approval before execution.

The agent queues the proposed action, explains its reasoning, and waits. Sometimes it waits thirty seconds. Sometimes it waits until Monday morning. The agent doesn't care. It has infinite patience because patience costs nothing to a machine.

The Night Watch

There's something profound about building software that works while you sleep. Not in the "cron job runs a backup at midnight" sense, but in the genuine sense of a system that observes, reasons, and acts on your behalf during the hours you're unconscious.

It requires a level of trust in your own engineering that's frankly uncomfortable. Every guardrail you implement is an admission that you don't fully trust the system. And you shouldn't fully trust it. That healthy distrust is what keeps the guardrails in place.

The agent that saved my client money at 3 AM didn't do it because it was intelligent. It did it because I'd spent weeks defining exactly what it should care about, exactly what it should do in response, and exactly where it should stop and ask a human. The intelligence was in the configuration, not the computation.

Autonomy requires responsibility. In code, as in life.

- MG

Staff Agentic Engineer. I run teams of AI agents that write, review and ship production software, and I write here every week about what that is teaching me.