TOOL WIKI · RUNTIME & DEPLOYMENT
Trigger.dev
Runs background tasks and workflows for application services.
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
Set the allowed runtime, network access, credentials, and maximum duration.
inputTo 02 · Trigger.devAgent jobs that exceed a short synchronous request lifetime. Track task identity and persist artifacts separately from transient execution.
processTo 03 · Worker environmentRun only the workload and dependencies required for the task.
Check permissions at each resource service and reconcile uncertain writes.
Inspect files, records, and task-level acceptance criteria.
outputTo 06 · LifecycleRetain required artifacts, release temporary compute, and expire task credentials.
Result or stopping point
Agent jobs that exceed a short synchronous request lifetime. Track task identity and persist artifacts separately from transient execution.
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.
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
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
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
# 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
Explore the same layer
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.