@trigger.dev/sdk 4.7.2 → 4.7.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (97) hide show
  1. package/dist/commonjs/v3/ai.d.ts +5 -0
  2. package/dist/commonjs/v3/ai.js +6 -2
  3. package/dist/commonjs/v3/ai.js.map +1 -1
  4. package/dist/commonjs/v3/chat-server.d.ts +7 -0
  5. package/dist/commonjs/v3/chat-server.js +3 -0
  6. package/dist/commonjs/v3/chat-server.js.map +1 -1
  7. package/dist/commonjs/v3/concurrencyLimits.d.ts +37 -7
  8. package/dist/commonjs/v3/concurrencyLimits.js +38 -70
  9. package/dist/commonjs/v3/concurrencyLimits.js.map +1 -1
  10. package/dist/commonjs/v3/index.d.ts +1 -1
  11. package/dist/commonjs/v3/index.js.map +1 -1
  12. package/dist/commonjs/v3/runs.d.ts +22 -1
  13. package/dist/commonjs/v3/runs.js +6 -3
  14. package/dist/commonjs/v3/runs.js.map +1 -1
  15. package/dist/commonjs/version.js +1 -1
  16. package/dist/esm/v3/ai.d.ts +5 -0
  17. package/dist/esm/v3/ai.js +6 -2
  18. package/dist/esm/v3/ai.js.map +1 -1
  19. package/dist/esm/v3/chat-server.d.ts +7 -0
  20. package/dist/esm/v3/chat-server.js +3 -0
  21. package/dist/esm/v3/chat-server.js.map +1 -1
  22. package/dist/esm/v3/concurrencyLimits.d.ts +37 -7
  23. package/dist/esm/v3/concurrencyLimits.js +38 -70
  24. package/dist/esm/v3/concurrencyLimits.js.map +1 -1
  25. package/dist/esm/v3/index.d.ts +1 -1
  26. package/dist/esm/v3/index.js.map +1 -1
  27. package/dist/esm/v3/runs.d.ts +22 -1
  28. package/dist/esm/v3/runs.js +6 -3
  29. package/dist/esm/v3/runs.js.map +1 -1
  30. package/dist/esm/version.js +1 -1
  31. package/docs/ai-chat/patterns/sub-agents.mdx +33 -0
  32. package/docs/apikeys.mdx +3 -3
  33. package/docs/billing-limits.mdx +1 -1
  34. package/docs/cli-env-commands.mdx +5 -4
  35. package/docs/cli-init-commands.mdx +27 -1
  36. package/docs/cli-login-commands.mdx +20 -0
  37. package/docs/cli-projects-commands.mdx +13 -1
  38. package/docs/cli-runs-commands.mdx +3 -2
  39. package/docs/cli-update-commands.mdx +9 -3
  40. package/docs/cli-whoami-commands.mdx +12 -0
  41. package/docs/concurrency.mdx +32 -0
  42. package/docs/config/extensions/audioWaveform.mdx +4 -1
  43. package/docs/config/extensions/overview.mdx +2 -0
  44. package/docs/config/extensions/prismaExtension.mdx +2 -3
  45. package/docs/config/extensions/puppeteer.mdx +3 -5
  46. package/docs/config/extensions/pythonExtension.mdx +9 -1
  47. package/docs/config/extensions/syncEnvVars.mdx +6 -0
  48. package/docs/deploy-environment-variables.mdx +1 -1
  49. package/docs/deployment/atomic-deployment.mdx +2 -0
  50. package/docs/deployment/dev-branches.mdx +5 -5
  51. package/docs/deployment/overview.mdx +8 -7
  52. package/docs/deployment/preview-branches.mdx +6 -3
  53. package/docs/errors-retrying.mdx +4 -4
  54. package/docs/how-it-works.mdx +5 -5
  55. package/docs/introduction.mdx +6 -0
  56. package/docs/limits.mdx +26 -8
  57. package/docs/logging.mdx +1 -1
  58. package/docs/machines.mdx +1 -1
  59. package/docs/mcp-introduction.mdx +8 -7
  60. package/docs/mcp-tools.mdx +15 -1
  61. package/docs/migrating-from-v3.mdx +1 -1
  62. package/docs/observability/dashboards.mdx +2 -0
  63. package/docs/observability/query.mdx +6 -2
  64. package/docs/private-networking/aws-console-setup.mdx +1 -1
  65. package/docs/private-networking/overview.mdx +1 -1
  66. package/docs/quick-start.mdx +3 -40
  67. package/docs/realtime/auth.mdx +1 -1
  68. package/docs/realtime/backend/input-streams.mdx +159 -0
  69. package/docs/realtime/backend/streams.mdx +25 -10
  70. package/docs/realtime/how-it-works.mdx +1 -1
  71. package/docs/realtime/react-hooks/overview.mdx +1 -1
  72. package/docs/realtime/react-hooks/streams.mdx +2 -2
  73. package/docs/realtime/react-hooks/subscribe.mdx +19 -3
  74. package/docs/realtime/react-hooks/triggering.mdx +2 -2
  75. package/docs/realtime/react-hooks/use-wait-token.mdx +1 -1
  76. package/docs/realtime/run-object.mdx +47 -24
  77. package/docs/replaying.mdx +26 -1
  78. package/docs/reports.mdx +4 -2
  79. package/docs/run-tests.mdx +2 -2
  80. package/docs/run-usage.mdx +3 -3
  81. package/docs/runs/heartbeats.mdx +2 -2
  82. package/docs/runs/list-best-practices.mdx +234 -0
  83. package/docs/runs/metadata.mdx +7 -10
  84. package/docs/runs.mdx +18 -8
  85. package/docs/self-hosting/env/supervisor.mdx +2 -1
  86. package/docs/self-hosting/env/webapp.mdx +6 -0
  87. package/docs/self-hosting/overview.mdx +26 -0
  88. package/docs/tags.mdx +6 -0
  89. package/docs/tasks/scheduled.mdx +11 -5
  90. package/docs/triggering.mdx +8 -0
  91. package/docs/troubleshooting-alerts.mdx +102 -3
  92. package/docs/troubleshooting.mdx +1 -1
  93. package/docs/upgrading-packages.mdx +3 -3
  94. package/docs/vercel-integration.mdx +13 -3
  95. package/docs/versioning.mdx +1 -1
  96. package/docs/wait-for-token.mdx +3 -3
  97. package/package.json +2 -2
