Worked guide

Measure and cap the cost of a scheduled agent job

Run one representative task, calculate a monthly budget, and bound retries before you put it on a schedule.

You’ll finish with
A cost-per-run estimate, a schedule budget, and explicit iteration and retry limits.
Before you start
A working test profile and access to your provider’s usage or billing records.

1. Run the exact job once, manually

Use the same model, tools, input size and output format that the scheduled job will use. Start with synthetic data. Record the provider’s billed input and output tokens, number of model calls, and any paid search, browser or memory operations.

Use the provider’s billing or usage records as the cost reference. A chat’s token display can omit separately billed tools, cache rules or infrastructure. Do not create the schedule until one manual run finishes with the expected output.

2. Calculate the run and monthly cost

Worked example: 20,000 uncached input tokens at $2 per million plus 2,000 output tokens at $10 per million costs $0.06 per call. Five such calls cost $0.30 per run.

python3 - <<'PY'
per_call = 20_000 / 1_000_000 * 2 + 2_000 / 1_000_000 * 10
per_run = per_call * 5
print(f"Call: ${per_call:.2f}")
print(f"Five-call run: ${per_run:.2f}")
print(f"Daily for 30 days: ${per_run * 30:.2f}")
print(f"Every 30 minutes for 30 days: ${per_run * 48 * 30:.2f}")
PY

Expected: $0.06, $0.30, $9.00 and $432.00. Replace the rates, call count and frequency with your observed job. Current selected model rates are in the models guide.

3. Set the loop limits before scheduling

For a test profile, these current Agent settings provide a bounded starting point:

hermes config set agent.max_turns 12
hermes config set agent.api_max_retries 1
hermes config set agent.auto_recovery_cycles 0

Restart the process that will run the job so it loads the settings, then run the test again. SDK-level retries and fallback providers still apply. max_turns bounds agent iterations; it is not a dollar cap. A single large request can still be expensive, and tools can have independent charges.

Set the provider or project spending control too. Read whether it is a hard limit or only an alert. A budget notification that arrives after spending does not stop a runaway loop.

4. Start with one daily draft

  1. Schedule the job to save a draft report, without automatically emailing or publishing it.
  2. After the first scheduled run, check its output, calls, failures and provider bill.
  3. Pause it if it retries repeatedly, produces the wrong artifact, or exceeds the cost you budgeted.
  4. Only increase frequency after several representative runs fit the budget.

For the example above, a daily job budgets $9 per month in model calls; a half-hourly job budgets $432. Add paid tools, hosting, storage and tax separately.

5. Measure the local alternative in time and hardware

If you switch to a local model, repeat the same task and record elapsed time, peak RAM and VRAM, and whether tool calls work. A 20-minute local run that misses its next schedule is not an effective replacement for a one-minute hosted run.

Budget for hardware, electricity, backups and maintenance. Keep the selected model and context small enough to fit your actual machine; see the local-model starting point. Keep a short record of the model, date, settings and measured cost so the next upgrade has a comparison.

Sources and next steps

All practical guides