Skip to main content

Rust SDK

The Rust SDK for writing TaskDaemon handlers.

Installation

Create a binary project with cargo init --bin --name handler, then add the published crates.io package:
For a source installation, replace the crate dependency with the immutable release tag:
Keep diagnostic logs on stderr; the handler protocol uses stdout for one response per task. A request starts with attempt: 1; retries require a valid retryable error and remaining stored budget.

Basic Usage

Task Struct

Result Functions

The Result enum:

Complete Example

For the image example, also add these dependencies:

Error Handling

JSON parsing errors are automatically handled by the SDK. Your handler only receives valid Task objects. For explicit error handling, use the error function:

Dockerfile

Save your handler as src/main.rs in the handler project created above and run cargo build to generate Cargo.lock. Commit that lockfile with the project. The Dockerfiles install the SDK from crates.io and copy the handler binary named by the application’s package.
For a smaller Linux x86_64 image (match the target to your deployment architecture):

Handler Configuration