What are Actions?
Actions are the fundamental building blocks of Ziet. They’re Python functions decorated with@Action that become serverless, scalable units of work with automatic:
- Retries with exponential backoff
- Timeout protection
- Error handling
- Observability and logging
- Serverless scaling
Basic Action
Action Parameters
Configure action behavior with decorator parameters:Parameter Details
Unique identifier for the action. Defaults to
module.function_name.Human-readable description of what the action does. Used in logs and dashboard.
Maximum execution time in seconds. Action is terminated if exceeded.
Number of retry attempts on failure. Uses exponential backoff.
Retry Behavior
Actions automatically retry on exceptions using exponential backoff:- Attempt 1: Immediate execution
- Attempt 2: Wait 2 seconds
- Attempt 3: Wait 4 seconds
- Attempt 4: Wait 8 seconds
- Max backoff: 30 seconds
- Any unhandled exception
- Timeout errors
- Network errors
- Successful execution (no exception)
- Explicit
returnstatement
Timeout Protection
Prevent actions from running indefinitely:Important: Set appropriate timeouts based on your action’s expected duration.
- Too short: Premature termination
- Too long: Wasted resources on hung operations
Error Handling
Automatic Error Handling
Actions automatically log errors and provide stack traces:- Error is logged with full stack trace
- Action retries (if
retries > 0) - Memory stores error details
- Dashboard shows failure reason
Manual Error Handling
Add custom error handling:Using Integrations
Actions can use built-in integrations:Using Memory
Share data between actions using memory:Testing Actions
Test your actions locally before deploying:- Action execution
- Memory operations
- Integration calls (mocked locally)
- Execution time and logs
Best Practices
Single Responsibility
Single Responsibility
Each action should do one thing well.✅ Good❌ Bad
Descriptive Names
Descriptive Names
Use clear, action-oriented names.✅ Good
fetch_user_profilecalculate_shipping_costsend_confirmation_email
get_datado_thingprocess
Document Behavior
Document Behavior
Add docstrings explaining what the action does.
Set Appropriate Timeouts
Set Appropriate Timeouts
Match timeout to expected duration.
Use Retries for Network Calls
Use Retries for Network Calls
Add retries for operations that might fail transiently.
Limitations
Current limitations (subject to change):
- Max execution time: 15 minutes (900 seconds)
- Max memory: 10GB per action
- Max payload size: 6MB input/output
- No persistent file system: Use memory or external storage
- No background threads: All work must complete before return