@@ -7,7 +7,6 @@ description: "List, get, set, and pull environment variables for a Trigger.dev p
7
7
  import CommonOptions from "/snippets/cli-options-common.mdx";
8
8
  import ConfigFileOptions from "/snippets/cli-options-config-file.mdx";
9
9
  import ProjectRefOptions from "/snippets/cli-options-project-ref.mdx";
10
- import BranchOptions from "/snippets/cli-options-branch.mdx";
11
10
 
12
11
  These commands manage environment variables on a project environment. They default to `prod`. Use `--env staging` or `--env preview` (with `--branch`) for the other environments. There is no `dev` target: local `trigger dev` reads your local `.env`.
13
12
 
@@ -82,7 +81,7 @@ npx trigger.dev@latest env set STRIPE_KEY sk_live_abc --secret
82
81
 
83
82
  ## env pull
84
83
 
85
- Writes the project's environment variables to a local file. Defaults to `.env.local`. Fails if the file already exists unless you pass `--force`.
84
+ Writes the project's environment variables to a local file. Defaults to `.env.local`. Asks you to confirm before overwriting an existing file unless you pass `--force`. `TRIGGER_` system variables are omitted.
86
85
 
87
86
  ```bash
88
87
  npx trigger.dev@latest env pull
@@ -94,7 +93,7 @@ npx trigger.dev@latest env pull --output .env.trigger --force
94
93
  </ParamField>
95
94
 
96
95
  <ParamField body="Force" type="--force">
97
- Overwrite the output file if it exists.
96
+ Overwrite the output file if it exists, without asking.
98
97
  </ParamField>
99
98
 
100
99
  ## Options
@@ -105,7 +104,9 @@ npx trigger.dev@latest env pull --output .env.trigger --force
105
104
 
106
105
  <ConfigFileOptions />
107
106
  <ProjectRefOptions />
108
- <BranchOptions />
107
+ <ParamField body="Preview branch" type="--branch | -b">
108
+ Required when using `--env preview`. Specify the branch, e.g. `--branch my-branch` or `-b my-branch`.
109
+ </ParamField>
109
110
 
110
111
  ### Common options
111
112
 
@@ -24,6 +24,12 @@ yarn dlx trigger.dev@latest init
24
24
 
25
25
  </CodeGroup>
26
26
 
27
+ ## Arguments
28
+
29
+ <ParamField body="Project path" type="[path]">
30
+ The path to the project. Defaults to `.`.
31
+ </ParamField>
32
+
27
33
  ## Options
28
34
 
29
35
  <ParamField body="Javascript" type="--javascript">
@@ -36,7 +42,7 @@ yarn dlx trigger.dev@latest init
36
42
  </ParamField>
37
43
 
38
44
  <ParamField body="Package tag" type="--tag | -t">
39
- The version of the `@trigger.dev/sdk` package to install. Defaults to `latest`.
45
+ The version of the `@trigger.dev/sdk` package to install. Defaults to the CLI version.
40
46
  </ParamField>
41
47
 
42
48
  <ParamField body="Skip package install" type="--skip-package-install">
@@ -47,6 +53,26 @@ yarn dlx trigger.dev@latest init
47
53
  Override the existing config file if it exists.
48
54
  </ParamField>
49
55
 
56
+ <ParamField body="Project name" type="--project-name <name>">
57
+ The name of the project to create when your account has no projects yet.
58
+ </ParamField>
59
+
60
+ <ParamField body="Organization name" type="--org-name <name>">
61
+ The organization to create the first project in. Matches an existing organization by name, or creates it if you have none.
62
+ </ParamField>
63
+
64
+ <ParamField body="Runtime" type="-r, --runtime <runtime>">
65
+ The runtime to use: `node`, `node-22`, `node-24`, `node-26` or `bun`. Defaults to `node-24`.
66
+ </ParamField>
67
+
68
+ <ParamField body="Yes" type="-y, --yes">
69
+ Skip all prompts. Requires `--project-ref`, or `--project-name` with `--org-name` for a new account.
70
+ </ParamField>
71
+
72
+ <ParamField body="No browser" type="--no-browser">
73
+ Do not open the browser during login. Print the URL only.
74
+ </ParamField>
75
+
50
76
  <ParamField body="Package arguments" type="--pkg-args">
51
77
  Additional arguments to pass to the package manager. Accepts CSV for multiple args.
52
78
  </ParamField>
@@ -26,6 +26,26 @@ yarn dlx trigger.dev@latest login
26
26
 
27
27
  ## Options
28
28
 
29
+ <ParamField body="No browser" type="--no-browser">
30
+ Do not open the browser. Print the URL only.
31
+ </ParamField>
32
+
33
+ <ParamField body="Email" type="--email <email>">
34
+ Prefill the email on the login page.
35
+ </ParamField>
36
+
37
+ <ParamField body="Name" type="--name <name>">
38
+ Set your name after authorization. Only applies to a new account that has not set its details yet.
39
+ </ParamField>
40
+
41
+ <ParamField body="Cancel pending" type="--cancel-pending">
42
+ Cancel a pending login and keep the current account.
43
+ </ParamField>
44
+
45
+ <ParamField body="No wait" type="--no-wait">
46
+ Save the authorization and exit so login can be resumed later.
47
+ </ParamField>
48
+
29
49
  ### Common options
30
50
 
31
51
  These options are available on most commands.
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  title: "CLI projects commands"
3
3
  sidebarTitle: "projects"
4
- description: "Create, inspect, and rename Trigger.dev projects from the terminal."
4
+ description: "List, create, inspect, and rename Trigger.dev projects from the terminal."
5
5
  ---
6
6
 
7
7
  import CommonOptions from "/snippets/cli-options-common.mdx";
@@ -37,6 +37,18 @@ yarn dlx trigger.dev@latest projects create
37
37
  The name of the new project.
38
38
  </ParamField>
39
39
 
40
+ ## projects list
41
+
42
+ Lists your projects with the runtime and version of their current Production deployment.
43
+
44
+ ```bash
45
+ npx trigger.dev@latest projects list
46
+ ```
47
+
48
+ <ParamField body="Needs update" type="--needs-update">
49
+ Only show projects using Node.js 21 in Production.
50
+ </ParamField>
51
+
40
52
  ## projects get
41
53
 
42
54
  Prints the name, ref, slug, organization, default runtime and region of a project.
@@ -7,7 +7,6 @@ description: "Use these commands to list, inspect, replay and cancel runs from y
7
7
  import CommonOptions from "/snippets/cli-options-common.mdx";
8
8
  import ConfigFileOptions from "/snippets/cli-options-config-file.mdx";
9
9
  import ProjectRefOptions from "/snippets/cli-options-project-ref.mdx";
10
- import BranchOptions from "/snippets/cli-options-branch.mdx";
11
10
 
12
11
  ## runs list
13
12
 
@@ -85,7 +84,9 @@ npx trigger.dev@latest runs cancel run_abc123
85
84
 
86
85
  <ConfigFileOptions />
87
86
  <ProjectRefOptions />
88
- <BranchOptions />
87
+ <ParamField body="Preview branch" type="--branch | -b">
88
+ Required when using `--env preview`. Specify the branch, e.g. `--branch my-branch` or `-b my-branch`.
89
+ </ParamField>
89
90
 
90
91
  ### Common options
91
92
 
@@ -14,19 +14,25 @@ Run the command like this:
14
14
  <CodeGroup>
15
15
 
16
16
  ```bash npm
