Docs/Server/Scheduled tasks

Scheduled tasks

Have a HolaClaw Server agent do work later or on a schedule, from a chat or through the API, and know what a task run may do and where its result goes.

6 min read Updated November 17, 2026
  • Server
  • Tasks

A task is work the agent does apart from a conversation: right away in the background, once at a set time, or on a cron schedule. "Research this and get back to me", "remind me on Friday at 17:00 to send the invoice", "every weekday at 08:00, summarise my notifications".

Tasks are created at runtime, by the agent or by an admin. Nothing in the config files declares one.

Ask the agent

The simplest way to create a task is to ask for it in a chat:

Every weekday at 8:00, check the build status page and tell me if anything is red.

The agent creates it with its task.create tool, which holaclaw init gives the default agent. It tells you the task's id and its next run. When the task runs, the result comes back to the same chat.

A task the agent creates:

  • takes a prompt, an optional name, and at most one of a cron schedule, a time, or a number of minutes from now (1 to 525600). With none, it runs right away.
  • delivers to the conversation it came from. The model cannot send the result anywhere else.
  • runs as the person who asked for it, with that agent.
  • has no grants, so any tool call that would need an approval is denied.
  • can repeat at most every 5 minutes.
  • counts toward a limit of 20 active tasks per person.

Guests cannot create tasks, and a task run cannot create another task.

Write everything into the prompt

A task run has no memory: no recall and no memory tools. The agent writes what the task needs to know into the prompt when it creates it. If a reminder needs a detail, say it when you ask.

Create a task through the API

An admin can create a task with POST /v1/tasks, which allows more than the agent's tool: any agent, grants, a catch-up policy for missed runs, and a step limit. Every task endpoint needs the admin scope. See authentication.

On a system install, over the control socket:

Terminal
sudo -u holaclaw curl --unix-socket /run/holaclaw/holaclaw.sock \
  -H 'Content-Type: application/json' \
  -d @task.json http://localhost/v1/tasks
task.jsonjson
{
  "agent": "main",
  "name": "notifications",
  "prompt": "Summarise my unread GitHub notifications.",
  "schedule": { "kind": "cron", "cron": "0 8 * * MON-FRI" },
  "delivery": { "kind": "store" },
  "grants": ["fetch"],
  "missed": "run_once",
  "max_steps": 20
}
Field Values
agent any configured agent. Default main.
name optional, at most 100 bytes
prompt required, at most 8000 bytes
schedule required. {"kind": "now"}, {"kind": "at", "at": "<RFC 3339 time>"} or {"kind": "cron", "cron": "<expression>"}
delivery {"kind": "store"} (the default) keeps the result in the task's own session. {"kind": "session", "session_id": "<id>"} posts it to that chat session.
grants tool names of that agent the task may use without asking
missed skip (the default) or run_once. See Missed runs.
max_steps up to 50. 0 uses the agent's limit.

The other endpoints are GET /v1/tasks (every task, newest first), GET /v1/tasks/<id> (one task, with its grants) and DELETE /v1/tasks/<id> (cancel it). Each task carries its status, next_run, last_run and last_trace_id.

There is no holaclaw command for tasks yet.

Schedules

  • now runs at once.
  • at runs once, at a time in the future, at most a year ahead.
  • cron repeats. It takes five fields: minute, hour, day of month, month and day of week.

Cron fields accept:

  • *, lists (1,15), ranges (1-5) and steps (*/15, 1-20/3);
  • month names JAN to DEC and day names SUN to SAT. 0 and 7 are both Sunday;
  • the shortcuts @hourly, @daily, @weekly and @monthly.

When both day fields are restricted, a day that matches either one fires, as in every cron. An expression that matches nothing in the next five years, such as 0 0 30 FEB *, is refused.

Cron runs in the daemon's time zone and follows its wall clock across daylight saving changes: a time the spring change skips runs at the shifted time, and a time the autumn change repeats runs once.

What a task run can do

Each run sends the prompt to the task's own session as a message, under a new trace. A recurring task's runs share that session, so each run sees the earlier ones.

In a task run
Identity and role those of the person who created it
Policy the agent's [policy.task] block. By default read, write and external are allowed and exec is denied.
Approvals nobody is asked. A call that would need approval is denied, unless one of the task's grants covers it.
Memory none
Skills skill.load only
New tasks refused
Steps the task's max_steps, or the agent's limit

[policy.task] is set in the agent's agent.toml. See Guests and tasks. A tool the server marks destructive on a connector is always denied in a task without a grant, since nobody is there to approve it.

  • One at a time. If the previous run of a task is still going when the next one is due, the new one is dropped, not queued.
  • No crowding. Task runs take at most one slot per provider, so a busy task never holds up a chat.
  • Restarts. A run cut short by a daemon stop is replayed at the next start.

Where the result goes

  • To a chat (session, and every task the agent creates). The reply is posted to that conversation as [task <name>] <reply>, on the channel it came from. A run with an empty reply posts nothing.
  • Kept (store). The reply stays in the task's session. Follow last_trace_id with holaclaw trace <id> to read it.

The destination is fixed when the task is created.

Note

A failed run is not told apart from a successful one yet: the agent's apology is delivered as the result. An aborted run delivers nothing.

Status

Status Meaning
active waiting for its time, or recurring
done a one-time task whose run was started
failed a one-time task whose time passed while the daemon was down, under skip; or a task whose cron expression no longer parses
cancelled deleted through the API, or its creator was deleted

Missed runs

When the daemon starts, it applies each task's missed-run policy to what came due while it was down:

  • skip forgets the missed runs and waits for the next one. A one-time task whose time passed becomes failed.
  • run_once runs one catch-up run right away, never a burst.

Creators

  • A disabled creator's tasks do not run. Enabling the person applies the missed-run policy, as a restart does.
  • Deleting the creator cancels their tasks and revokes their grants.

Cancel a task

DELETE /v1/tasks/<id> cancels a task and revokes its grants. It does not stop a run that is already going.

Was this page helpful?

Can’t find what you need?

Ask the community on Discord.