Skip to Content
Runlane
ReferenceApplication API

Defaults

Read the shared defaults used by Runlane's application APIs.

contractDefaults is defined by @runlane/contracts and re-exported by @runlane/core. It owns shared runtime defaults. Read it when your application needs to reuse a default. Do not copy a fallback value into your own configuration.

@runlane/contracts also exports defaultResendQueuedRunsAfter, the frozen parsed resend default. Read its duration or milliseconds instead of parsing the shared default again.

import { contractDefaults } from '@runlane/core'

const {
  dispatch,
  environment,
  hooks,
  idempotency,
  lease,
  logs,
  maintenance,
  pagination,
  pruning,
  realtime,
  retention,
  retry,
  run,
  schedules,
  sort,
  storage,
  streams,
  tags,
  trigger,
  worker,
} = contractDefaults

console.log(
  JSON.stringify(
    {
      dispatch,
      environment,
      hooks,
      idempotency,
      lease,
      logs,
      maintenance,
      pagination,
      pruning,
      realtime,
      retention,
      retry,
      run,
      schedules,
      sort,
      storage,
      streams,
      tags,
      trigger,
      worker,
    },
    null,
    2,
  ),
)

The block below lists the application settings selected by the example above. It is maintained by hand; a documentation test compares it with those exported values. Other groups are described in the table after the block.

{
  "dispatch": {
    "eagerOutboxGrace": "3s",
    "onTrigger": "eager"
  },
  "environment": {
    "name": "default"
  },
  "hooks": {
    "retry": {
      "maxRetries": 9,
      "backoff": {
        "type": "exponential",
        "delay": "1s",
        "maxDelay": "5m"
      }
    },
    "timeout": "30s",
    "leaseDuration": "1m",
    "discoveryTimeout": "24h"
  },
  "idempotency": {
    "defaultTTL": "30d"
  },
  "lease": {
    "duration": "5m",
    "maxRefreshIntervalMs": 30000
  },
  "logs": {
    "captureConsole": true,
    "maxEntryBytes": 262144,
    "maxTelemetryEntryBytes": 16384,
    "maxRunEntries": 10000,
    "maxRunBytes": 67108864
  },
  "maintenance": {
    "completionResumeLimit": 100,
    "cancellationFinalizationLimit": 100,
    "clockSkewTolerance": "5s",
    "deliveryRequestLimit": 100,
    "outboxClaimLimit": 100,
    "outboxRetryDelay": "30s",
    "resendQueuedRunsAfter": "15m",
    "scheduleLookahead": "1m",
    "scheduleMaterializationLimit": 100,
    "startExpiryLimit": 100,
    "services": {
      "interval": "1s",
      "maximumFailureBackoff": "1m",
      "minimumLeaseDuration": "1m"
    },
    "timeoutFinalizationLimit": 100,
    "waitTokenResumeLimit": 100,
    "waitTokenTimeoutLimit": 100
  },
  "pagination": {
    "defaultLimit": 50,
    "maxLimit": 500
  },
  "postgres": {
    "preparedStatements": true
  },
  "pruning": {
    "batchLimit": 500
  },
  "realtime": {
    "runHints": true,
    "tokenTTL": "5m",
    "maxTokenTTL": "1h",
    "issuedAtLeeway": "60s",
    "connectionDuration": "5m",
    "heartbeatInterval": "15s",
    "maxEventBytes": 671744,
    "maxBufferedBytes": 1048576,
    "reconnect": {
      "maxRetries": "unlimited",
      "backoff": {
        "type": "exponential",
        "delay": "250ms",
        "maxDelay": "10s"
      }
    },
    "renderThrottle": "16ms",
    "clientMaxParts": 2000,
    "clientMaxPartsLimit": 100000
  },
  "retention": {
    "interval": "12h",
    "leaseDuration": "1m",
    "maxBatches": 10
  },
  "retry": {
    "backoff": "30s"
  },
  "run": {
    "singletonConflict": "reject",
    "version": "unversioned",
    "failureMessage": "Task failed.",
    "failureMessageMaxLength": 2048,
    "failureStackMaxLength": 16384,
    "maxInterruptions": 3,
    "newEventSequence": 0,
    "priority": "normal"
  },
  "schedules": {
    "timeZone": "UTC"
  },
  "sort": {
    "runEvents": {
      "direction": "desc",
      "field": "occurred_at"
    },
    "runs": {
      "direction": "desc",
      "field": "created_at"
    },
    "tokens": {
      "direction": "desc"
    }
  },
  "storage": {
    "maxRecordBytes": 409600,
    "minTransactionBytes": 4000000,
    "minTransactionRecords": 25,
    "query": {
      "direction": "asc"
    }
  },
  "streams": {
    "maxChunkBytes": 262144,
    "maxRunBytes": 67108864,
    "maxNameLength": 128,
    "maxNames": 32,
    "maxRunRecords": 100000,
    "appendBatchSize": 100,
    "pipeFlushBytes": 16384,
    "pipeFlushDelay": "20ms",
    "pollInterval": "1s"
  },
  "tags": {
    "maxCount": 10,
    "maxLength": 128
  },
  "trigger": {
    "batchConcurrency": 1,
    "maxBatchItems": 1000
  },
  "worker": {
    "duplicateSignalWindowMs": 250,
    "maintenance": true,
    "handleSignals": false,
    "shutdownGrace": "25s",
    "concurrency": 1,
    "devConcurrency": 10
  }
}
GroupWhere it applies
actorDefault system and operator actor identities.
clockRuntime clock; now() returns the current process time as a fresh Date.
deliverySQS Lambda recursiveLoop policy; see configuration. Canonical envelope byte limit, workHints, storage-polling idle delays, handoffReserveFraction (25% remaining by default) for checkpoint handoffs, and claimConflictRetryDelayMs (1,000 ms) for transient claim conflicts on native delivery 1.
dispatchPublishing policy and eager outbox crash timeout after a trigger.
environmentDefault namespace for a runtime.
idempotencyTerminal retention for a run's idempotency key when no TTL is supplied.
leaseWorker ownership duration and automatic refresh cap.
maintenanceLimits for each pass, service timing, and recovery delays.
observabilityDurable observation setting and exporter batch, timing, and sink ownership defaults.
paginationDefault and maximum page sizes for operator lists.
postgresNamed prepared-statement reuse for Postgres storage queries. Disable it for transaction poolers without statement tracking.
pruningBatch size for retention cleanup.
retentionDefaults for retention.cleanup: sweep interval, ownership duration, and bounded batch count. Runtime and task outcome rules have no deletion default.
queueDefault logical queue name.
retryDelay used when a task has a retry policy but omits backoff.
runFailure message and length cap, maxInterruptions, initial event sequence, and admission priority.
sortDefault order for run, event, and token lists.
storageRecord size cap, atomic capacity floors every storage driver meets, and default query direction.
streamsStream limits, batching, and the polling interval for run snapshots and durable readers.
tagsLimits on distinct labels per run and label length.
traceCarrierPropagation header names and total UTF-8 JSON byte limit.
triggerMaximum raw batch items and simultaneous backend chunk submissions.
workerParallel attempts, maintenance enabled by default, opt-in process signals, and shutdownGrace before aborting running attempts.

