en un clic
trigger-setup
// Set up Trigger.dev in your project. Use when adding Trigger.dev for the first time, creating trigger.config.ts, or initializing the trigger directory.
// Set up Trigger.dev in your project. Use when adding Trigger.dev for the first time, creating trigger.config.ts, or initializing the trigger directory.
Analyze Trigger.dev tasks, schedules, and runs for cost optimization opportunities. Use when asked to reduce spend, optimize costs, audit usage, right-size machines, or review task efficiency. Requires Trigger.dev MCP tools for run analysis.
AI agent patterns with Trigger.dev - orchestration, parallelization, routing, evaluator-optimizer, and human-in-the-loop. Use when building LLM-powered tasks that need parallel workers, approval gates, tool calling, or multi-step agent workflows.
Configure Trigger.dev projects with trigger.config.ts. Use when setting up build extensions for Prisma, Playwright, FFmpeg, Python, or customizing deployment settings.
Subscribe to Trigger.dev task runs in real-time from frontend and backend. Use when building progress indicators, live dashboards, streaming AI/LLM responses, or React components that display task status.
Build AI agents, workflows and durable background tasks with Trigger.dev. Use when creating tasks, triggering jobs, handling retries, scheduling cron jobs, or implementing queues and concurrency control.
| name | trigger-setup |
| description | Set up Trigger.dev in your project. Use when adding Trigger.dev for the first time, creating trigger.config.ts, or initializing the trigger directory. |
Get Trigger.dev running in your project in minutes.
npm install @trigger.dev/sdk
npx trigger init
This creates:
trigger.config.ts - project configurationtrigger/ directory - where your tasks livetrigger/example.ts - a sample taskimport { defineConfig } from "@trigger.dev/sdk";
export default defineConfig({
project: "proj_xxxxx", // From dashboard
dirs: ["./trigger"],
});
// trigger/my-task.ts
import { task } from "@trigger.dev/sdk";
export const myFirstTask = task({
id: "my-first-task",
run: async (payload: { name: string }) => {
console.log(`Hello, ${payload.name}!`);
return { message: `Processed ${payload.name}` };
},
});
npx trigger dev
From your app code:
import { tasks } from "@trigger.dev/sdk";
import type { myFirstTask } from "./trigger/my-task";
await tasks.trigger<typeof myFirstTask>("my-first-task", {
name: "World",
});
Or from the Trigger.dev dashboard "Test" tab.
your-project/
├── trigger.config.ts # Required - project config
├── trigger/ # Required - task files
│ ├── my-task.ts
│ └── another-task.ts
├── package.json
└── ...
Create .env or set in your environment:
TRIGGER_SECRET_KEY=tr_dev_xxxxx # From dashboard > API Keys
dirs folderstrigger.config.ts points to correct directoriesproject in config matches dashboardTRIGGER_SECRET_KEY is setnpx trigger dev after adding new taskstask() or schemaTask() from @trigger.dev/sdk