Skip to main content

Python SDK

The Python SDK provides a clean interface for writing TaskDaemon handlers.

Installation

Basic Usage

Task Object

The Task dataclass contains:

Return Types

Success

Return Success with a result (any JSON-serializable value):

Error

Return Error with an error message and optional retryable flag:

Complete Example

Here’s the actual image handler from the sample project:

Error Handling

Exceptions are automatically caught and converted to non-retryable errors:
For explicit error handling:

Dockerfile

:::tip Use python -u for unbuffered output to ensure responses are sent immediately. :::

Handler Configuration

Multiple task types can use the same image - the handler receives task.task_type to differentiate.