Long running actions
By default, an action is terminated when the person running the action leaves the page.
While we think this is a solid default, it isn't a desirable behavior when creating long running actions like batch migration tools.
To solve for this, Interval allows you to mark an action as backgroundable, meaning it continues running even when you leave the page.
There are two ways to make an action backgroundable.
In code, you can specify backgroundable = true
when defining your action:
- TypeScript
- JavaScript
- Python Experimental
import { Action } from "@interval/sdk";
export default new Action({
backgroundable: true,
handler: async () => {
// action logic here
},
});
const { Action } = require("@interval/sdk");
module.exports = new Action({
backgroundable: true,
handler: async () => {
// action logic here
},
});
import os
from interval_sdk import Interval, IO, ctx_var
interval = Interval(
os.environ["INTERVAL_API_KEY"],
)
@interval.action(backgroundable: true)
async def import_data(io: IO):
# action logic here
pass
Alternatively, you can override the backgroundable behavior from your code through the configuration page for an action:

When an action is running the background, the person running it will automatically receive a notification when it completes or requires input.
Backgroundability makes Interval a powerful tool for writing resilient code. For example, instead of erroring on an unexpected condition in a long running job, you can easily prompt for user intervention.