Skip to Content
Docs
Agents

Agent Schedules

A schedule runs an agent with an instruction at a set time, with nobody in the chat. There are two kinds:

  • Recurring: runs on a cron expression in a timezone, for example every weekday at 09:00 in Europe/Warsaw.
  • One-time: runs once at a date and time. You create these in the Schedules tab, or the model creates them from a chat with the Scheduling tool.

Every run is recorded in the schedule’s run log with its status, output, tokens and any error.

Nothing fires unless a Celery beat scheduler is running. The Docker Compose files and docsgpt worker embed it (-B), and Kubernetes runs it in the worker. If you start workers with --no-beat, or on Windows, run docsgpt beat as well. See Background jobs and the worker step in the development environment.

Create a schedule in the web app

  1. Open the agent and select the Schedules tab. The tab appears once the agent is published, and only for its owner and team editors.
  2. Select New schedule.
  3. Give it a name (optional) and pick a Frequency: Once, Daily, Weekly, Monthly or Yearly. Set the day or date and the time (At), and pick a Timezone.
  4. In Instructions, write what the agent should do on each run, as you would type it in a chat. Include any delivery step, such as “post the summary to Slack”.
  5. If the agent has tools with actions that need approval, they are listed under Tools that need approval, all unticked. Tick a tool only if the schedule should use its approval-gated actions without asking; see Tools in a scheduled run.
  6. Select Create task.

The tab lists Recurring schedules and One-time tasks separately, with each schedule’s next run, last run and status. What you can do depends on the schedule:

  • An active recurring schedule has a Run now button and a menu with Edit, Pause and Delete.
  • A paused recurring schedule has a Resume button and a menu with Edit, Run now and Delete.
  • A pending one-time task has a menu with Edit and Cancel task.

Edit changes the instructions, time, timezone and tool approvals. Editing a one-time task’s date or time moves it to the new time, which must be in the future. A schedule can’t switch between one-time and recurring: the other kind’s frequencies are disabled while you edit, so create a new schedule instead. If the change is refused, the dialog stays open and says why.

Deleting a schedule also deletes its run history, and deleting the agent deletes all its schedules.

The builder covers daily, weekly, monthly and yearly times. For another cadence, such as every hour or every weekday, set a cron expression through the API. The tab describes common cadences in words, such as “Every hour”, “Every 15 minutes”, “Every weekday at 9:00 AM”, “Every Monday, Wednesday and Friday at 8:00 AM” or “Every hour from 9:00 AM to 5:00 PM on weekdays”. Any other expression shows as Custom: <expression>.

When you edit a schedule with such a cadence, the dialog shows a note with its current timing. The schedule keeps that timing when you change only its name, instructions, timezone or tool approvals. Changing Frequency, the day or the time replaces it with the timing you pick.

Tools in a scheduled run

Nobody is present to approve a tool call during a scheduled run, so:

  • Actions that don’t need approval run as they would in a chat.
  • An action that needs approval runs only if its tool is ticked under Tools that need approval in the schedule’s form. Ticking a tool pre-approves all of its approval-gated actions for every run of that schedule, so they run without asking. Nothing is ticked by default.
  • The form lists a tool when any of its active actions is set to need approval, when it is a remote device (a device decides per command, from its approval mode), when it is a code executor set to require approval, and when it is a tool you can’t inspect, such as one the agent’s owner didn’t share with you.
  • Commands that a remote device’s denylist forces to a prompt are refused even when the device is ticked.
  • Tools that run in the browser, and connected tools whose account needs signing in, are refused.
  • The Scheduling tool is never available in a scheduled run, so a run can’t create further schedules.
  • A refused tool call is reported back to the model, which can still answer. The run fails with the tool_not_allowed error type only when it ends without an answer.

If you later mark one of a tool’s actions as needing approval, schedules that don’t have that tool ticked refuse the action. Edit the schedule and tick the tool if it should run unattended.

All your schedules in Activity

Activity → Schedules in the sidebar lists every schedule you own, across all your agents, grouped by agent. Tasks the assistant set up in a chat without an agent are grouped last under Created in chat, each with a link to its chat. The page has the same Recurring and One-time tasks tabs, row actions and run log as an agent’s Schedules tab. New schedule there asks you to choose the agent first. To get there from an agent, select All schedules on its Schedules tab.

It also lists the schedules of teammates’ agents you manage through a team (an Editor badge marks those groups). Those schedules belong to the agent’s owner (see Who owns a schedule); a teammate’s own one-time task set from a chat stays private to them.

Run now and the run log

