@trigger.dev/sdk 4.7.3 → 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 (85) hide show
  1. package/dist/commonjs/v3/concurrencyLimits.d.ts +37 -7
  2. package/dist/commonjs/v3/concurrencyLimits.js +38 -70
  3. package/dist/commonjs/v3/concurrencyLimits.js.map +1 -1
  4. package/dist/commonjs/v3/index.d.ts +1 -1
  5. package/dist/commonjs/v3/index.js.map +1 -1
  6. package/dist/commonjs/v3/runs.d.ts +22 -1
  7. package/dist/commonjs/v3/runs.js +6 -3
  8. package/dist/commonjs/v3/runs.js.map +1 -1
  9. package/dist/commonjs/version.js +1 -1
  10. package/dist/esm/v3/concurrencyLimits.d.ts +37 -7
  11. package/dist/esm/v3/concurrencyLimits.js +38 -70
  12. package/dist/esm/v3/concurrencyLimits.js.map +1 -1
  13. package/dist/esm/v3/index.d.ts +1 -1
  14. package/dist/esm/v3/index.js.map +1 -1
  15. package/dist/esm/v3/runs.d.ts +22 -1
  16. package/dist/esm/v3/runs.js +6 -3
  17. package/dist/esm/v3/runs.js.map +1 -1
  18. package/dist/esm/version.js +1 -1
  19. package/docs/ai-chat/patterns/sub-agents.mdx +33 -0
  20. package/docs/apikeys.mdx +3 -3
  21. package/docs/billing-limits.mdx +1 -1
  22. package/docs/cli-env-commands.mdx +5 -4
  23. package/docs/cli-init-commands.mdx +27 -1
  24. package/docs/cli-login-commands.mdx +20 -0
  25. package/docs/cli-projects-commands.mdx +13 -1
  26. package/docs/cli-runs-commands.mdx +3 -2
  27. package/docs/cli-update-commands.mdx +9 -3
  28. package/docs/cli-whoami-commands.mdx +12 -0
  29. package/docs/concurrency.mdx +32 -0
  30. package/docs/config/extensions/audioWaveform.mdx +4 -1
  31. package/docs/config/extensions/overview.mdx +2 -0
  32. package/docs/config/extensions/prismaExtension.mdx +2 -3
  33. package/docs/config/extensions/puppeteer.mdx +3 -5
  34. package/docs/config/extensions/pythonExtension.mdx +9 -1
  35. package/docs/config/extensions/syncEnvVars.mdx +6 -0
  36. package/docs/deploy-environment-variables.mdx +1 -1
  37. package/docs/deployment/atomic-deployment.mdx +2 -0
  38. package/docs/deployment/dev-branches.mdx +5 -5
  39. package/docs/deployment/overview.mdx +8 -7
  40. package/docs/deployment/preview-branches.mdx +6 -3
  41. package/docs/errors-retrying.mdx +4 -4
  42. package/docs/how-it-works.mdx +5 -5
  43. package/docs/introduction.mdx +6 -0
  44. package/docs/limits.mdx +26 -8
  45. package/docs/logging.mdx +1 -1
  46. package/docs/machines.mdx +1 -1
  47. package/docs/mcp-introduction.mdx +8 -7
  48. package/docs/mcp-tools.mdx +15 -1
  49. package/docs/migrating-from-v3.mdx +1 -1
  50. package/docs/observability/dashboards.mdx +2 -0
  51. package/docs/observability/query.mdx +6 -2
  52. package/docs/private-networking/aws-console-setup.mdx +1 -1
  53. package/docs/private-networking/overview.mdx +1 -1
  54. package/docs/quick-start.mdx +3 -40
  55. package/docs/realtime/auth.mdx +1 -1
  56. package/docs/realtime/backend/input-streams.mdx +159 -0
  57. package/docs/realtime/backend/streams.mdx +25 -10
  58. package/docs/realtime/how-it-works.mdx +1 -1
  59. package/docs/realtime/react-hooks/overview.mdx +1 -1
  60. package/docs/realtime/react-hooks/streams.mdx +2 -2
  61. package/docs/realtime/react-hooks/subscribe.mdx +19 -3
  62. package/docs/realtime/react-hooks/triggering.mdx +2 -2
  63. package/docs/realtime/react-hooks/use-wait-token.mdx +1 -1
  64. package/docs/realtime/run-object.mdx +47 -24
  65. package/docs/replaying.mdx +26 -1
  66. package/docs/reports.mdx +4 -2
  67. package/docs/run-tests.mdx +2 -2
  68. package/docs/run-usage.mdx +3 -3
  69. package/docs/runs/heartbeats.mdx +2 -2
  70. package/docs/runs/list-best-practices.mdx +234 -0
  71. package/docs/runs/metadata.mdx +7 -10
  72. package/docs/runs.mdx +18 -8
  73. package/docs/self-hosting/env/supervisor.mdx +2 -0
  74. package/docs/self-hosting/env/webapp.mdx +5 -0
  75. package/docs/self-hosting/overview.mdx +26 -0
  76. package/docs/tags.mdx +6 -0
  77. package/docs/tasks/scheduled.mdx +11 -5
  78. package/docs/triggering.mdx +8 -0
  79. package/docs/troubleshooting-alerts.mdx +102 -3
  80. package/docs/troubleshooting.mdx +1 -1
  81. package/docs/upgrading-packages.mdx +3 -3
  82. package/docs/vercel-integration.mdx +13 -3
  83. package/docs/versioning.mdx +1 -1
  84. package/docs/wait-for-token.mdx +3 -3
  85. package/package.json +2 -2
