Runlane
ReferenceApplication API

Application API

Look up Runlane's task, runtime, run, wait, and error APIs.

This reference covers the application APIs in Runlane 0.4. Import the names shown here from @runlane/core, unless a page names another package.

ReferenceWhat to look up
RuntimeRuntime options, triggering, workers, and maintenance.
Tasks and contextTask and queue options, retry policy, schedules, steps, and handler context.
Runs and waitsStored results, filters, cancellation, retries, signals, and tokens.
ErrorsError construction, retry decisions, and public failure fields.
DefaultsShared values read from contractDefaults.

Start with add Runlane to your app for file layout and setup. Use the provider reference when building a storage or delivery adapter.

Shared value types

  • DurationString is a duration with a unit, such as '30s', '5m', or '7d'. Use a duration string where an option asks for one, not a number of milliseconds.
  • JsonValue is stored JSON: strings, finite numbers, booleans, null, arrays, and plain objects. Task payloads and outputs may also be undefined where their schema allows it. Convert dates and binary data before storing them in JSON fields.
  • A branded ID is a string whose TypeScript type identifies its role, such as RunId or TaskId. Keep IDs returned by Runlane in that type. Use createRunlaneIdSchema<'run'>('Run id').parse(value) to validate a run ID received from a request.
  • A Schema<Input, Output> follows Standard Schema. Runlane validates the input and stores the schema's output. Zod is one supported schema library.
  • A Page<T> contains data: T[] and an optional nextCursor. Pass that cursor back with the same filters. Do not parse or edit it.

Public calls reject with a structured RunlaneError when validation, storage, or delivery fails. A handler failure is normally saved on the run instead. The error reference explains that distinction.

On this page