Product
Continuing a session automatically
On this page you can learn how an Open session can be automatically resumed, so that the Ask agent can carry on with the work on its own.
Learn this page in your AI agent
Open it in Claude or ChatGPT and ask anything about it, or copy the Markdown and use it in any AI agent.
Three ways a session continues automatically
A workflow can describe work that needs its session to continue automatically. A workflow that acts as a customer support agent, for example, should continue every time the customer sends an email, and a workflow that chases a contractor should continue every week until there is a reply. An Open session is waiting for its next run, and it continues on its own in three ways: on an event, on auto-run, or through the API, each explained below. A session in Done is closed and ignores all three until you reopen it, as the Sessions page explains.
Webhook events
Picture: a source’s Webhook events tab, listing each event the source offers with the number of filters it has.
The Ask agent can subscribe a session to the webhook events of the sources selected for executing the workflow, with its Event subscriptions tool. Once subscribed, the moment the event happens in the connected tool, a reply on WhatsApp from one customer’s number for example, the session continues automatically. The full details of the event are added to the session, so the Ask agent has the context of exactly what happened in the tool. Only an Open session is resumed this way. To tell the Ask agent what to subscribe to, use the Events section of the PROCESS.md.
Example
- Requirement
- The workflow asks the Ask agent to answer the customer’s WhatsApp reply the moment it arrives.
- Solution
- Subscribe the session to the WhatsApp source’s message received event, filtered to that customer’s number, in the Events section of the PROCESS.md. The session then waits in Open. When the reply lands, the event resumes the session and the Ask agent answers it. Auto-run is not needed.
Auto-run
Picture: the Auto-run until completion dropdown of the message box, with the options Off, Hourly, Daily, Weekly, Monthly and Once.
Auto-run makes a session continue on its own. The Ask agent’s Auto-run scheduling tool enables it to decide on its own when the session continues: it schedules the next run once, at an exact time in the future, after which auto-run turns itself off. A follow-up that repeats, such as a weekly chase, it schedules the same way, one run at a time, and it switches a repeating schedule on, Hourly, Daily, Weekly or Monthly, only when you ask for one. This lets the Ask agent set when the session resumes for workflows that require it, for example following up on an unanswered email after one hour, then after one day, then after four days. The preferred way to use auto-run is to tell the Ask agent in the PROCESS.md when the session should continue, while you can also set a repeating schedule or a single run yourself in Askpilot, as explained below. Together with webhook events, it is how a workflow automatically continues.
- How the Ask agent sets it. The Ask agent has its own Auto-run scheduling tool. When the PROCESS.md, or you in the session, asks for a follow-up at a certain time, for example “send the first reminder after one hour”, it reads the session’s current auto-run setting and changes it: it schedules a single run at an exact time, or turns auto-run off, and it switches a repeating schedule on only when you ask for one. It changes auto-run only when the workflow or you ask for it. You see every change it makes in the session, and you can edit or turn off what it set at any time with the auto-run dropdown button in the session’s title bar.
- Where you switch it on. In Askpilot, with one of the repeating schedules, or, when you start a workflow manually or in an open session, Once, at a date and time you pick.
- When creating a workflow, choose it in the Auto-run until completion dropdown. It applies to every session the workflow opens. Once is not offered here, only the repeating schedules.
- When starting a workflow manually, choose it with the Auto-run: dropdown button in the message box. It applies to that run.
- In an open session, choose it with the same dropdown button in its title bar. It applies to that session, and this is also where you turn it off.
- How often a repeating schedule runs. Askpilot counts the gap from the session’s last run, not from the moment auto-run is switched on, and every run restarts the count, a message you send included. Run times are rounded up to the next ten minutes before the gap is counted. If the last run is already older than the gap when auto-run is switched on, the next run comes straight away.
- Hourly. An hour after the last run. A session that last ran at 11:36 is counted from 11:40 and runs again at 12:40.
- Daily. A day after the last run. A session that last ran at 10:00 runs next at 10:00 the following day, even if you switched auto-run on at 15:00.
- Weekly. A week after the last run. A session that last ran on Monday at 09:00 runs again the next Monday at 09:00.
- Monthly. A month after the last run. A session that last ran on the 3rd at 09:00 runs again on the 3rd of the next month at 09:00.
- How a single run works. The date and time of a single run, set by you or by the Ask agent, are in your timezone, the one set in your account settings. A run starts only on a 10-minute mark, :00, :10, :20 and so on. When the Ask agent schedules a run, it picks the next mark at or after the time the step is due, so a follow-up “in 10 minutes” asked at 13:43 runs at 14:00, and one asked at 13:53 runs at 14:10, never early. The time must be in the future and within the next 30 days. The session runs once at that time, or at the first check after it while the session is not waiting for your input, and then auto-run turns off.
- One setting at a time. A session has one auto-run setting, and a new one replaces the old one, whoever sets it. So when a workflow plans several follow-ups, the Ask agent schedules only the next one, and on that run it schedules the one after it.
- What stops it.
- You turn it off yourself, by choosing Off with the auto-run dropdown button in the session’s title bar.
- A run that needs your input pauses auto-run until you reply.
- A single run turns auto-run off once it has run.
- A session in Done is not re-run, and its auto-run cannot be changed. Moved back to Open, it continues with the auto-run it had, except a single run whose time passed while it was in Done: auto-run then switches off.
Subscribed events do not stop it: a session can re-run on its schedule and also resume the moment an event arrives.
Example
- Requirement
- The workflow asks the Ask agent to send the customer a follow-up message in two days.
- Solution
- Write it in the PROCESS.md: “If the customer has not replied, send a follow-up two days after the first message.” After the first message, the Ask agent schedules a single run for two days later. On that run it checks whether the customer replied, and if not, it sends the follow-up.
Through the API
Trigger a workflow in an existing session from your own system via the API. Learn more at Start workflows through the API.
How auto-run and webhook events work together
Auto-run and events work side by side. A session can re-run on its schedule and also resume the moment an event arrives. Use events for anything that depends on someone else acting, and auto-run for anything that depends on time passing.
Example
- Requirement
- The workflow asks the Ask agent to chase a contractor on WhatsApp every week until they confirm a date for the repair, and to tell the tenant as soon as the contractor replies.
- Solution
- Write “chase every week” in the PROCESS.md, and after each chase the Ask agent schedules the next one a week later, sending it only if there is still no reply. You can also set auto-run to Weekly yourself. Subscribe the session to the WhatsApp source’s message received event, filtered to the contractor’s number, so the reply resumes the session the moment it lands, days before the next scheduled run, and the Ask agent tells the tenant straight away.
Follow-ups at the times the PROCESS.md sets
Write in the PROCESS.md when each follow-up should happen, for example “send the first reminder after one hour, the second after two days”. The Ask agent schedules the session to run again at that time with its Auto-run scheduling tool, and on that run it does the step that is due. It can only schedule while the session runs, and only one run at a time, so after each follow-up it schedules the next one.
- Say when, relative to something the Ask agent knows. “Two days after the first message” or “tomorrow at 7pm” is clear. Times are read in your timezone.
- Keep each gap within 30 days. A single run can be scheduled at most 30 days ahead. For a longer gap, the Ask agent schedules a run within 30 days and schedules again from there. A follow-up that repeats, “chase every week” for example, it schedules one run at a time.
- Subscribe the session to the reply event, so it resumes the moment the desired event happens, for example a person replied to a message, and the follow-ups stop. Say in the PROCESS.md what to do then, for example “if the customer replies, stop the reminders”, and the Ask agent turns auto-run off.
- Write each follow-up as a check. On the scheduled run the Ask agent works out whether the step is still due, for example whether a reply arrived in the meantime, and acts only then.
Example
- Requirement
- If the customer does not reply on WhatsApp, the workflow asks for a follow-up after one day, another after three days and a last one after five days.
- Solution
- Write the three steps in the file with their timing, and subscribe the session to the customer’s WhatsApp replies. After the first message the Ask agent schedules a single run one day later. On that run, if no reply has arrived, it sends the first follow-up and schedules the next run for day three, and so on until the last one, after which it schedules nothing. A reply resumes the session at once, and the Ask agent turns auto-run off and ends the follow-ups.