Skip to content

Agents and multimodal systemsChecklist

Scheduled agent runs with no user: who pays at 3 a.m.?

A scheduled agent run has no user to notice a loop and no session cookie to say whose spend it is. This checklist covers owner attribution, per-schedule budgets, kill switches, failure and retry rules, and the alerts unattended runs need.

By INFRO Editorial

Published

9 min read

A glowing autonomous agent core coordinating tools, memory, and multiple AI model routes

In short

The team that created the schedule pays at 3 a.m., so every automation needs a named owner, its own spend ceiling, a rehearsed stop path and alerts that fire on failure and on silence. OpenAI's Agents API now starts sessions on a cron expression, which removes the human who used to be the last control 1.

Key takeaways

  • A schedule removes the human who used to notice a runaway run, so every control must be set before the first invocation.
  • Give each automation a named owner and a cost center that survive in a registry you control, because the create call documents a name and not an owner field.
  • Cap spend per schedule at a layer the agent cannot skip, and treat spend-limit errors as terminal rather than retryable.
  • Build the kill switch in three layers: stop future invocations, cancel sessions in flight, and cut the money path, then rehearse all three.
  • Alert on failure events and also on silence, because a schedule that stops running looks identical to a quiet night.

Why a schedule changes who pays

An interactive agent run has a person on the other end. They close the tab, complain, or file a ticket when it spins. A scheduled run has none of that. OpenAI's Agents API lets you start sessions on a cron expression and time zone, either as a new session or by continuing an existing one, and it lets an agent schedule tasks itself through an automations tool 1. Each firing is recorded as an invocation: an attempt to send a task to a session, with a status and a session ID 1.

So at 3 a.m. nobody is watching, and the spend lands on whoever owns the provider project the automation runs under. If that is "the platform team" by default, the cost has no owner and the first anyone hears of a problem is the invoice. The existing agent-loop bounding post assumes a run someone started; this checklist covers what changes when no one did.

Two scope notes. The automation API described here is a beta (OpenAI-Beta: agents=v1) 1, so re-check field names before you script against it. And these are controls to put in place, not a claim that any single one is sufficient.

1. Owner attribution

The point of attribution is that every invocation maps to one human team that can be paged and one cost center that is charged. The create example in OpenAI's documentation has a name, an expression, a timezone and a target; it shows no owner field 1. Sessions accept metadata on update 2, but I did not confirm that automations carry it. So assume the owner has to live in your own registry, with a naming convention as the backstop.

create_schedule.py
from openai import OpenAI

client = OpenAI()  # a project key dedicated to scheduled work

automation = client.beta.agents.automations.create(
    type="periodic",
    name="digest-billing | owner=team-billing | cc=1042",
    expression="0 10 * * *",
    timezone="America/New_York",
    target={
        "type": "new_session",
        "agent_id": "agt_123",
        "environment": {"type": "openai_hosted"},
        "input": [{"role": "user", "content": [
            {"type": "input_text", "text": "Summarize open billing disputes."}]}],
    },
)

# Your registry is the source of truth, not the name string.
registry.put(automation.id, owner="team-billing", cost_center="1042",
             max_usd_per_run=0.50, max_usd_per_day=5.00, on_call="billing-oncall")
  • Every automation has a named owning team and an on-call rota, recorded outside the provider.
  • Every automation has a cost center, so spend can be charged back and not just reported.
  • The automation name carries the schedule, owner and cost center in a form you can parse.
  • Scheduled work runs under its own provider project and key, separate from interactive traffic, so its spend is a line you can read.
  • If the agent may use the automations tool, a reconciliation job compares what exists against the registry and flags any schedule with no owner.

The last item matters because that tool lets an agent create schedules in the course of its work 1. A self-created schedule is a change nobody reviewed.

2. Per-schedule budgets

A schedule multiplies a per-run cost by a count you do not see. Set two numbers per automation: a ceiling per run and a ceiling per day.

The Agents API's own error codes show that limits exist at several levels: a session usage budget (session_budget_exceeded), a project spend limit, an organization spend limit and an OpenAI-assigned organization usage limit 3. I did not read where each is configured, so confirm which of them you can set and which you merely inherit. One detail from the error table matters for continue-session automations: for session_budget_exceeded the documented fix is "Start a new session to continue" 3. A schedule that keeps targeting one long-lived session could therefore hit that budget and fail every later run until someone intervenes. Test it before relying on it.

  • A per-run ceiling exists and is enforced where the agent cannot skip it (see the note on in-process limits in the loop-bounding post).
  • A per-day ceiling exists per schedule or per project, sized from expected runs times per-run cost, plus headroom you have chosen.
  • Spend-limit and balance errors are classed as terminal (section 4), and the scheduler stops dispatching when it sees one.
  • Prefer a new session per invocation unless you have a reason to carry history, and cap what a carried session can accumulate.
  • The schedule's frequency is part of the budget review: halving the interval doubles the exposure.

3. Kill switches

Build the stop path in three layers, because each one covers a gap in the others.

  1. Stop future invocations. Pause or delete the automation, or flip a flag your own scheduler checks before dispatch. I did not read which pause and delete operations the API reference offers, so check it and rehearse the exact call.
  2. Cancel sessions in flight. Stopping the schedule does not stop a run already started. The event stream includes agent.session.turn.cancelled as a lifecycle event 4, so know how your team cancels a turn and who is allowed to.
  3. Cut the money path. Revoke or rotate the provider key the scheduled project uses, or lower its spend limit, so that even a missed layer 1 or 2 stops costing money.

Saved-agent edits are not a kill switch. Updates to a saved agent apply only to new sessions, because each session copies the configuration when it is created 2. Changing the model or instructions on the saved agent will not alter a session already running or one a continue-session automation keeps feeding. For an existing session you can change tools, model, reasoning.effort or service_tier, and the change applies to new turns, not an active one 2.

  • The three layers are written down with the exact commands and who may run them.
  • On-call can run all three without asking the owning team for access.
  • You have rehearsed the stop path on a staging schedule in the last quarter.
  • Revoking the key is tested too: confirm the scheduler reports the resulting authentication_error and does not retry it forever.

4. Failure and retry behavior

A retry on a scheduled run is spend nobody approved. Decide per error class whether to retry, and cap attempts. OpenAI's error guidance separates failures that carry a retry path from those that do not 3.

FailureWhat OpenAI documentsScheduled-run policy
server_overloaded, rate_limit_exceededRetry unfinished work after a delay; if overload persists, change the model for later turnsRetry with backoff and a hard attempt limit
connection_failed, request_timeout, server_error, internal_errorCheck saved work, then retry with a limit on attemptsInspect saved items first, so a retry does not repeat completed side effects
flex_unavailableRetry later, or move later turns to the default service tierDecide ahead of time whether a tier change is allowed on this schedule
session_budget_exceededStart a new session to continueTerminal for this session; page the owner
project_spend_limit_exceeded, organization_spend_limit_exceeded, organization_usage_limit_exceeded, credit_balance_exhaustedFollow the shared billing guidanceTerminal; stop dispatching every schedule under the same limit and page
context_length_exceededReduce input, or start a new session with a shorter summaryTerminal for this run; fix the prompt
authentication_error, invalid_requestFix credentials or inputTerminal; never retried
Error classes from OpenAI's Agents API errors page, with a suggested policy for unattended runs. The policy column is a recommendation, not OpenAI's wording.

Two further points. A failed turn does not always mean the session failed, so retrieve the session before deciding whether to continue it 3. And for a 409 conflict the guidance is to retrieve current state before retrying 3. A retry that ignores saved work can re-run side effects such as emails sent or tickets filed, which is why a retry limit and a state check belong in the scheduler and not in the model's prompt.

  • Every error code above is mapped to retry, stop-this-run or stop-everything in code, not in a runbook paragraph.
  • Attempts are capped per invocation and per day.
  • Spend-limit errors halt the whole dispatch loop for that limit, not only the failing run.
  • Side-effecting tools are idempotent or check for prior completion.
  • You have decided what happens to a missed or overlapping run, and tested it, since I could not confirm how the platform handles either.

5. Alerts for unattended runs

Alerts for a scheduled agent have to cover three things: failure, cost and silence.

Failure. The event stream emits agent.session.turn.failed, agent.session.turn.cancelled, agent.session.failed, agent.session.environment.failed and error, and OpenAI's example treats all five as lifecycle failures 4. Route the same set to a pager. For a failed turn, retrieve the turn and read its status and error 3.

Cost. Page on spend, not only on errors: a run that succeeds and costs ten times the usual is the likelier 3 a.m. incident. Alert at a fraction of the per-day ceiling, early enough that a person can act before the hard limit.

Silence. Each invocation records a status and session ID, and you can list invocations per automation 1. Compare that list with the schedule: if a daily automation has no invocation by its expected time plus a margin, alert. Without that check a schedule that quietly stopped looks the same as a quiet night. I did not confirm the full list of invocation statuses, so read them from the API reference before writing the rule.

  • The five lifecycle failure events page the schedule's on-call, not a shared channel.
  • A spend alert fires at a stated fraction of the daily ceiling.
  • A missing-invocation alert exists for every automation.
  • Alerts carry the automation ID, owner and a link to the session in the Agents tab of the platform logs, where sessions can be searched by ID 4.
  • Session traces can be exported as OTLP JSON through the public API 4, so the run can be joined to the rest of your telemetry.

Where a gateway fits

OpenAI-hosted automations start sessions on OpenAI's side 1. I could not confirm that model calls from that path go through a gateway you operate, so do not assume your gateway's limits apply to it. If you instead run the schedule yourself, with your own cron and the Agents SDK or Responses API pointed at a gateway, every call crosses a layer you control.

