Application API
Look up Runlane's runtime, queue, schedule, task, run, wait, stream, realtime, React, and error APIs.
This reference covers Runlane's application APIs. Import the names shown here from @runlane/core, unless a page names another package.
Core explicitly exports task authoring, runtime configuration, observation, and result types. It does not re-export every contract. Import storage and transport contracts, provider schemas, codecs, and conformance helpers from @runlane/contracts. That package groups its exports by audience: task authors, provider authors, and internal package implementation.
| Reference | What to look up |
|---|---|
| Runtime | Runtime options, triggering, workers, and maintenance. |
| Queue operations | Durable pause, capacity overrides, expiry, and effective queue state. |
| Schedules | Task-declared schedules and runtime schedule creation, updates, and controls. |
| Tasks and context | Task and queue options, retry policy, schedules, steps, and handler context. |
| Runs and waits | Stored results, filters, cancellation, retries, signals, and tokens. |
| Streams | Durable named output, resumable readers, and run subscriptions. |
| Realtime | Authorized Fetch SSE handler, scoped tokens, and browser client. |
| React | Provider, run and stream hooks, attempt modes, and retention bounds. |
| Errors | Error construction, retry decisions, and public failure fields. |
| Defaults | Shared 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.
When updating an existing deployment, follow Upgrade Runlane for handler changes, stored-format compatibility, migrations, and rollback.
Shared value types
DurationStringis 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.JsonValueis stored JSON: strings, finite numbers, booleans,null, arrays, and plain objects. Task payloads and outputs may also beundefinedwhere 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
RunIdorTaskId. Keep IDs returned by Runlane in that type. UsecreateRunlaneIdSchema<'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>containsdata: T[]and an optionalnextCursor. 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.