Trigger.dev v3 API Skill
Overview
Trigger.dev v3 is a full-featured background jobs platform for TypeScript, enabling long-running tasks (hours), AI generation pipelines, chunked batch jobs, and crons without serverless timeout limits.
Installation
npm install @trigger.dev/sdk@latest
Configuration
// trigger.config.ts
import { defineConfig } from '@trigger.dev/sdk/v3';
export default defineConfig({
project: 'proj_myproject123',
runtime: 'node',
maxDuration: 3600, // 1 hour max execution
});
Task Definition (v3)
// src/trigger/video-processor.ts
import { task, logger } from '@trigger.dev/sdk/v3';
export const processVideoTask = task({
id: 'process-video-task',
retry: {
maxAttempts: 3,
},
run: async (payload: { videoUrl: string; quality: '1080p' | '4k' }) => {
logger.info('Starting video encoding', { url: payload.videoUrl });
// Execute long-running processing without timeout constraints
const resultUrl = await encodeVideo(payload.videoUrl, payload.quality);
logger.info('Video encoding completed', { resultUrl });
return { success: true, resultUrl };
},
});
Triggering Tasks from Application Backend
import { tasks } from '@trigger.dev/sdk/v3';
import { processVideoTask } from '@/trigger/video-processor';
// Trigger async job
const handle = await tasks.trigger<typeof processVideoTask>(
'process-video-task',
{
videoUrl: 'https://storage.example.com/raw.mp4',
quality: '1080p',
}
);
console.log('Task run ID:', handle.id);
AI Pitfalls & Anti-Hallucination Guidelines
- v2 vs v3 Architecture: Trigger.dev v3 eliminated HTTP webhook roundtrips and runs direct Node worker processes. Do not use legacy
client.defineJob(). Usetask({ id, run }). - Logging: Use
logger.info()from@trigger.dev/sdk/v3to stream real-time logs to the Trigger.dev dashboard.
Production Verification Checklist
-
trigger.config.tsspecifies active project reference - Deployments sync tasks via
npx trigger.dev@latest deploy - Task payload types validated with TypeScript
Last Verified: 2026-07-03