Skip to main content

Raw Protocol

Write handlers in any language without an SDK using the raw stdin/stdout protocol.

Protocol Overview

TaskDaemon communicates with handlers via:
  • Input: JSON task objects sent to stdin (one per line)
  • Output: JSON result objects written to stdout (one per line)
The handler process stays alive and processes multiple tasks.

Input Format

Each line on stdin is a JSON object:

Output Format

Write one JSON object per line to stdout.

Success Response

Error Response

Example Implementations

Python (No SDK)

Node.js (No SDK)

Ruby

PHP

Bash

Perl

Important Requirements

1. Flush Output

Always flush stdout after writing to ensure TaskDaemon receives the response immediately:

2. One Response Per Task

Write exactly one JSON line per input line. Don’t write partial responses or multiple lines.

3. Keep Running

The handler process stays alive and processes multiple tasks. Don’t exit after one task:

4. Handle Errors Gracefully

Return error status instead of crashing:

5. Use Unbuffered I/O

Configure your runtime for unbuffered or line-buffered I/O:

Dockerfile Template

Testing Handlers Locally

Test your handler without TaskDaemon:
Expected output: