Skip to main content

Handler Overview

Handlers are persistent containerized programs. They read one task per line from stdin and write exactly one JSON response per task to stdout. The process remains alive for subsequent tasks.

Request and Response

The handler request uses attempt = stored attempts + 1, starting at attempt: 1. API attempts starts at zero and increments on retry scheduling or a Failed marking; successful completion does not increment it. An initial success therefore has request attempt: 1 and API attempts: 0, while an initial terminal failure stores attempts: 1. Recovery can repeat the same request attempt, so this number is not a unique execution counter. task_id remains the same across retries and recovery. Deduplicate external effects by this ID when needed.
A valid retryable error schedules another execution only when the task has remaining retry budget. Default retry delays are 1, 2, and 4 seconds. Timeouts, invalid responses, and broken transport are terminal failures; the daemon stops an unusable stream before another task can use it. See retry and recovery settings.

SDKs

SDK source is in TaskDaemon-Handlers. The Python package taskdaemon==0.1.0 is published on PyPI. Go module github.com/jona62/TaskDaemon-Handlers/go@v0.1.2 is published and verified through the public Go proxy. npm, crates.io, Maven Central, and NuGet uploads are pending; their guides use source installation.

Minimal Handler

Logging and Output

Send logs to stderr. The daemon may skip non-JSON stdout text, but JSON-formatted logs can be parsed as protocol responses, so stdout is not a safe general logging channel.
Always flush each response and keep processing input until stdin closes. A timeout stops the handler stream and can interrupt side effects, so design for at-least-once execution rather than assuming a single uninterrupted run.

Register the Image

Build the image before daemon startup, then add:
Startup has no readiness handshake. Test a representative task and wait for a completed result before relying on the pool. See handlers.toml for all options.