MohziDocsGuideOpen Mohzi
All pages

Long tasks

How a bot keeps working on a job with many steps, and what stops it.

Most answers take a few tool calls. For a job with many steps — go through a folder of contracts, check every order in a list, compare three systems and write up the differences — a bot writes a plan first and works through it.

How it works

  1. The bot writes a plan of up to 30 steps. It appears in the conversation as a checklist.
  2. It works through the steps, ticking each off as it goes, and updates the plan if the work changes.
  3. When everything is done, it writes a summary.

Once there is a plan, one answer can run for up to two hours and 400 tool calls, instead of the usual 60 tool calls.

If the bot stops with steps left, it is told to carry on. It isn't pushed forever: it stops being told to carry on when it makes no progress twice in a row, when it needs an answer or an approval from you, or when you press Stop.

Keeping the context in bounds

As a long task goes on, results of its earliest steps are replaced with a short note saying they've been folded away and can be looked up again. The plan and the most recent steps are always kept. This keeps the context well within the model's limit over a long run.

Following along

In scheduled tasks

A scheduled task can plan and run long in the same way. Long tasks don't take the slots ordinary scheduled tasks use, so they don't hold up your daily reports. Up to four long scheduled tasks run at once on a server; a task that can't start one works within its usual 3 minutes.

If a release restarts the server during a long scheduled task, the conversation shows how many steps were done and which are left, with a Finish it button. It isn't restarted on its own, so no step is done twice.

Tasks started by new mail or a webhook can't run as long tasks.