@@ -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.
package/docs/limits.mdx CHANGED
@@ -43,7 +43,7 @@ You can request a higher rate limit from us if you're on a paid plan.
43
43
  The maximum number of runs that can be queued **per queue** (not across all queues in the environment). Each queue can hold up to its limit independently. When a queue hits its limit, new triggers to that queue are rejected.
44
44
 
45
45
  <Note>
46
- The limits below apply to [Trigger.dev Cloud](https://trigger.dev). If you self-host Trigger.dev, queue size limits are configurable via the `MAXIMUM_DEV_QUEUE_SIZE` and `MAXIMUM_DEPLOYED_QUEUE_SIZE` environment variables — see [Self-hosting environment variables](/self-hosting/env/webapp#run-engine).
46
+ The limits below apply to [Trigger.dev Cloud](https://trigger.dev). If you self-host Trigger.dev, queue size limits are configurable via the `MAXIMUM_DEV_QUEUE_SIZE` and `MAXIMUM_DEPLOYED_QUEUE_SIZE` environment variables — see [Self-hosting environment variables](/self-hosting/env/webapp).
47
47
  </Note>
48
48
 
49
49
  | Pricing tier | Development (per queue) | Staging / Production (per queue) |
@@ -60,7 +60,7 @@ On Trigger.dev Cloud, all runs have an enforced maximum TTL of 14 days. Runs wit
60
60
 
61
61
  There is no maximum on `delay`.
62
62
 
63
- If you self-host, you can configure a maximum TTL via the `RUN_ENGINE_DEFAULT_MAX_TTL` environment variable — see [Self-hosting environment variables](/self-hosting/env/webapp#run-engine).
63
+ If you self-host, you can configure a maximum TTL via the `RUN_ENGINE_DEFAULT_MAX_TTL` environment variable — see [Self-hosting environment variables](/self-hosting/env/webapp).
64
64
 
65
65
  ## Schedules
66
66
 
@@ -124,8 +124,6 @@ Payloads and outputs over 512KB are kept in object storage rather than inline. C
124
124
 
125
125
  A single batch can have a maximum of 1,000 items with SDK 4.3.1+. Prior versions are limited to 500 items.
126
126
 
127
- <SoftLimit />
128
-
129
127
  ## Batch trigger rate limits
130
128
 
131
129
  Batch triggering uses a token bucket algorithm to rate limit the number of runs you can trigger per environment. Each run in a batch consumes one token.
@@ -154,6 +152,26 @@ When you send a batch trigger, we convert it into individual runs. This limit co
154
152
  | Hobby | 10 concurrent batches |
155
153
  | Pro | 50 concurrent batches |
156
154
 
155
+ ## Webhook ingest rate limits
156
+
157
+ Each hosted webhook endpoint accepts a limited number of requests per 10 seconds. Requests over the limit get a `429` response with a `Retry-After` header, and providers that retry deliver them again after the window.
158
+
159
+ | Pricing tier | Requests per endpoint |
160
+ | :----------- | :-------------------- |
161
+ | Free | 100 every 10 sec |
162
+ | Hobby | 300 every 10 sec |
163
+ | Pro | 1,000 every 10 sec |
164
+ | Enterprise | Set per organization |
165
+
166
+ All of an environment's endpoints also share a per-environment limit, counted in tokens: a request costs one token for every 64 KiB of body, started, so a 10 KiB event costs one and a 1 MiB event costs 16. Requests over it get the same `429` with `Retry-After`.
167
+
168
+ | Pricing tier | Tokens per environment |
169
+ | :----------- | :--------------------- |
170
+ | Free | 300 every 10 sec |
171
+ | Hobby | 1,000 every 10 sec |
172
+ | Pro | 3,000 every 10 sec |
173
+ | Enterprise | Set per organization |
174
+
157
175
  ## Log retention
158
176
 
159
177
  | Pricing tier | Limit |
@@ -170,8 +188,8 @@ We limit the size of logs to prevent oversized data potentially causing issues.
170
188
 
171
189
  #### Attribute Limits
172
190
 
173
- - Span Attribute Count Limit: 256
174
- - Log Attribute Count Limit: 256
191
+ - Span Attribute Count Limit: 1024
192
+ - Log Attribute Count Limit: 1024
175
193
  - Span Attribute Value Length Limit: 131072 characters
176
194
  - Log Attribute Value Length Limit: 131072 characters
177
195
 
@@ -188,8 +206,8 @@ We limit the size of logs to prevent oversized data potentially causing issues.
188
206
 
189
207
  #### Attribute Clipping Behavior
190
208
 
191
- - Attributes exceeding the value length limit (1028 characters) are discarded.
192
- - If the total number of attributes exceeds 256, additional attributes are not included.
209
+ - Attributes exceeding the value length limit (131072 characters) are discarded.
210
+ - If the total number of attributes exceeds 1024, additional attributes are not included.
193
211
 
194
212
  #### Attribute Value Size Calculation
195
213
 
package/docs/logging.mdx CHANGED
@@ -159,7 +159,7 @@ Trigger.dev automatically collects the following metrics for deployed tasks. No
159
159
  | `nodejs.heap.total` | gauge | bytes | V8 heap total |
160
160
 
161
161
  <Note>
162
- In dev mode (`trigger dev`), only `process.*` and custom metrics are available.
162
+ In dev mode (`trigger dev`), the `process.*` and `nodejs.*` metrics above are collected, along with custom metrics.
163
163
  </Note>
164
164
 
165
165
  ### Context attributes
package/docs/machines.mdx CHANGED
@@ -11,7 +11,7 @@ import { task } from "@trigger.dev/sdk";
11
11
  export const heavyTask = task({
12
12
  id: "heavy-task",
13
13
  machine: "large-1x",
14
- run: async ({ payload, ctx }) => {
14
+ run: async (payload, { ctx }) => {
15
15
  //...
16
16
  },
17
17
  });
@@ -299,7 +299,7 @@ After adding the config, restart your client. You should see a server named **tr
299
299
 
300
300
  ## Authentication
301
301
 
302
- The `search_docs` tool works without authentication. All other tools require you to be logged in via the [Trigger.dev CLI](/cli-login-commands). The first time you use an authenticated tool, your MCP client will prompt you to log in.
302
+ The `search_docs` tool works without authentication, and so do the local-only tools `list_profiles`, `dev_server_status` and `stop_dev_server`. All other tools require you to be logged in via the [Trigger.dev CLI](/cli-login-commands). The first time you use an authenticated tool, your MCP client will prompt you to log in.
303
303
 
304
304
  <Accordion title="CLI Options">
305
305
 
@@ -310,7 +310,6 @@ The `install-mcp` command supports these options:
310
310
  - `-p, --project-ref <project ref>` — Scope the MCP server to a specific project
311
311
  - `-t, --tag <package tag>` — CLI package version to use (default: latest)
312
312
  - `--dev-only` — Restrict to the dev environment only
313
- - `--readonly` — Read-only mode. Hides write tools (`deploy`, `trigger_task`, `cancel_run`) so the AI cannot make changes to your account
314
313
  - `--yolo` — Install into all supported clients automatically
315
314
  - `--scope <scope>` — `user`, `project`, or `local`
316
315
  - `--client <clients...>` — Install into specific client(s)
@@ -341,17 +340,19 @@ Restrict to dev environment for a specific project:
341
340
  npx trigger.dev@latest install-mcp --dev-only --project-ref proj_abc123
342
341
  ```
343
342
 
344
- Read-only mode (prevents AI from deploying or triggering tasks):
343
+ To add these options to a manual config, append them to the `args` array:
345
344
 
346
- ```bash
347
- npx trigger.dev@latest install-mcp --readonly
345
+ ```json
346
+ {
347
+ "args": ["trigger.dev@latest", "mcp", "--dev-only", "--project-ref", "proj_abc123"]
348
+ }
348
349
  ```
349
350
 
350
- To add these options to a manual config, append them to the `args` array:
351
+ The `mcp` command also accepts `--readonly`, which hides the tools that write to your account (for example `deploy`, `trigger_task` and `cancel_run`) so the AI cannot make changes to it. It is only available as a manual config arg:
351
352
 
352
353
  ```json
353
354
  {
354
- "args": ["trigger.dev@latest", "mcp", "--dev-only", "--project-ref", "proj_abc123"]
355
+ "args": ["trigger.dev@latest", "mcp", "--readonly"]
355
356
  }
356
357
  ```
357
358
 
@@ -102,6 +102,20 @@ Cancel a running or queued run.
102
102
  - `"Cancel run run_abc123"`
103
103
  - `"Stop that task"`
104
104
 
105
+ ### replay_run
106
+
107
+ Replay a run as a new run of the same task, in the same environment. The new run reuses the original run's payload, metadata, tags, queue, concurrency key, and machine unless you override them. See [Replaying](/replaying) for how each option falls back.
108
+
109
+ **Parameters:**
110
+ - `runId` (required): The run to replay, starting with `run_`
111
+ - `payload`, `metadata`, `tags` (optional): Replace the original run's values
112
+ - `queue`, `concurrencyKey`, `machine`, `version`, `region`, `delay`, `ttl`, `idempotencyKey`, `maxAttempts`, `maxDuration`, `priority` (optional): Override the trigger options for the new run
113
+
114
+ **Example usage:**
115
+ - `"Replay run run_abc123"`
116
+ - `"Replay that failed run with userId set to user_456"`
117
+ - `"Replay run run_abc123 on a large-1x machine in 10 minutes"`
118
+
105
119
  ## Deployment Tools
106
120
 
107
121
  ### deploy
@@ -225,7 +239,7 @@ Check the status of the dev server and view recent output. Shows whether it is s
225
239
  - `"Are there any build errors?"`
226
240
 
227
241
  <Callout type="warning">
228
- The deploy and list_preview_branches tools are not available when the MCP server is running with the `--dev-only` flag. The `--readonly` flag hides deploy, trigger_task, and cancel_run.
242
+ The deploy and list_preview_branches tools are not available when the MCP server is running with the `--dev-only` flag. The `--readonly` flag hides deploy, trigger_task, cancel_run, and replay_run.
229
243
  </Callout>
230
244
 
231
245
  ## Agent Chat Tools
@@ -248,7 +248,7 @@ import { task } from "@trigger.dev/sdk";
248
248
 
249
249
  export const myTask = task({
250
250
  id: "my-task",
251
- onStart: ({ payload, ctx }) => {},
251
+ onStart: (payload, { ctx }) => {},
252
252
  run: async (payload, { ctx }) => {},
253
253
  });
254
254
  ```
@@ -98,5 +98,7 @@ There is a separate concurrency limits for metric widgets.
98
98
  | Limit | Details |
99
99
  | :------------------------ | :------------- |
100
100
  | Concurrent widget queries | 30 per project |
101
+ | Custom dashboards | Free 0, Hobby 1, Pro 5 per organization |
102
+ | Widgets per dashboard | Free 0, Hobby 10, Pro 20 |
101
103
 
102
104
  See [Limits](/limits) for details.
@@ -8,6 +8,7 @@ description: "Query allows you to write custom queries against your data using T
8
8
  - `runs`: contains all task run data including status, timing, costs, and task output. Run metadata (key-value set in your task) is not available on the Query page.
9
9
  - `metrics`: contains metrics data for your runs including CPU, memory, and your custom metrics
10
10
  - `llm_metrics`: contains LLM/AI metrics including token usage, costs, latency, and model performance data from GenAI spans
11
+ - `llm_models`: anonymized cross-tenant model performance aggregates (calls, cost, latency, throughput per model per minute); it has no tenant-specific data
11
12
 
12
13
  ### `metrics` table columns
13
14
 
@@ -24,6 +25,9 @@ description: "Query allows you to write custom queries against your data using T
24
25
  | `machine_name` | string | Machine preset (e.g., `small-1x`) |
25
26
  | `worker_version` | string | Worker version |
26
27
  | `environment_type` | string | `PRODUCTION`, `STAGING`, `DEVELOPMENT`, `PREVIEW` |
28
+ | `worker_id` | string | Worker ID that produced the metric |
29
+ | `environment` | string | Environment slug |
30
+ | `project` | string | Project ref, starting with `proj_` |
27
31
  | `attributes` | json | Raw JSON attributes for custom data |
28
32
 
29
33
  See [Logging, tracing & metrics](/logging#automatic-system-and-runtime-metrics) for the full list of automatically collected metrics and how to create custom metrics. You can visualize this data on [Dashboards](/observability/dashboards).
@@ -68,7 +72,7 @@ ORDER BY timeBucket
68
72
  LIMIT 1000
69
73
  ```
70
74
 
71
- Available format types: `bytes`, `percent`, `duration`, `durationSeconds`, `quantity`, `costInDollars`.
75
+ Available format types: `bytes`, `percent`, `duration`, `durationSeconds`, `quantity`, `costInDollars`, `decimalBytes`, `cost`.
72
76
 
73
77
  ## Using the Query dashboard
74
78
 
@@ -602,7 +606,7 @@ LIMIT 100
602
606
 
603
607
  We have several limits to prevent abuse and ensure performance:
604
608
 
605
- - **Concurrency limit**: We limit the number of concurrent queries per organization.
609
+ - **Concurrency limit**: We limit the number of concurrent queries per project.
606
610
  - **Row limit**: We limit the number of rows returned to 10k.
607
611
  - **Time restrictions**: We limit the time period you can query.
608
612
  - **Time/Memory limit**: We limit the memory a query can use and the time it can run for. As well as other limits like AST complexity.
@@ -250,7 +250,7 @@ By default, no one can connect to your endpoint service. You need to explicitly
250
250
 
251
251
  - **Friendly name**: a short, human-readable label for this connection.
252
252
  - **VPC Endpoint Service name**: paste the `com.amazonaws.vpce.<region>.vpce-svc-...` value from Step 4.
253
- - **Target region**: the AWS region your endpoint service lives in.
253
+ - **Target region**: the Trigger.dev region where the VPC Endpoint is created (pick one from the list, such as `us-east-1` or `eu-central-1`), normally the region your tasks run in. If it differs from the region your endpoint service lives in, enable cross-region access in Step 3.
254
254
 
255
255
  </Step>
256
256
  <Step title="Submit">
@@ -119,7 +119,7 @@ All three conditions must be true. No organization can route traffic to another
119
119
 
120
120
  ## Limits
121
121
 
122
- - **Two connections per organization.** This is a soft limit — get in touch if you need more.
122
+ - **Four connections per organization.** This is a soft limit — get in touch if you need more.
123
123
  - **All ports accepted.** Our security group allows all TCP ports from peered CIDRs. You control which ports are reachable through your NLB and target groups.
124
124
  - **Same-region or cross-region.** Connections work within the same region as your tasks or across regions (cross-region adds AWS-level cost and ~10-30ms latency).
125
125
 
@@ -8,48 +8,11 @@ import CliInitStep from "/snippets/step-cli-init.mdx";
8
8
  import CliDevStep from "/snippets/step-cli-dev.mdx";
9
9
  import CliRunTestStep from "/snippets/step-run-test.mdx";
10
10
  import CliViewRunStep from "/snippets/step-view-run.mdx";
11
+ import AgentSetupPrompt from "/snippets/agent-setup-prompt.mdx";
11
12
 
12
- ## Set up with AI
13
+ ## Copy the setup prompt
13
14
 
14
- Using an AI coding assistant? Copy this prompt and paste it into Claude Code, Cursor, Copilot, Windsurf, or any AI tool. It'll handle the setup for you.
15
-
16
- <Accordion title="Copy the setup prompt">
17
-
18
- ```text
19
- Help me add Trigger.dev to this project.
20
-
21
- ## What to do
22
-
23
- 1. I need a Trigger.dev account. If I don't have one, point me to https://cloud.trigger.dev to sign up. Wait for me to confirm.
24
- 2. Run `npx trigger.dev@latest init` in the project root.
25
- - When it asks about the MCP server, recommend I install it (best DX: gives you direct access to Trigger.dev docs, deploys, and run monitoring).
26
- - Install the "Hello World" example task when prompted.
27
- 3. Run `npx trigger.dev@latest dev` to start the dev server.
28
- 4. Once the dev server is running, test the example task from the Trigger.dev dashboard.
29
- 5. Create a named API key in my Development environment with **Trigger only** access. Set it as TRIGGER_SECRET_KEY in my .env file (or .env.local for Next.js).
30
- 6. Ask me what framework I'm using and show me how to trigger the task from my backend code.
31
-
32
- If I've already run init and want the MCP server, run: npx trigger.dev@latest install-mcp
33
-
34
- ## Critical rules
35
-
36
- - ALWAYS import from `@trigger.dev/sdk`. NEVER import from `@trigger.dev/sdk/v3`.
37
- - NEVER use `client.defineJob()` — that's the deprecated v2 API.
38
- - Use type-only imports when triggering from backend code to avoid bundling task code:
39
-
40
- import type { myTask } from "./trigger/example";
41
- import { tasks } from "@trigger.dev/sdk";
42
-
43
- const handle = await tasks.trigger<typeof myTask>("hello-world", { message: "Hello from my app!" });
44
-
45
- ## When done, point me to
46
-
47
- - Writing tasks: https://trigger.dev/docs/tasks/overview
48
- - Real-time updates: https://trigger.dev/docs/realtime/overview
49
- - AI tooling: https://trigger.dev/docs/building-with-ai
50
- ```
51
-
52
- </Accordion>
15
+ <AgentSetupPrompt />
53
16
 
54
17
  ## Manual setup
55
18
 
@@ -157,7 +157,7 @@ const { parts } = useRealtimeStream<{ url: string }>(runId, "frames", {
157
157
 
158
158
  When you [trigger tasks](/triggering) from your backend, the `handle` received includes a `publicAccessToken` field. This token can be used to authenticate real-time requests in your frontend application.
159
159
 
160
- By default, auto-generated tokens expire after 15 minutes and have a read scope for the specific run(s) that were triggered. You can customize the expiration by passing a `publicTokenOptions` object to the trigger function.
160
+ Auto-generated tokens expire after 1 hour and have a read scope for the specific run(s) that were triggered. For a different expiration or scopes, create a token yourself with [`auth.createPublicToken`](#creating-public-access-tokens).
161
161
 
162
162
  See our [triggering documentation](/triggering) for detailed examples of how to trigger tasks and get auto-generated tokens.
163
163