17
- npx trigger.dev@latest update
17
+ npx trigger.dev@latest update [path]
18
18
  ```
19
19
 
20
20
  ```bash pnpm
21
- pnpm dlx trigger.dev@latest update
21
+ pnpm dlx trigger.dev@latest update [path]
22
22
  ```
23
23
 
24
24
  ```bash yarn
25
- yarn dlx trigger.dev@latest update
25
+ yarn dlx trigger.dev@latest update [path]
26
26
  ```
27
27
 
28
28
  </CodeGroup>
29
29
 
30
+ ## Arguments
31
+
32
+ <ParamField body="Project path" type="[path]">
33
+ The directory that contains the `package.json` file. Defaults to `.`.
34
+ </ParamField>
35
+
30
36
  ## Options
31
37
 
32
38
  ### Common options
@@ -26,6 +26,18 @@ yarn dlx trigger.dev@latest whoami
26
26
 
27
27
  ## Options
28
28
 
29
+ <ParamField body="Config file" type="-c, --config <config file>">
30
+ The name of the config file.
31
+ </ParamField>
32
+
33
+ <ParamField body="Project ref" type="-p, --project-ref <project ref>">
34
+ The project ref. Overrides the project in the config file.
35
+ </ParamField>
36
+
37
+ <ParamField body="Env file" type="--env-file <env file>">
38
+ Path to a `.env` file to read `TRIGGER_PROJECT_REF` from. Defaults to `.env`, `.env.development`, `.env.local`, `.env.development.local` and `dev.vars` in the current directory.
39
+ </ParamField>
40
+
29
41
  ### Common options
30
42
 
31
43
  These options are available on most commands.
@@ -367,6 +367,38 @@ await concurrencyLimits.reset("openai");
367
367
 
368
368
  Overrides survive deploys: redeploying your code keeps an active override until you reset it.
369
369
 
370
+ ### Overriding a limit for one key
371
+
372
+ Pass `concurrencyKey` to override a limit's `perKey` for a single key, for example to let one session run more (or fewer) runs at once than the limit allows every other key:
373
+
374
+ ```ts
375
+ import { concurrencyLimits } from "@trigger.dev/sdk";
376
+
377
+ // this session may run 3 at once under "subagents", for the next 7 days
378
+ await concurrencyLimits.override("subagents", {
379
+ concurrencyKey: sessionId,
380
+ perKey: 3,
381
+ ttl: "7d",
382
+ });
383
+
384
+ // read it back: the key's bound, the override, and when it expires
385
+ const view = await concurrencyLimits.retrieve("subagents", { concurrencyKey: sessionId });
386
+ console.log(view.perKey.override, view.perKey.expiresAt, view.running);
387
+
388
+ // clear it early
389
+ await concurrencyLimits.reset("subagents", { concurrencyKey: sessionId });
390
+ ```
391
+
392
+ A per-key override behaves differently from a limit override:
393
+
394
+ - **It is temporary.** It expires after `ttl` (a duration such as `"7d"` or a number of seconds). The default is 7 days and the maximum is 30 days. Call `override` again to extend it. Nothing warns you when it lapses, so check `expiresAt` if a key must keep its cap for longer than a week.
395
+ - **It changes one limit only.** The limit's own bounds and every other limit the run holds are untouched. A tenant-wide limit keeps applying on top of a per-session override.
396
+ - **It applies to every task holding the limit**, because the key's pool under a shared named limit is one pool.
397
+ - **It needs a `perKey` to override.** A limit declared with only a `total` has no per-key bound, so the call is rejected, and if a later deploy removes a limit's `perKey` its per-key overrides stop applying. A task's inline limit is addressed as `task/<task-id>`. `total` is not per key, so `concurrencyKey` goes with `perKey` (and optionally `ttl`) and never with `total`; the SDK's types enforce this.
398
+ - **`perKey: 0` blocks the key.** A paused limit stays paused whatever the override says.
399
+ - **It does not stop runs.** Lowering a key's cap takes effect at the next run to start; runs already executing continue.
400
+ - **`reset(name)` without a key leaves per-key overrides alone**; clear them with `reset(name, { concurrencyKey })` or let them expire.
401
+
370
402
  ### Pausing a limit
371
403
 
372
404
  Pause a limit to stop every run holding it from being dequeued; runs that are already executing continue to completion. The configured bounds are kept, and resuming restores them:
@@ -14,7 +14,10 @@ export default defineConfig({
14
14
  project: "<project ref>",
15
15
  // Your other config settings...
16
16
  build: {
17
- extensions: [audioWaveform()], // uses verson 1.1.0 of audiowaveform by default
17
+ extensions: [audioWaveform()], // uses version 1.10.1 of audiowaveform by default
18
18
  },
19
19
  });
20
20
  ```
