Skip to main content

C# SDK

The C# SDK for writing TaskDaemon handlers.

Installation

Install the published TaskDaemon.Handler 0.1.2 package in a .NET 8 console application:
Save a handler example below as Program.cs. The Dockerfiles below assume this application project is named Handler.csproj; build from the Handler/ directory.

Source installation

To use the release source instead, replace the package reference with a project reference:
If the checkout is nested inside the application directory, exclude its source from the application’s default compile glob (the project reference compiles it separately):
Keep this SDK directory in the Docker build context when using the source installation. Use a reviewed SDK revision or release for deployment. 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 Record

Result Types

Usage:

Complete Example

Error Handling

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

HTTP Calls

The SDK exposes a synchronous Handler.Run callback. If you use an asynchronous client inside it, wait for that operation before returning one response:

Dockerfile

For a self-contained single-file deployment:

Handler Configuration

Requirements

  • .NET 8.0+ (the published package targets net8.0)
  • System.Text.Json for serialization (built-in)