Run now starts a run immediately. It is recorded with the trigger Manual; timed runs show Scheduled. Run now is refused while another run of the same schedule is still in progress. A failed or timed-out Run now doesn’t count toward auto-pause, since you started it and can see the result; a successful one still resets the failure count. If a one-time task comes due while a Run now of it is still going, the task’s own run waits for it to finish and then runs.

Select Show runs on a schedule to open its log, and select a run to see its details: status, scheduled, start and finish times, prompt and generated tokens, output and error. The output is capped at 24,000 characters and marked (truncated) beyond that.

A run ends in one of these statuses:

StatusMeaning
SuccessThe run finished and produced an answer, tool calls or workflow steps, even if a tool call was refused along the way.
FailedThe run raised an error, was refused a tool and ended without an answer (tool_not_allowed), went over the agent’s limit or the schedule’s token budget (budget_exceeded), stopped because its payer ran out of allowance during the run (payer_out_of_allowance, see Paid by and paused schedules), produced nothing at all (empty_output), or the agent said it can’t do the task (cannot_complete, see below).
TimeoutThe run went past SCHEDULE_RUN_TIMEOUT.
SkippedThe run didn’t start: the previous run was still in progress (overlap), the scheduler was down past the due time plus SCHEDULE_MISFIRE_GRACE (missed), or the schedule is paused for its payer (payer_out_of_allowance, payer_left, no_payer or owner_inactive, see Paid by and paused schedules).

One-time tasks have a run log too, so a finished task shows its result. Every scheduled run also appears in Settings → Logs with the type Scheduled, with its execution trace, and, for a schedule with an agent, in the agent’s Logs tab; over the API, use GET /api/schedules/<id>/runs. A run’s details link to its conversation with Open conversation.

Where the output goes

  • The output of a recurring schedule, or of a one-time task created in the Schedules tab, stays in the run log. It isn’t added to a conversation.
  • A one-time task created from a chat adds its answer to that conversation as a new turn once it succeeds, or when it fails with cannot_complete, so the chat says why it couldn’t be done. The run sees the conversation’s earlier messages. Unless you’re looking at that conversation, you’re notified as for a background job: a toast in another open tab, Web Push when no tab is open, and an unread mark in the sidebar.

When the agent can’t do the task

A scheduled run can report that the task, or a step it needs, can’t be done with what the agent has (a tool, an account or access is missing). The run is then recorded as Failed with the error type cannot_complete and the agent’s one-line reason as its error, which the run log shows next to the status. The output keeps the agent’s answer. These failures count toward auto-pause, so a schedule set up for something its agent has no tool for stops after a few runs instead of repeating. Give the agent the tool it needs, or change the instructions, then resume it.

  • A model that can call tools gets a report_cannot_complete tool in scheduled runs only, even when the agent has no other tools, and is told to call it in that case.
  • A model without tool calling is told to start its answer with CANNOT_COMPLETE: and the reason instead. Only the start of its final answer counts, so an answer that merely says “cannot” stays a success.
  • If a tool the schedule doesn’t allow was refused in the same run, the run fails with tool_not_allowed, which names that tool.
  • Research agents: the research steps, which are what call tools, can report it (with the marker on a model without tool calling). The final report can’t, and a scheduled research run skips its clarifying questions, since nobody is there to answer them.
  • Workflows: every agent node can report it, and the last agent node the run reaches decides. A later agent node, such as a fallback or a branch that handles the failure, clears an earlier report, and loop items never fail the run. A node with a JSON schema can report it only when it has other tools: some providers refuse tools beside a response schema.

This relies on the model reporting it: it catches a missing tool or account, not a run that does the task wrong.

Auto-pause

After SCHEDULE_AUTOPAUSE_FAILURES (default 3) failed or timed-out scheduled runs in a row, a recurring schedule pauses itself. Runs started with Run now don’t count, and neither do runs skipped or stopped for the schedule’s payer (see Paid by and paused schedules). The schedule shows Paused and how many runs failed in a row. Fix the cause, then select Resume. Resuming resets the failure count and computes the next run from now. One-time tasks are never auto-paused.

When a schedule pauses itself, its owner is notified once, as for a background job: a toast in an open tab, or Web Push when no tab is open. The notification names the schedule and gives the last run’s error on one line (the agent’s cannot_complete reason, a timeout, the tool that wasn’t allowed). Open goes to the schedule in Activity → Schedules with its run log open. A toast still on screen goes away once the schedule is resumed, runs successfully or is deleted. A schedule that is resumed and pauses again notifies again. The paused schedule also stays under Needs you in Activity → Now until it is resumed.

