@worker.task. Tasks are the most common job type. They run once when submitted and return a result.
Define a task
Register a task with the@worker.task decorator:
Task options
| Parameter | Type | Default | Description |
|---|---|---|---|
retries | int | 0 | Number of retry attempts on failure |
retry_delay | float | 1.0 | Seconds to wait before first retry |
retry_backoff | float | 2.0 | Multiplier applied to delay after each retry |
timeout | float | 1800 | Maximum execution time in seconds (30 min default) |
name | str | None | Custom display name (defaults to function name) |
rate_limit | str | None | Rate limit string (e.g. "10/minute") |
max_concurrency | int | None | Max concurrent executions of this specific task |
cache_key | str | None | Cache key template for result caching |
cache_ttl | int | None | Cache TTL in seconds |
Submit a task
Once a task is registered, you can submit it for background execution:Lifecycle hooks
You can attach callbacks to task lifecycle events:Next: Workflows
Compose tasks into multi-step pipelines with automatic lineage tracking.