Trigger.dev: How Background Jobs Actually Work
Dec 6, 2025
trigger.devbackground-jobsserverlesstypescript
Trigger.dev is an open-source platform for building AI workflows and background jobs in TypeScript. The interesting part isn’t what it does—it’s how it achieves “no timeouts” in a serverless-like environment.
The Problem with Serverless
AWS Lambda, Vercel, and similar platforms impose hard timeout limits (typically 10-15 minutes max). If your task takes longer—processing a video, running an AI chain, sending a multi-day email campaign—you’re stuck breaking it into awkward chunks or moving to traditional servers.
Trigger.dev v2 had the same problem. Code ran in your existing deployment, so “long-running” was a lie. You could only go long if you split work into many short tasks, each under the serverless timeout.
The Solution: CRIU Checkpoint-Resume
Trigger.dev v3 solves this with CRIU (Checkpoint/Restore In Userspace), pronounced “kree-oo.”
Here’s the flow:
- Task starts in an isolated execution environment
- Task needs to wait (for a subtask, a delay, human approval)
- CRIU checkpoints the entire process - memory, CPU registers, open file descriptors, everything
- Resources are released - the execution environment is freed
- Later, task resumes - checkpoint is restored to a new environment, execution continues exactly where it left off
The task thinks it never stopped. From the code’s perspective, await wait.for({ hours: 24 }) just… waits. Under the hood, your process was frozen, stored, and resurrected a day later on potentially different hardware.
What This Enables
import { task, wait } from "@trigger.dev/sdk";
export const longWorkflow = task({
id: "long-workflow",
run: async (payload) => {
// This can literally run for days
await processStep1();
await wait.for({ hours: 6 });
await processStep2();
// Wait for human approval
const approval = await wait.forApproval();
if (!approval) return;
await finalStep();
},
});
No timeout management. No breaking things into separate jobs. No state serialization headaches. The checkpoint captures everything automatically.
The Trade-offs
- Linux-only: CRIU is a Linux tool, which constrains where you can self-host
- Self-hosting complexity: No single Docker container anymore—you need CRIU-compatible infrastructure
- Cold start considerations: Restoring a checkpoint isn’t instant, though Trigger.dev is working on sub-500ms MicroVM cold starts
Current State (2025)
- v2 reached end-of-life January 31, 2025
- v3/v4 is GA with self-hosting via Kubernetes or Docker
- Roadmap includes GitHub/Vercel integrations, improved logging with ClickHouse, and an Agent Toolkit for AI workflows
The checkpoint-resume pattern is a clever solution that preserves the serverless developer experience (no infra management, auto-scaling) while eliminating the timeout constraint that makes serverless unsuitable for many real workloads.
Source: trigger.dev