To also be notified of the first failed run in a row, before the schedule pauses, the operator sets SCHEDULE_NOTIFY_RECURRING_FAILURES=true. Runs started with Run now don’t send this notice.

Schedule from a chat

The Scheduling tool lets the model set a one-time task while you chat: “remind me tomorrow at 8 to check the deploy” or “in 2 hours, summarise the new tickets”. It can also list and cancel the pending tasks it set.

  • In a regular chat without an agent, it is one of the default chat tools (DEFAULT_CHAT_TOOLS).
  • In an agent’s chat, enable Scheduling in the agent’s tool picker.

The chat shows a card for each task with a Cancel task button. Tasks set in an agent’s chat also appear under One-time tasks in the agent’s Schedules tab; tasks set in a chat without an agent appear under Created in chat in Activity → Schedules. The tool sets one-time tasks only; for a recurring schedule, use the Schedules tab.

A task set from chat pre-approves only the tools whose actions never need approval. Tool calls that need approval are refused when it runs.

Who owns a schedule and who pays for it

The person a schedule is stored under pays for its runs: each run counts against their usage quota, after the agent’s own limit, and its tokens and trace are recorded under them. The schedule names them: Paid by Dana, or Paid by you.

  • On a team agent, a schedule is stored under the person who set it, in the Schedules tab or from chat. The team’s Editors and up can manage every member’s schedule on the team’s agents; it keeps running on its setter’s allowance until someone takes it over.
  • On a personal agent, a schedule created in the Schedules tab is stored under the agent’s owner, whoever creates it, so the owner pays and the row says so. Owners and editors of the agent can manage it.
  • A task someone sets from chat on a shared agent stays theirs, and they pay for it. It stops running when they lose access to the agent. So a teammate’s chat task on your agent counts against their quota and shows up in their Analytics and Logs.
  • A run always executes as the agent’s owner (on a team agent, as the team), with the owner’s sources, tools and model, whoever pays.
  • A task set through the agent’s API key, or by someone who reaches the agent only through its public link, keeps that caller’s limits: it writes to the owner’s connected accounts and saved credentials only for actions allowed under Letting API callers make changes. It edits the owner’s wikis only when the wiki’s owner lets API and widget users edit them.

A running schedule pauses when its payer can’t pay. It shows why, and since when, for example “Dana is out of allowance until 1 Dec. Paused since 26 Nov.”

ReasonError typeRuns again when
The payer is out of allowancepayer_out_of_allowanceTheir allowance resets or is raised, or someone takes the schedule over
On a team agent, the payer left the team or dropped to Viewerpayer_leftThey’re added back as an Editor or above, or someone takes it over
Nobody can pay for itno_payerSomeone takes it over
The payer’s or the agent owner’s account is deactivatedowner_inactiveThe account is reactivated

While it is paused:

  • Each due run is recorded as Skipped, with the reason as its error type. One row stands for the whole streak: later skips for the same reason and payer aren’t stored, so a schedule paused for three weeks leaves one row. A Run now keeps its row.
  • Skipped runs don’t count toward auto-pause and send no failure notification. The schedule keeps its cadence and runs again by itself once the reason clears; nobody needs to resume it. A one-time task waits the same way: it is tried again when the allowance resets, or every SCHEDULE_MIN_INTERVAL seconds for the other reasons, and right away after a take over.
  • When the payer runs out of allowance, they get one notification on the first skipped run, such as “Paused: you’re out of allowance until 1 Dec”. When a member leaves or loses the role, the team’s Owner and Admins are told once, at that change (see When someone leaves a team).

The allowance is also checked before each model call of a run. If it runs out during a run, the run stops there: it is recorded as Failed with payer_out_of_allowance and keeps its partial output. That failure doesn’t count toward auto-pause either. The agent’s own limit stops a run the same way, as budget_exceeded, and that one does count.

A schedule that a person paused, or that auto-pause stopped, isn’t reported as paused for its payer: it isn’t running anyway.

Take over

On a team agent, Editors and up can choose Take over on a schedule someone else pays for, running or paused. After one confirmation you pay for its runs from then on; the runs so far stay with the earlier payer, and the agent’s own limit still applies. The schedule also starts its failure count again and is no longer linked to the chat it was set from, which stays private to its earlier payer. A run already going finishes on the earlier payer’s allowance.

A schedule on a personal agent can’t be taken over. Taking over isn’t available with a personal access token, and it is refused when you already have SCHEDULE_MAX_PER_USER schedules. Each take over is recorded in the audit log as team.schedule_taken_over. See Take over for outside access.

REST API

