Activities
Activities perform the actual work in your application while workflows coordinate them.
An activity is a unit of work that performs actual computations, API calls, or other operations. Key characteristics:
- Must be idempotent (safe to retry)
- Execute in isolated processes
- Have automatic retry mechanisms
- Accept any JSON-serializable types as inputs/outputs (str, int, dict, list, etc.)
- Input/output limited to 2MB
Activity vs Workflow
Activity vs Workflow
| Feature | Activity | Workflow |
|---|---|---|
| Duration | Seconds to minutes | Seconds to years |
| State | Stateless | Stateful |
| Retries | Automatic | Manual recovery |
| Parallelism | Single operation | Complex coordination |
Topics
Topics
- Basics — defining activities, core features, granularity, and nesting
- Local Activities — run activities directly in the worker process for low-latency operations
- Sticky Worker Sessions — route related activities to the same worker for resource sharing