Skip to content
use-cases / wake-agent-at-3am / hero
Cron · Agent · Containers

Wake an agent at 3am, retire it at 4

A nightly job that scans yesterday's billing exceptions, clusters duplicates and writes a triage note. It only needs to exist for about an hour a day. Two cron entries spin a fresh agent container up at 02:59 and tear it down at 04:01. The other 23 hours, it is not running, not warm, not billed.

Read the docs
use-cases / wake-agent-at-3am / mechanism

Two cron entries, one short-lived container

There is no warm pool, no scheduler service, no glue daemon polling for work. A hoody-cron entry POSTs to hoody-agent's spawn URL at 02:59. The agent does its run and exits. A second cron at 04:01 calls DELETE to be sure the container is gone. That is the whole machine.

POST cron.hoody.com/users/root/entries
Wake trigger · 02:59
// Cron entry that fires once a day and POSTs the spawn requestPOST cron.hoody.com/users/root/entries{ schedule: "0 3 * * *", command: "curl -X POST $AGENT_URL -d @prompt.json", comment: "billing-reconcile · 3am wake"}
fires at 02:59 →
POST api.hoody.com/api/v1/projects/$PID/containers
Spawn agent · ai + hoody_kit
// The agent boots, reconciles yesterday's invoices, writes notes, exitsPOST api.hoody.com/api/v1/projects/$PID/containers{ name: "billing-reconcile-$(date +%s)", ai: true, hoody_kit: true, autostart: false}
container exits, second cron fires at 04:01 →
DELETE api.hoody.com/api/v1/containers/$CID
Teardown · 04:01
// Belt-and-braces: a second cron asserts the container is goneDELETE api.hoody.com/api/v1/containers/$CID// Response from hoody-containers200 OK · container deleted

Two cron rows in a database. One agent image. The container only exists for the work, then it stops existing. No warm pool, no scheduled-task primitive, no lifecycle daemon you have to operate yourself.

use-cases / wake-agent-at-3am / night

What the night actually looks like

Five moments. The agent is alive for the middle three. Outside this hour the row in the containers table is gone.

  1. 02:59Cron · wake

    Cron entry billing-reconcile-wake fires. It POSTs to api.hoody.com with ai: true and hoody_kit: true. A fresh container spins up with a clean filesystem and the agent's prompt loaded.

  2. 03:02Agent · read

    The agent reads yesterday's billing-exceptions table over Hoody SQLite and asks an LLM to cluster the rows by reason code — either through the Hoody AI Gateway (provider cost + 5%, drawn from your AI Balance) or BYO key direct to Anthropic / OpenAI / your provider. No file-share mounts. Just URLs.

  3. 03:31Agent · write

    It writes a single triage note per cluster back to the same SQLite URL, then sends one notification with the daily summary. Total wall time so far: about thirty minutes.

  4. 03:58Agent · exit

    The agent process returns 0 and the container exits on its own. Hoody-containers marks it stopped. From this second forward, nothing about the agent is running, warm, or billed.

  5. 04:01Cron · retire

    A second cron entry fires DELETE on the container id. If the agent already exited, this is a no-op 200 OK. If it hung, the container is torn down anyway. Idempotent and unsupervised.

Five timestamps, two cron rows, one container that lives for sixty-two minutes. The night runs itself, and you find out it ran by reading the triage note in the morning.

use-cases / wake-agent-at-3am / powers

Why this lifecycle shape works

An always-on worker is the wrong shape for a job that runs once a day. On Hoody the substrate is flat-rate — the win isn't per-second billing, it's no warm pool, no scheduler service, no glue daemon to operate.

Idle costs nothing extra

The container does not exist between runs

There is no warm pool sitting in memory. No 'scheduled task' service holding state. The row in the containers table is gone for twenty-three hours of the day. The flat-rate server you already rent runs the work; idle hours don't generate a separate line item.

No per-run line item

The server bill doesn't change

Hoody bills the box, not the runtime. A 60-minute nightly agent and a 24/7 always-on worker land on the same flat-rate server invoice. The win isn't 'pay only for what you use' — it's not paying twice for warm-pool overhead you don't need.

No lifecycle code

Two cron rows, no glue daemon

You do not write a wake-up Lambda, a 'spin the container' worker, or a watchdog that retires it. Hoody-cron POSTs. Hoody-containers spawns. The agent exits. A second cron POSTs DELETE. That is the entire surface area.

use-cases / wake-agent-at-3am / economics

The cost of an idle agent

Most agent platforms keep the worker warm twenty-four hours a day so it is ready in under a second. For a 3am batch job that is exactly the wrong tradeoff. Cold-spawn in a few seconds is fine when the schedule is yours.

Always-on agent24h × 30 days
720h / mo

An always-on agent container, or a warm-pool seat reserved for an agent that runs once a day, is alive 720 hours a month. 719 of those hours, it is doing nothing.

Idle is the line item on per-second platforms
Wake-and-retire1h × 30 days
30h / mo

A short-lived container spawned by a cron entry exists for one hour a night. Thirty hours a month, total. The agent process returns 0 and the row in the containers table is gone.

  • MON02:59 → 04:0162m alive
  • TUE02:59 → 04:0060m alive
  • WED02:59 → 03:5858m alive
  • THU02:59 → 04:0061m alive
  • FRI02:59 → 04:0060m alive
  • SAT02:59 → 03:5959m alive
  • SUN02:59 → 04:0060m alive
Server bill unchanged

Hoody bills the server, not the runtime. The 'alive' column shows when the agent existed each night — the same flat-rate server runs whether it's there or not. Pricing starts at $29/month and varies by spec, region, and rental duration.

use-cases / wake-agent-at-3am / punchline

An agent that exists only when there's work for it to do.

Hours alive per day1h02:59 → 04:01, then gone
Server bill change0Flat-rate, alive or idle
Lifecycle code you write0Two cron rows, no daemon
See the spawn API
use-cases / wake-agent-at-3am / replaces

What this replaces

The patterns that pay for an agent to exist around the clock. On Hoody, the agent runs inside the flat-rate server you already rent — no warm pool, no scheduler service, no per-second meter.

  • Always-on agent containers23 idle hours, billed at the active rate
  • AWS Lambda warm-poolsPay to keep cold-starts away from cron
  • Modal Labs scheduled tasksClosed runtime, opaque billing
  • Custom warm-cold lifecycle codeThree weeks to write, six months to debug
  • Polling /spawn endpointsA second cron whose only job is launching the first
  • Hetzner GPU box always running$200/mo for one daily inference
use-cases / wake-agent-at-3am / cta

An agent that exists only when there's work for it to do.

Read the docs
use-cases / wake-agent-at-3am / related

Read the others