Schedules have their own endpoints. Call them with a session token or a personal access token with the schedules:read or schedules:write scope. The REST API reference lists them all.

Every schedule in a response has paid_by ({user_id, label}, null when nobody pays for it), paused_for ({reason, until, since} while it is paused for its payer, else null) and can_take_over.

A workflow agent’s schedule runs its saved graph, so creating, resuming or running one now for a draft whose workflow isn’t finished answers 400 with the graph rules it breaks.

Method and pathPurpose
GET /api/schedulesList your schedules across every agent: your own, agentless ones, and those of teammates’ agents you manage (team: true), with agent_name, agent_image and origin_conversation_name
GET /api/agents/<agent_id>/schedulesList an agent’s schedules
POST /api/agents/<agent_id>/schedulesCreate a schedule
GET /api/agents/<agent_id>/schedules/stats?days=30Runs, failures and tokens over a window
GET, PUT, DELETE /api/schedules/<id>Read, edit or delete a schedule
PATCH /api/schedules/<id>{"action": "pause"} or {"action": "resume"}
POST /api/schedules/<id>/runRun now
POST /api/schedules/<id>/take_overTake over a schedule on a team agent: {success, schedule, changed}, changed false when you already pay. Refusals: 404 schedule_not_found, 403 workspace_role_required, 409 take_over_team_only or schedule_finished (completed or cancelled), 429 max_schedules. Not open to personal access tokens
GET /api/schedules/<id>/runs?limit=50&offset=0The run log
GET /api/schedules/<id>/runs/<run_id>One run’s output and error

Fields for POST. PUT takes the same fields except trigger_type, which can’t change; send only the fields to change.

FieldDescription
instructionRequired. What the agent does on each run.
trigger_typerecurring (default) or once.
cronFive-field cron expression. Required for recurring.
run_atISO 8601 time. Required for once. A time without an offset is read in timezone. On PUT it moves a pending or paused one-time task, with the same checks as a create; a recurring schedule answers 400, and a finished or already started task 409.
timezoneIANA name such as America/New_York. Default UTC.
nameDisplay name.
end_atISO 8601 time after which a recurring schedule stops and shows Completed.
tool_allowlistTool ids whose approval-gated actions may run without approval. Actions that don’t need approval run whether or not their tool is listed. The web app sends the tools ticked under Tools that need approval. Default: none. On PUT, leaving it out keeps the saved list.
model_idModel to run with instead of the agent’s default.
token_budgetTokens one run may use. A run that goes over is recorded as failed with budget_exceeded.
curl -X POST "$API/api/agents/$AGENT_ID/schedules" \
  -H "Authorization: Bearer $DOCSGPT_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Hourly ticket triage",
    "instruction": "Summarise the new support tickets and flag anything urgent.",
    "cron": "0 * * * *",
    "timezone": "Europe/Berlin",
    "token_budget": 20000
  }'

To resume a one-time task whose time has passed, send a new future run_at with the resume action.

Schedule changes are also published on the realtime events stream: schedule.run.completed, schedule.run.failed, schedule.run.skipped (a run that started but was refused for its payer), schedule.autopaused, schedule.completed (a one-time task closed after its stuck run was marked failed), schedule.resumed, schedule.cancelled, and schedule.message.appended when a one-time task adds its answer to a conversation.

Limits

Operators set these in .env. See the settings reference for the full list.

SettingDefaultEffect
SCHEDULE_MIN_INTERVAL900Shortest gap between recurring runs, in seconds. A cron expression that fires more often is rejected. 0 removes the limit.
SCHEDULE_MAX_PER_USER50Active and paused schedules one user can have. 0 removes the limit.
SCHEDULE_RUN_TIMEOUT600Seconds one run may take before it stops with Timeout.
SCHEDULE_MISFIRE_GRACE60Seconds past its due time that a recurring run may still start, for example after the scheduler was down. Later ones are skipped as missed.
SCHEDULE_AUTOPAUSE_FAILURES3Failures in a row that pause a recurring schedule. 0 turns auto-pause off.
SCHEDULE_NOTIFY_RECURRING_FAILURESfalseAlso notify the owner of a recurring schedule on its first failed run in a row, not only when it pauses itself.
SCHEDULE_ONCE_MAX_HORIZON31536000How far ahead a one-time task can be set, in seconds (one year).
SCHEDULE_DISPATCHER_INTERVAL30Seconds between checks for due schedules (at least 15).
SCHEDULE_RUN_OUTPUT_RETENTION_DAYS90Run log entries older than this are deleted, except the latest 50 of each schedule.
Edit this page on GitHub

Last updated on

On this page