INFRO supports that second shape: you change the base URL and key for the OpenAI Agents SDK or Responses API, and routing, budgets refused before the call, and the request log apply as on any other request 5. Budgets can be set per organization, project, member and key; key limits always block, a key's daily window starts at midnight UTC, and a blocking budget admits a request only if its worst-case cost fits the room left 6. Give each schedule its own key and the key limit becomes the per-schedule ceiling, with spend controls (opens in a new tab) documenting the details. Spend anomaly alerts and budget forecasts can go to email, Slack, webhooks, PagerDuty or Teams. Per-key limits also cap a loop that the in-process guard misses, and a 402 refusal is terminal, as the loop-bounding post argues 7. INFRO's emergency stop is on the roadmap and is not available, so the kill switch in section 3 still has to be your own.

Before the first 3 a.m. run

  • Run each schedule once manually, with the per-run ceiling lowered, and compare the recorded cost to your estimate.
  • Force a failure of each class in the retry table on staging and watch the scheduler's reaction.
  • Rehearse the three-layer stop with someone who did not build the schedule.
  • Confirm the first week's invocations against the expected count, and review every one that cost more than the median.
  • Put the owner's name on the schedule's calendar entry for the first weekend it runs.

Questions readers ask

Does a scheduled automation need a different budget from an interactive session?
Yes, in practice. An interactive session has a person who stops it when it misbehaves; a scheduled one repeats on its own, so the ceiling should be per schedule and per day, and it should be set lower than you would tolerate for one-off runs.
Should the agent be allowed to create its own automations?
Only with an inventory and an owner rule. The automations tool lets an agent schedule follow-ups in its current session 1, which means schedules can appear without anyone filing a change. If you enable it, reconcile what exists against your registry on a schedule.

From the team that builds it

Where this shows up in INFRO

INFRO is a control plane in front of the provider accounts you already hold. The capabilities below are the parts of it this article touches, each with the documentation that defines its behaviour.

  • Budgets and spend ceilings

    Available with a plan

    A hard cap per organization, project, member, and key, with alerts at your own thresholds.

    Read the documentation for Budgets and spend ceilings
  • Spend anomaly and drift alerts

    Available with a plan

    Each scope's usual day is learned from its own history; a day that departs from it, a budget forecast to be exceeded, cost estimates drifting from the provider's own figures, unpriced traffic and failing connections become findings in the console. Routed to email, Slack and signed webhooks on every plan.

    Read the documentation for Spend anomaly and drift alerts
  • Microsoft Teams and PagerDuty alert channels

    Available with a plan

    Findings posted to a Microsoft Teams channel through a Teams workflow, or opened as PagerDuty alerts through an Events API v2 integration, beside email, Slack and signed webhooks. Included where alert channels are.

    Read the documentation for Microsoft Teams and PagerDuty alert channels
  • Spend attribution

    Available with a plan

    Group cost by model, project, key, or an end-user id you attach to the request.

    Read the documentation for Spend attribution
  • Claude Code and Codex through INFRO

    Available with a plan

    Point Claude Code, the Claude Agent SDK, Codex or the OpenAI Agents SDK at INFRO by changing the base URL and the key. Anthropic's Messages API and OpenAI's Responses API, with routing, budgets refused before the call, guardrails and the request log applied as on every other request.

  • Management API

    Available with a plan

    Configure an organization as code through /manage/v1 with a scoped, expiring management token: projects, gateway keys, connections, routes, budgets, alerts, cost centers, commitments, guardrails and end-customer caps. Reads and writes on every plan.

    Read the documentation for Management API
  • Key limits and rotation

    Available with a plan

    Limit a gateway key to chosen providers or IP ranges, and rotate it with an overlap window so the old key keeps working while you deploy the new one.

    Read the documentation for Key limits and rotation

INFRO accounts are self-serve. Provider usage is billed to you by your providers; INFRO charges a software subscription and takes 0% of model spend. See plans.

Sources

Numbered in order of first citation. Each was opened and checked against the claim on the date shown.

  1. 1.Scheduled automations (opens in a new tab) — OpenAI. Accessed Nov 9, 2026.
  2. 2.Configuring Agents (opens in a new tab) — OpenAI. Accessed Nov 9, 2026.
  3. 3.Errors and recovery (Agents API) (opens in a new tab) — OpenAI. Accessed Nov 9, 2026.
  4. 4.Observability and usage (Agents API) (opens in a new tab) — OpenAI. Accessed Nov 9, 2026.
  5. 5.INFRO documentation overview (opens in a new tab) — INFRO. Accessed Nov 9, 2026.
  6. 6.Spend controls (opens in a new tab) — INFRO. Accessed Nov 9, 2026.
  7. 7.Bounding AI agent loops: step, time, token and spend limits (opens in a new tab) — INFRO. Accessed Nov 9, 2026.

About this article

Read on 2026-11-09: OpenAI's Agents API pages for scheduled automations, errors and recovery, observability and configuration, INFRO's spend-controls and docs overview pages, and INFRO's agent-loop post. openai.com/api returned HTTP 403, so nothing is drawn from it. Left out as unconfirmed: whether an automation has its own budget or owner field, how missed or overlapping runs, daylight-saving changes and pause or delete operations behave, the full list of invocation statuses, and whether INFRO fronts the OpenAI-hosted automation path.

Last checked against its sources on . The next review is due by . No separate named reviewer is recorded for this article.

How articles are written, sourced and corrected is set out in the editorial standards.