Skip to main content
The @task decorator defines a single-turn automation. Tasks are one-shot (but can be long-running) and can be triggered by events or on a schedule (schedule.daily, schedule.weekly).
from blocks import on, task

@on("schedule.daily")
@on("webhook")
@task(name="version-drift-bot")
def version_drift_bot(input):
    ...
The only required argument is name. The name must be unique per workspace; changing it will create a new automation or overwrite an existing one with the same name.

Arguments

name
string
required
The name of the automation.
required_env_vars
array
Environment variables that must be set before the automation can be enabled.

When to use @task vs @agent

Reach for @task first. Tasks are one-turn — they run once per trigger and finish. Use them for scheduled jobs, webhook handlers, or any automation that doesn’t need to keep talking to a user. Reach for @agent only when you need a multi-turn conversation — users continuing the thread from Slack, Linear, or the dashboard, with context carried across messages.
from blocks import on, task

@on("schedule.daily")
@task(name="version-drift-bot")
def version_drift_bot(input):
    ...