TOOL WIKI · RUNTIME & DEPLOYMENT

Trigger.dev

Runs background tasks and workflows for application services.

Download example files Code + setup + checks in a ZIP
Jump to a section 10 sections

EXAMPLE USE CASE

Dispatch an order task and inspect its run

A developer needs a concrete execution environment for a background task, browser operation or service, with a visible terminal result.

Input
A configured Trigger.dev project and an A104 task payload.
Expected output
A run handle whose terminal result can be inspected in the dashboard.
  • Success check: The returned handle identifies a run; inspect its final result in the development dashboard.
  • Try a failure: Check a failed or timed-out task separately from successful submission.

Example scope: Actual managed/development task dispatch; a handle alone is not task completion.

Official reference · Trigger.dev

WHAT IT ISBackground task platform
WHERE IT FITSRuntime & deployment
SEE HOW THE SYSTEM FITS TOGETHERSELECT A COMPONENT
inputprocessresultcheckoutputTask requestGoal + resource budgetTrigger.devBackground task platformWorker environmentScoped executionExternal operationsAuthorized servicesArtifacts + outcomeValidate the resultLifecyclePersist or clean up
  1. Set the allowed runtime, network access, credentials, and maximum duration.

  2. Agent jobs that exceed a short synchronous request lifetime. Track task identity and persist artifacts separately from transient execution.

  3. Run only the workload and dependencies required for the task.

  4. Check permissions at each resource service and reconcile uncertain writes.

  5. Inspect files, records, and task-level acceptance criteria.

  6. Retain required artifacts, release temporary compute, and expire task credentials.

    Result or stopping point
Trigger.dev

Agent jobs that exceed a short synchronous request lifetime. Track task identity and persist artifacts separately from transient execution.

Follow the arrows, then select a component to inspect its responsibility. On mobile, downward arrows connect the next step; bent arrows identify branches and return paths. Select a destination to jump to that component.

When to consider it

  • Agent jobs that exceed a short synchronous request lifetime.

A design decision to make

  • Track task identity and persist artifacts separately from transient execution.

Prerequisites and setup

  • An existing Trigger.dev project or self-hosted instance and Node.js 22+. Initialize it with your intended organization/project.
Shell
npm init -y
npm install @trigger.dev/sdk
npx trigger.dev@latest init
export TRIGGER_SECRET_KEY="YOUR_DEVELOPMENT_SECRET_KEY"

Try a small integration

trigger/order.ts

JavaScript · trigger/order.ts
import { task } from '@trigger.dev/sdk';
export const orderTask=task({id:'asg-order',maxDuration:30,
  run:async(payload)=>({order_id:payload.order_id,status:payload.order_id==='A104'?'packed':'not_found'})
});

start.mjs

JavaScript · start.mjs
import { tasks } from '@trigger.dev/sdk';
const handle=await tasks.trigger('asg-order',{order_id:'A104'});
console.log('Run ID:',handle.id);

Run and check the result

Shell
# Terminal 1: keep the development worker connected.
npx trigger.dev@latest dev
# Terminal 2
node start.mjs
  • The returned handle identifies a run; inspect its final result in the development dashboard.
  • The completed result reports packed. A handle alone is not a completed task.

Common failures

  • A worker accepting a job does not establish completion. Inspect the task result, failure and retry history.
  • Do not expose a development control plane or unauthenticated execution endpoint publicly.

Production decisions

  • Use bounded CPU/memory/time, restricted filesystem mounts and network access, short-lived secrets and per-user isolation.
  • Preserve run/operation identifiers, cancellation and terminal states. Retryable remote writes need provider idempotency or reconciliation.
  • Set queue/concurrency limits, retry policy and an idempotency key before adding business writes. Deploy task versions through your CI workflow.

Keep exploring

An agent that can pause and resumeA browser or coding agent in a sandbox

Explore the same layer

TemporalInngestE2BDaytona

Compare candidates on your own workload. This entry describes a product’s role; it is not a claim that products in the category are interchangeable.