Settings without an automatic policy

  • Omitting task retry disables automatic retries. Setting it requires maxRetries; there is no default retry budget.
  • Omitting maxAttemptDuration from both the task and execution options leaves the attempt without a deadline. Its lease still applies.
  • Omitting queue.concurrency leaves that queue unbounded. A worker's local concurrency setting still applies.
  • Omitting queue.priorityBoost disables non-normal admission priority. There is no default boost duration.
  • Omitting token timeout leaves that token without a deadline.
  • Omitting a token's idempotencyKeyTTL keeps terminal key ownership until the token is pruned. Run keys use contractDefaults.idempotency.defaultTTL when no TTL is supplied.

Postgres and Redis drivers and lanes reuse contractDefaults.realtime.runHints, contractDefaults.delivery.workHints, the delivery polling defaults, and the shared storage floors. Provider-specific settings such as maxTransactionAttempts, Streams backlog, and visibility use the Redis options reference.

Provider-specific limits belong to the selected lane or adapter. See choose a lane and the provider's configuration guide.

dispatch.eagerOutboxGrace is the default for createRunlane({ dispatch: { eagerOutboxGrace } }). See create a runtime for what it controls.

lease.duration and lease.maxRefreshIntervalMs control ownership duration and the refresh cap. See execution options for precedence and derived heartbeat timing.

contractDefaults.schedules.timeZone supplies the runtime cron default (UTC). Declared cron schedules retain their existing optional-zone rules. Read this value rather than copying a fallback. See schedules.

contractDefaults.realtime owns token lifetimes, HTTP connection/heartbeat limits, buffer bytes, browser reconnect delays, and React render throttling and part retention bounds. realtimeDefaults from @runlane/contracts/realtime is the same read-only group for browsers. See realtime.

hooks.discoveryTimeout bounds unresolved discovery and pending work with no executable task registration. After that wait, a worker or delivery-recovery pass saves hooks: failed and hooks.lastFailure, which releases retention. The discovery wait starts at the earliest pending callback’s availableAt, or hooks.createdAt when none is pending. A lapsed claim restarts the wait at hooks.claimExpiresAt if that is later. These times come from storage; writer clock skew cannot extend the wait. Retry backoff does not count, so a worker that keeps claiming due callbacks is not cut off.

contractDefaults.observability.exporter.backoff uses { type: RetryBackoffType.Exponential, delay: '1s', maxDelay: '1m' }. Exporter retryable failures have no retry limit. A supplied backoff replaces this whole value; a duration string selects fixed waits. See observation export.

Run retention uses the same per-outcome values at runtime and task levels. See the rule table and runtime example and task example. Cleanup defaults do not enable deletion for unset outcomes.

On this page