21
+
22
+ To use a different version, pass the `version` and `checksum` options to `audioWaveform()`.
23
+
@@ -51,6 +51,8 @@ Trigger.dev provides a set of built-in extensions that you can use to customize
51
51
  | [prismaExtension](/config/extensions/prismaExtension) | Using prisma in your Trigger.dev tasks |
52
52
  | [pythonExtension](/config/extensions/pythonExtension) | Execute Python scripts in your project |
53
53
  | [puppeteer](/config/extensions/puppeteer) | Use Puppeteer in your Trigger.dev tasks |
54
+ | [playwright](/config/extensions/playwright) | Use Playwright in your Trigger.dev tasks |
55
+ | [lightpanda](/config/extensions/lightpanda) | Use Lightpanda in your Trigger.dev tasks |
54
56
  | [ffmpeg](/config/extensions/ffmpeg) | Use FFmpeg in your Trigger.dev tasks |
55
57
  | [aptGet](/config/extensions/aptGet) | Install system packages in your build image |
56
58
  | [additionalFiles](/config/extensions/additionalFiles) | Copy additional files to your build image |
@@ -641,7 +641,7 @@ prismaExtension({
641
641
  ```prisma
642
642
  generator client {
643
643
  provider = "prisma-client-js"
644
- binaryTargets = ["native", "linux-arm64-openssl-3.0.x"]
644
+ binaryTargets = ["native", "debian-openssl-3.0.x"]
645
645
  }
646
646
  ```
647
647
 
@@ -885,7 +885,7 @@ export const db = new PrismaClient({
885
885
  generator client {
886
886
  provider = "prisma-client-js"
887
887
  output = "../src/generated/prisma"
888
- binaryTargets = ["native", "linux-arm64-openssl-3.0.x"]
888
+ binaryTargets = ["native", "debian-openssl-3.0.x"]
889
889
  }
890
890
 
891
891
  datasource db {
@@ -913,7 +913,6 @@ datasource db {
913
913
  prismaExtension({
914
914
  mode: "engine-only",
915
915
  version: "6.19.0",
916
- binaryTarget: "linux-arm64-openssl-3.0.x",
917
916
  });
918
917
  ```
919
918
 
@@ -4,6 +4,8 @@ sidebarTitle: "puppeteer"
4
4
  description: "Use the puppeteer build extension to enable support for Puppeteer in your project"
5
5
  ---
6
6
 
7
+ import ScrapingWarning from "/snippets/web-scraping-warning.mdx";
8
+
7
9
  <ScrapingWarning />
8
10
 
9
11
  To use Puppeteer in your project, add these build settings to your `trigger.config.ts` file:
@@ -21,10 +23,6 @@ export default defineConfig({
21
23
  });
22
24
  ```
23
25
 
24
- And add the following environment variable in your Trigger.dev dashboard on the Environment Variables page:
25
-
26
- ```bash
27
- PUPPETEER_EXECUTABLE_PATH: "/usr/bin/google-chrome-stable",
28
- ```
26
+ The extension installs Chrome and sets `PUPPETEER_EXECUTABLE_PATH=/usr/bin/google-chrome-stable` for deployed builds automatically, so you do not need to set it. Don't set it in your Dev environment: the extension does nothing in Dev, and locally Puppeteer uses the browser it downloads on install.
29
27
 
30
28
  Follow [this example](/guides/examples/puppeteer) to get setup with Trigger.dev and Puppeteer in your project.
@@ -103,6 +103,14 @@ export default defineConfig({
103
103
 
104
104
  This will install the packages specified in the `requirements.txt` file during the build process. You can then use these packages in your Python scripts.
105
105
 
106
+ You can also list requirements inline with the `requirements` option instead. You can't use it together with `requirementsFile`:
107
+
108
+ ```ts
109
+ pythonExtension({
110
+ requirements: ["pandas"],
111
+ });
112
+ ```
113
+
106
114
  <Note>
107
115
  The `requirementsFile` option is only available in production mode. In development mode, you can
108
116
  install the required packages manually using the `pip` command.
@@ -145,7 +153,7 @@ export const myStreamingScript = task({
145
153
  const result = python.stream.runScript("./python/my_script.py", ["hello", "world"]);
146
154
 
147
155
  // result is an async iterable/readable stream
148
- for await (const chunk of streamingResult) {
156
+ for await (const chunk of result) {
149
157
  console.log(chunk);
150
158
  }
151
159
  },
@@ -31,6 +31,9 @@ The callback is passed a context object with the following properties:
31
31
  - `environment`: The environment name that the task is being deployed to (e.g. `production`, `staging`, etc.)
32
32
  - `projectRef`: The project ref of the Trigger.dev project
33
33
  - `env`: The environment variables that are currently set in the Trigger.dev project
34
+ - `branch`: The preview branch name, if deploying to a preview branch (optional)
35
+
36
+ `syncEnvVars` also accepts a second argument with an `override` option (defaults to `true`). When `true`, synced variables overwrite variables with the same name that are already set in the environment you're deploying to. Set it to `false` to only sync variables that aren't set there yet.
34
37
 
35
38
  ### Marking variables as secrets
36
39
 
@@ -168,12 +171,15 @@ export default defineConfig({
168
171
  projectId: "your-vercel-project-id",
169
172
  vercelAccessToken: "your-vercel-access-token", // optional, we recommend to keep it as env variable
170
173
  vercelTeamId: "your-vercel-team-id", // optional
174
+ branch: "your-preview-branch", // optional
171
175
  }),
172
176
  ],
173
177
  },
174
178
  });
175
179
  ```
176
180
 
181
+ The `branch` option filters branch-specific Vercel variables for preview branches. It defaults to the `VERCEL_PREVIEW_BRANCH` environment variable, then the Trigger.dev preview branch. The access token is read from `VERCEL_ACCESS_TOKEN`, falling back to `VERCEL_TOKEN`.
182
+
177
183
  ### syncNeonEnvVars
178
184
 
179
185
  The `syncNeonEnvVars` build extension syncs environment variables from your Neon database project to Trigger.dev. It automatically detects branches and builds the appropriate database connection strings for your environment.
@@ -14,7 +14,7 @@ We deploy your tasks and scale them up and down when they are triggered. So any
14
14
  <Steps>
15
15
 
16
16
  <Step title="Go to the Environment Variables page">
17
- In the sidebar select the "Environment Variables" page, then press the "New environment variable"
17
+ In the sidebar select the "Environment Variables" page, then press the "Add new"
18
18
  button. ![Environment variables page](/images/environment-variables-page.jpg)
19
19
  </Step>
20
20
 
@@ -443,6 +443,8 @@ If you use the [Vercel integration](/vercel-integration), version skew protectio
443
443
 
444
444
  This covers production, staging and preview alike.
445
445
 
446
+ In production, the integration also gates the release on the task build. Each production deployment from your production branch carries a blocking **Trigger.dev Build** check, so a commit whose tasks fail to build never goes live and its runs never wait on a deployment that won't arrive. Re-run the **Trigger.dev deployment** check in GitHub to build that commit again. See [Production waits for your tasks](/vercel-integration#production-waits-for-your-tasks).
447
+
446
448
  ### Opting out
447
449
 
448
450
  Set `TRIGGER_AUTOMATIC_SKEW_VERSION_PROTECTION` to `0` on your Vercel project. A `0` you set today stays `0` through every subsequent build.
@@ -59,7 +59,7 @@ You can also set the branch with the `TRIGGER_DEV_BRANCH` environment variable i
59
59
 
60
60
  ## Archive a branch
61
61
 
62
- Archive a branch from the CLI when you no longer need it. The CLI detects your local git branch, or you can name one with `--branch`:
62
+ Archive a branch from the CLI when you no longer need it. Pass the branch with `--branch` (or set `TRIGGER_DEV_BRANCH`); it's required, and the `default` branch can't be archived:
63
63
 
64
64
  <CodeGroup>
65
65
 
@@ -81,12 +81,12 @@ You can also create and archive branches from the **Dev branches** page in the d
81
81
 
82
82
  ## Limits on active branches
83
83
 
84
- Each branch has its own concurrency, so we limit how many can be active per project. Archive a branch at any time to unlock another slot.
84
+ Each branch has its own concurrency, so we limit how many dev branches each developer can have active per project. The `default` development environment counts toward this limit. If you are at the limit when you run `dev --branch`, the CLI automatically archives up to 3 of your branches that have no connected dev session and have been idle for over an hour, to make room. You can also archive a branch any time to free a slot.
85
85
 
86
86
  | Plan | Active dev branches |
87
87
  | ----- | ------------------- |
88
- | Free | 25 |
89
- | Hobby | 25 |
90
- | Pro | 25 |
88
+ | Free | 50 |
89
+ | Hobby | 50 |
90
+ | Pro | 50 |
91
91
 
92
92
  Need more? [Get in touch](https://trigger.dev/contact) and we'll raise the limit.
@@ -6,7 +6,7 @@ description: "Learn how to deploy your tasks to Trigger.dev."
6
6
 
7
7
  import CorepackError from "/snippets/corepack-error.mdx";
8
8
 
9
- Before you can run production workloads on Trigger.dev, you need to deploy your tasks. The only way to do this at the moment is through the [deploy CLI command](/cli-deploy-commands):
9
+ Before you can run production workloads on Trigger.dev, you need to deploy your tasks. The manual way to do this is the [deploy CLI command](/cli-deploy-commands). You can also deploy automatically with the [GitHub integration](/github-integration) or the [Vercel integration](/vercel-integration):
10
10
 
11
11
  <CodeGroup>
12
12
 
@@ -100,8 +100,9 @@ When you deploy, the version number is automatically incremented, and the new ve
100
100
  The current version defines which version of the code new task runs will execute against. When a task run starts, it is locked to the current version. This ensures that the task run is not affected by changes to the code. Retries of the task run will also be locked to the original version.
101
101
 
102
102
  <Note>
103
- When you Replay a run in the dashboard we will create a new run, locked to the current version and
104
- not necessarily the version of the original run.
103
+ When you Replay a run in the dashboard we create a new run that uses the current version by default
104
+ (in deployed environments you can pick a specific version in the replay dialog), not necessarily
105
+ the version of the original run.
105
106
  </Note>
106
107
 
107
108
  ### Version locking
@@ -186,10 +187,10 @@ For additional environments beyond `prod` and `staging`, you can use [preview br
186
187
 
187
188
  ## Local builds
188
189
 
189
- By default we use a remote build provider to speed up builds. However, you can also force the build to happen locally on your machine using the `--force-local-build` flag:
190
+ By default we use a remote build provider to speed up builds. However, you can also force the build to happen locally on your machine using the `--local-build` flag:
190
191
 
191
192
  ```bash
192
- npx trigger.dev deploy --force-local-build
193
+ npx trigger.dev deploy --local-build
193
194
  ```
194
195
 
195
196
  <Tip>
@@ -205,7 +206,7 @@ To use local builds, you need the following tools installed on your machine:
205
206
 
206
207
  ## Environment variables
207
208
 
208
- To add custom environment variables to your deployed tasks, you need to add them to your project in the Trigger.dev dashboard, or automatically sync them using our [syncEnvVars](/config/config-file#syncenvvars) or [syncVercelEnvVars](/config/config-file#syncvercelenvvars) build extensions.
209
+ To add custom environment variables to your deployed tasks, you need to add them to your project in the Trigger.dev dashboard, or automatically sync them using our [syncEnvVars](/config/extensions/syncEnvVars) or [syncVercelEnvVars](/config/extensions/syncEnvVars#syncvercelenvvars) build extensions.
209
210
 
210
211
  For more information on environment variables, see our [environment variables](/deploy-environment-variables) guide.
211
212
 
@@ -235,7 +236,7 @@ You can run the deploy command with `--log-level debug` at the end. This will pr
235
236
 
236
237
  There should be a link below the error message to the full build logs on your machine. Take a look at these to see what went wrong. Join [our Discord](https://trigger.dev/discord) and you share it privately with us if you can't figure out what's going wrong. Do NOT share these publicly as the verbose logs might reveal private information about your project.
237
238
 
238
- Sometimes these errors are caused by upstream availability issues with our remote build provider. In this case, you can try deploying with a local build using the `--force-local-build` flag. Refer to the [Local builds](#local-builds) section for more information.
239
+ Sometimes these errors are caused by upstream availability issues with our remote build provider. In this case, you can try deploying with a local build using the `--local-build` flag. Refer to the [Local builds](#local-builds) section for more information.
239
240
 
240
241
  #### `Deployment encountered an error`
241
242
 
@@ -18,10 +18,13 @@ The process to use preview branches looks like this:
18
18
  3. Create a named **Trigger only** API key in the Preview environment, then trigger runs using the key (`TRIGGER_SECRET_KEY`) and branch name (`TRIGGER_PREVIEW_BRANCH`).
19
19
  4. Archive the preview branch when the branch is done.
20
20
 
21
- There are two main ways to do this:
21
+ There are three main ways to do this:
22
22
 
23
- 1. Automatically: using GitHub Actions (recommended).
24
- 2. Manually: in the dashboard and/or using the CLI.
23
+ 1. Automatically: using the [GitHub integration](/github-integration), which deploys pull requests to preview branches and archives them when the PR is merged or closed, without a GitHub Action.
24
+ 2. Automatically: using GitHub Actions, if you deploy from your own CI workflows.
25
+ 3. Manually: in the dashboard and/or using the CLI.
26
+
27
+ Pick one of the automatic options, not both.
25
28
 
26
29
  ### Limits on active preview branches
27
30
 
@@ -15,8 +15,8 @@ You can configure retrying in two ways:
15
15
  <Note>Task-level retry settings override the defaults in your `trigger.config` file.</Note>
16
16
 
17
17
  <Note>
18
- By default when you create your project using the CLI init command we disabled retrying in the DEV
19
- environment. You can enable it in your [trigger.config file](/config/config-file).
18
+ By default when you create your project using the CLI init command, retrying is enabled in the DEV
19
+ environment. You can disable it by setting `enabledInDev: false` in your [trigger.config file](/config/config-file).
20
20
  </Note>
21
21
 
22
22
  ## A simple example with OpenAI
@@ -112,7 +112,7 @@ import { task, logger, retry } from "@trigger.dev/sdk";
112
112
 
113
113
  export const taskWithFetchRetries = task({
114
114
  id: "task-with-fetch-retries",
115
- run: async ({ payload, ctx }) => {
115
+ run: async (payload: any, { ctx }) => {
116
116
  //if the Response is a 429 (too many requests), it will retry using the data from the response. A lot of good APIs send these headers.
117
117
  const headersResponse = await retry.fetch("http://my.host/test-headers", {
118
118
  retry: {
@@ -182,7 +182,7 @@ export const taskWithFetchRetries = task({
182
182
 
183
183
  ## Advanced error handling and retrying
184
184
 
185
- We provide a `catchError` callback on the task and in your `trigger.config` file. This gets called when an uncaught error is thrown in your task.
185
+ We provide a `catchError` callback on the task, and you can register one globally with `tasks.catchError()`. This gets called when an uncaught error is thrown in your task.
186
186
 
187
187
  You can
188
188
 
@@ -6,7 +6,7 @@ description: "Understand how Trigger.dev works and how it can help you."
6
6
 
7
7
  ## Introduction
8
8
 
9
- Trigger.dev v3 allows you to integrate long-running async tasks into your application and run them in the background. This allows you to offload tasks that take a long time to complete, such as sending multi-day email campaigns, processing videos, or running long chains of AI tasks.
9
+ Trigger.dev allows you to integrate long-running async tasks into your application and run them in the background. This allows you to offload tasks that take a long time to complete, such as sending multi-day email campaigns, processing videos, or running long chains of AI tasks.
10
10
 
11
11
  For example, the below task processes a video with `ffmpeg` and sends the results to an s3 bucket, then updates a database with the results and sends an email to the user.
12
12
 
@@ -278,8 +278,8 @@ export const convertVideo = task({
278
278
  // Update database
279
279
  await updateVideoUrl(videoId, s3Url);
280
280
 
281
- // Send email, we don't need to wait for this to finish
282
- await sendUserEmail.trigger({ videoId, s3Url }, { idempotencyKey });
281
+ // Send email
282
+ await sendUserEmail.triggerAndWait({ videoId, s3Url }, { idempotencyKey }).unwrap();
283
283
 
284
284
  return { success: true, s3Url };
285
285
  },
@@ -420,7 +420,7 @@ When you run `npx trigger.dev@latest dev`, we run your task code locally on your
420
420
  - Changes are automatically detected and a new version is spun up when you save your code.
421
421
  - Add debuggers and breakpoints to your code and debug it locally.
422
422
  - Each task is run in a separate process, so you can run multiple tasks in parallel.
423
- - Auto-cancels tasks when you stop the dev server.
423
+ - Stopping the dev server stops your local task processes. If the CLI is killed abruptly (for example by a package manager sending SIGKILL), in-flight runs are cancelled automatically. After a normal Ctrl-C stop, in-flight runs are not cancelled and can end with a `TASK_RUN_STALLED_EXECUTING` error once the 5 minute heartbeat timeout passes.
424
424
 
425
425
  <Note>
426
426
  Trigger.dev currently does not support "offline" dev mode, where you can run tasks without an
@@ -430,7 +430,7 @@ When you run `npx trigger.dev@latest dev`, we run your task code locally on your
430
430
 
431
431
  ## Staging and production environments
432
432
 
433
- Trigger.dev supports deploying to `prod` and `staging` environments. This allows you to test your tasks in a staging environment before deploying them to production. You can deploy to a different environment by running `npx trigger.dev@latest deploy --env <env>`, where `<env>` is either `prod` or `staging`. Each environment has its own API Key, which you can use to trigger tasks in that environment.
433
+ Trigger.dev supports deploying to `prod` and `staging` environments. This allows you to test your tasks in a staging environment before deploying them to production. You can deploy to a different environment by running `npx trigger.dev@latest deploy --env <env>`, where `<env>` is `prod`, `staging` or `preview` (the branch is detected from git, or you can pass `--branch`). Each environment has its own API Key, which you can use to trigger tasks in that environment.
434
434
 
435
435
  For additional isolated environments, you can use [preview branches](/deployment/preview-branches), which allow you to create separate environments for each branch of your code.
436
436
 
@@ -5,6 +5,8 @@ description: "Build and run durable AI agents and workflows in TypeScript. Long-
5
5
  mode: "center"
6
6
  ---
7
7
 
8
+ import AgentSetupPrompt from "/snippets/agent-setup-prompt.mdx";
9
+
8
10
  <CardGroup cols={2}>
9
11
  <Card title="Quick start" icon="rocket" href="/quick-start" color="#A8FF53">
10
12
  Go from zero to your first task in 3 minutes.
@@ -20,6 +22,10 @@ mode: "center"
20
22
  </Card>
21
23
  </CardGroup>
22
24
 
25
+ ## Set up with AI
26
+
27
+ <AgentSetupPrompt />
28
+
23
29
  ## What is Trigger.dev?
24
30
 
25
31
  Trigger.dev is the open source platform for building and running durable AI agents and workflows in TypeScript. Run them for hours, configure automatic retries, control concurrency, and manage queues. There's no execution timeout, and no queue or worker infrastructure for you to build.