Common Structure
All task types in Compozy share a common base structure with the following fields:Basic
This is the default if you don’t specify a type.
- Structure
- Basic Usage
- Advanced
- Single operations
- API calls
- Data transformations
- Simple processing steps
https://compozy.dev/schemas/task-basic.json
Parallel
Executes multiple operations simultaneously to improve performance- Structure
- Basic Usage
- Advanced
- Independent operations
- Performance optimization
- Batch processing
- Multiple API calls
https://compozy.dev/schemas/task-parallel.json
Decision
Routes execution based on conditions or data values.- Structure
- Basic Usage
- Advanced
- Business logic implementation
- Content-based routing
- Error handling flows
- Multi-path processing
https://compozy.dev/schemas/task-decision.json
Collection
Processes arrays of items efficiently, with support for batching and parallel execution.- Structure
- Basic Usage
- Advanced
- Processing arrays of items
- Batch processing
- Parallel data processing
- Rate-limited operations
https://compozy.dev/schemas/task-collection.json
Wait
Pauses execution until specific conditions are met or a timeout occurs.- Structure
- Basic Usage
- Advanced
- Human approval flows
- External service integration
- Time-based operations
- Rate limiting
https://compozy.dev/schemas/task-wait.json
Map
Transforms data between tasks while maintaining type safety.- Structure
- Basic Usage
- Advanced
- Data transformation
- Schema validation
- Field mapping
- Response formatting
https://compozy.dev/schemas/task-map.json
Composite
Groups multiple operations into a single, reusable unit.- Structure
- Basic Usage
- Advanced
- Reusable task sequences
- Complex workflows
- Modular task design
- Process encapsulation
https://compozy.dev/schemas/task-composite.json
Best Practices
Choose the Right Type
Select task types based on your specific needs:
- Use Basic for simple operations
- Use Parallel for independent concurrent operations
- Use Decision for conditional flows
- Use Collection/Foreach for iterative processing
- Use Wait for external dependencies
- Use Map for data transformations
- Use Composite for reusable workflows
Event Handling
Implement appropriate event handlers:
- Use on_start for initialization
- Use on_success/on_error for outcomes
- Use on_complete for cleanup
- Implement type-specific handlers
- Log important state changes
Error Management
Implement proper error handling:
- Configure retry policies
- Use conditional error routing
- Handle partial failures
- Implement fallback mechanisms
- Log error details
State Management
Monitor and manage task state:
- Track execution progress
- Monitor performance metrics
- Log state transitions
- Handle state persistence
- Implement recovery mechanisms
Next Steps
Types
Learn about different task types and their use cases
Usage
Understand how to use tasks in your workflows
API reference
Review the task configuration API reference
Registry
Learn about publishing tasks to the registry