@trigger.dev/sdk 4.7.3 → 4.7.5
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.
- package/dist/commonjs/v3/ai.d.ts +26 -0
- package/dist/commonjs/v3/ai.js +7 -5
- package/dist/commonjs/v3/ai.js.map +1 -1
- package/dist/commonjs/v3/concurrencyLimits.d.ts +37 -7
- package/dist/commonjs/v3/concurrencyLimits.js +38 -70
- package/dist/commonjs/v3/concurrencyLimits.js.map +1 -1
- package/dist/commonjs/v3/index.d.ts +1 -1
- package/dist/commonjs/v3/index.js.map +1 -1
- package/dist/commonjs/v3/query.d.ts +434 -1
- package/dist/commonjs/v3/query.js +115 -0
- package/dist/commonjs/v3/query.js.map +1 -1
- package/dist/commonjs/v3/runs.d.ts +22 -1
- package/dist/commonjs/v3/runs.js +6 -3
- package/dist/commonjs/v3/runs.js.map +1 -1
- package/dist/commonjs/version.js +1 -1
- package/dist/esm/v3/ai.d.ts +26 -0
- package/dist/esm/v3/ai.js +7 -5
- package/dist/esm/v3/ai.js.map +1 -1
- package/dist/esm/v3/concurrencyLimits.d.ts +37 -7
- package/dist/esm/v3/concurrencyLimits.js +38 -70
- package/dist/esm/v3/concurrencyLimits.js.map +1 -1
- package/dist/esm/v3/index.d.ts +1 -1
- package/dist/esm/v3/index.js.map +1 -1
- package/dist/esm/v3/query.d.ts +434 -1
- package/dist/esm/v3/query.js +115 -0
- package/dist/esm/v3/query.js.map +1 -1
- package/dist/esm/v3/runs.d.ts +22 -1
- package/dist/esm/v3/runs.js +6 -3
- package/dist/esm/v3/runs.js.map +1 -1
- package/dist/esm/version.js +1 -1
- package/docs/ai-chat/actions.mdx +6 -1
- package/docs/ai-chat/backend.mdx +47 -0
- package/docs/ai-chat/patterns/redacting-telemetry.mdx +117 -0
- package/docs/ai-chat/patterns/sub-agents.mdx +33 -0
- package/docs/ai-chat/pending-messages.mdx +2 -0
- package/docs/ai-chat/reference.mdx +53 -2
- package/docs/ai-chat/transcript-storage.mdx +1 -1
- package/docs/apikeys.mdx +9 -7
- package/docs/billing-limits.mdx +1 -1
- package/docs/cli-env-commands.mdx +5 -4
- package/docs/cli-init-commands.mdx +27 -1
- package/docs/cli-login-commands.mdx +20 -0
- package/docs/cli-projects-commands.mdx +13 -1
- package/docs/cli-runs-commands.mdx +3 -2
- package/docs/cli-tasks-commands.mdx +95 -0
- package/docs/cli-update-commands.mdx +9 -3
- package/docs/cli-whoami-commands.mdx +12 -0
- package/docs/concurrency.mdx +32 -0
- package/docs/config/config-file.mdx +58 -0
- package/docs/config/extensions/audioWaveform.mdx +4 -1
- package/docs/config/extensions/overview.mdx +2 -0
- package/docs/config/extensions/prismaExtension.mdx +6 -7
- package/docs/config/extensions/puppeteer.mdx +3 -5
- package/docs/config/extensions/pythonExtension.mdx +9 -1
- package/docs/config/extensions/syncEnvVars.mdx +6 -0
- package/docs/deploy-environment-variables.mdx +5 -1
- package/docs/deployment/atomic-deployment.mdx +5 -3
- package/docs/deployment/dev-branches.mdx +5 -5
- package/docs/deployment/overview.mdx +9 -8
- package/docs/deployment/preview-branches.mdx +7 -4
- package/docs/errors-retrying.mdx +4 -4
- package/docs/github-actions.mdx +3 -3
- package/docs/how-it-works.mdx +5 -5
- package/docs/introduction.mdx +6 -0
- package/docs/limits.mdx +32 -8
- package/docs/logging.mdx +1 -1
- package/docs/machines.mdx +1 -1
- package/docs/manual-setup.mdx +1 -1
- package/docs/mcp-introduction.mdx +8 -7
- package/docs/mcp-tools.mdx +113 -3
- package/docs/migrating-from-v3.mdx +1 -1
- package/docs/observability/dashboards.mdx +64 -0
- package/docs/observability/query.mdx +6 -2
- package/docs/private-networking/aws-console-setup.mdx +1 -1
- package/docs/private-networking/overview.mdx +1 -1
- package/docs/quick-start.mdx +3 -40
- package/docs/realtime/auth.mdx +1 -1
- package/docs/realtime/backend/input-streams.mdx +159 -0
- package/docs/realtime/backend/streams.mdx +25 -10
- package/docs/realtime/how-it-works.mdx +1 -1
- package/docs/realtime/react-hooks/overview.mdx +1 -1
- package/docs/realtime/react-hooks/streams.mdx +2 -2
- package/docs/realtime/react-hooks/subscribe.mdx +19 -3
- package/docs/realtime/react-hooks/triggering.mdx +2 -2
- package/docs/realtime/react-hooks/use-wait-token.mdx +1 -1
- package/docs/realtime/run-object.mdx +47 -24
- package/docs/replaying.mdx +26 -1
- package/docs/reports.mdx +4 -2
- package/docs/run-tests.mdx +2 -2
- package/docs/run-usage.mdx +3 -3
- package/docs/runs/heartbeats.mdx +2 -2
- package/docs/runs/list-best-practices.mdx +234 -0
- package/docs/runs/max-duration.mdx +4 -0
- package/docs/runs/metadata.mdx +7 -10
- package/docs/runs.mdx +18 -8
- package/docs/self-hosting/env/supervisor.mdx +3 -0
- package/docs/self-hosting/env/webapp.mdx +5 -0
- package/docs/self-hosting/overview.mdx +26 -0
- package/docs/tags.mdx +6 -0
- package/docs/tasks/scheduled.mdx +11 -5
- package/docs/triggering.mdx +8 -0
- package/docs/troubleshooting-alerts.mdx +102 -3
- package/docs/troubleshooting.mdx +1 -1
- package/docs/upgrading-packages.mdx +3 -3
- package/docs/vercel-integration.mdx +13 -3
- package/docs/versioning.mdx +1 -1
- package/docs/wait-for-token.mdx +3 -3
- package/docs/webhooks/channels.mdx +158 -0
- package/docs/webhooks/connect.mdx +84 -0
- package/docs/webhooks/deliveries.mdx +103 -0
- package/docs/webhooks/filters.mdx +144 -0
- package/docs/webhooks/human-in-the-loop.mdx +162 -0
- package/docs/webhooks/linear.mdx +190 -0
- package/docs/webhooks/overview.mdx +119 -0
- package/docs/webhooks/session-routing.mdx +145 -0
- package/docs/webhooks/slack.mdx +397 -0
- package/docs/webhooks/sources.mdx +221 -0
- package/docs/webhooks/waiters.mdx +194 -0
- package/package.json +3 -2
package/docs/github-actions.mdx
CHANGED
|
@@ -47,7 +47,7 @@ jobs:
|
|
|
47
47
|
env:
|
|
48
48
|
TRIGGER_ACCESS_TOKEN: ${{ secrets.TRIGGER_ACCESS_TOKEN }}
|
|
49
49
|
run: |
|
|
50
|
-
npx trigger.dev@latest deploy --external-id ${{ github.sha }}
|
|
50
|
+
npx trigger.dev@latest deploy --env prod --external-id ${{ github.sha }}
|
|
51
51
|
```
|
|
52
52
|
|
|
53
53
|
```yaml .github/workflows/release-trigger-staging.yml
|
|
@@ -184,7 +184,7 @@ Tip: add the `trigger.dev` CLI to your `devDependencies` and the deploy command
|
|
|
184
184
|
```json
|
|
185
185
|
{
|
|
186
186
|
"scripts": {
|
|
187
|
-
"deploy:trigger-prod": "trigger deploy",
|
|
187
|
+
"deploy:trigger-prod": "trigger deploy --env prod",
|
|
188
188
|
"deploy:trigger": "trigger deploy --env staging"
|
|
189
189
|
},
|
|
190
190
|
"devDependencies": {
|
|
@@ -254,7 +254,7 @@ jobs:
|
|
|
254
254
|
TRIGGER_ACCESS_TOKEN: ${{ secrets.TRIGGER_ACCESS_TOKEN }}
|
|
255
255
|
TRIGGER_API_URL: ${{ secrets.TRIGGER_API_URL }}
|
|
256
256
|
run: |
|
|
257
|
-
npx trigger.dev@latest deploy
|
|
257
|
+
npx trigger.dev@latest deploy --env prod
|
|
258
258
|
```
|
|
259
259
|
|
|
260
260
|
</CodeGroup>
|
package/docs/how-it-works.mdx
CHANGED
|
@@ -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
|
|
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
|
|
282
|
-
await sendUserEmail.
|
|
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
|
-
-
|
|
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
|
|
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
|
|
package/docs/introduction.mdx
CHANGED
|
@@ -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
|
@@ -12,6 +12,12 @@ You can view your current limits, quotas, and rate limit usage in real-time by v
|
|
|
12
12
|
[Billing limits and alerts](/billing-limits).
|
|
13
13
|
</Note>
|
|
14
14
|
|
|
15
|
+
## Run duration
|
|
16
|
+
|
|
17
|
+
Runs have no maximum duration. You set a default `maxDuration` for your project and can override it per task or per run, or set it to `timeout.None` to let a run execute indefinitely.
|
|
18
|
+
|
|
19
|
+
Trigger is built for long running AI agents and workflows and we have seen Trigger.dev users with runs lasting more than six months.
|
|
20
|
+
|
|
15
21
|
## Concurrency limits
|
|
16
22
|
|
|
17
23
|
Concurrency is allocated **per environment**, not as a single figure for the whole organization. Each plan sets a separate default for production, staging, preview and development:
|
|
@@ -43,7 +49,7 @@ You can request a higher rate limit from us if you're on a paid plan.
|
|
|
43
49
|
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
50
|
|
|
45
51
|
<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
|
|
52
|
+
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
53
|
</Note>
|
|
48
54
|
|
|
49
55
|
| Pricing tier | Development (per queue) | Staging / Production (per queue) |
|
|
@@ -60,7 +66,7 @@ On Trigger.dev Cloud, all runs have an enforced maximum TTL of 14 days. Runs wit
|
|
|
60
66
|
|
|
61
67
|
There is no maximum on `delay`.
|
|
62
68
|
|
|
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
|
|
69
|
+
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
70
|
|
|
65
71
|
## Schedules
|
|
66
72
|
|
|
@@ -124,8 +130,6 @@ Payloads and outputs over 512KB are kept in object storage rather than inline. C
|
|
|
124
130
|
|
|
125
131
|
A single batch can have a maximum of 1,000 items with SDK 4.3.1+. Prior versions are limited to 500 items.
|
|
126
132
|
|
|
127
|
-
<SoftLimit />
|
|
128
|
-
|
|
129
133
|
## Batch trigger rate limits
|
|
130
134
|
|
|
131
135
|
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 +158,26 @@ When you send a batch trigger, we convert it into individual runs. This limit co
|
|
|
154
158
|
| Hobby | 10 concurrent batches |
|
|
155
159
|
| Pro | 50 concurrent batches |
|
|
156
160
|
|
|
161
|
+
## Webhook ingest rate limits
|
|
162
|
+
|
|
163
|
+
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.
|
|
164
|
+
|
|
165
|
+
| Pricing tier | Requests per endpoint |
|
|
166
|
+
| :----------- | :-------------------- |
|
|
167
|
+
| Free | 100 every 10 sec |
|
|
168
|
+
| Hobby | 300 every 10 sec |
|
|
169
|
+
| Pro | 1,000 every 10 sec |
|
|
170
|
+
| Enterprise | Set per organization |
|
|
171
|
+
|
|
172
|
+
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`.
|
|
173
|
+
|
|
174
|
+
| Pricing tier | Tokens per environment |
|
|
175
|
+
| :----------- | :--------------------- |
|
|
176
|
+
| Free | 300 every 10 sec |
|
|
177
|
+
| Hobby | 1,000 every 10 sec |
|
|
178
|
+
| Pro | 3,000 every 10 sec |
|
|
179
|
+
| Enterprise | Set per organization |
|
|
180
|
+
|
|
157
181
|
## Log retention
|
|
158
182
|
|
|
159
183
|
| Pricing tier | Limit |
|
|
@@ -170,8 +194,8 @@ We limit the size of logs to prevent oversized data potentially causing issues.
|
|
|
170
194
|
|
|
171
195
|
#### Attribute Limits
|
|
172
196
|
|
|
173
|
-
- Span Attribute Count Limit:
|
|
174
|
-
- Log Attribute Count Limit:
|
|
197
|
+
- Span Attribute Count Limit: 1024
|
|
198
|
+
- Log Attribute Count Limit: 1024
|
|
175
199
|
- Span Attribute Value Length Limit: 131072 characters
|
|
176
200
|
- Log Attribute Value Length Limit: 131072 characters
|
|
177
201
|
|
|
@@ -188,8 +212,8 @@ We limit the size of logs to prevent oversized data potentially causing issues.
|
|
|
188
212
|
|
|
189
213
|
#### Attribute Clipping Behavior
|
|
190
214
|
|
|
191
|
-
- Attributes exceeding the value length limit (
|
|
192
|
-
- If the total number of attributes exceeds
|
|
215
|
+
- Attributes exceeding the value length limit (131072 characters) are discarded.
|
|
216
|
+
- If the total number of attributes exceeds 1024, additional attributes are not included.
|
|
193
217
|
|
|
194
218
|
#### Attribute Value Size Calculation
|
|
195
219
|
|
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`),
|
|
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
package/docs/manual-setup.mdx
CHANGED
|
@@ -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
|
|
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
|
-
|
|
343
|
+
To add these options to a manual config, append them to the `args` array:
|
|
345
344
|
|
|
346
|
-
```
|
|
347
|
-
|
|
345
|
+
```json
|
|
346
|
+
{
|
|
347
|
+
"args": ["trigger.dev@latest", "mcp", "--dev-only", "--project-ref", "proj_abc123"]
|
|
348
|
+
}
|
|
348
349
|
```
|
|
349
350
|
|
|
350
|
-
|
|
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", "--
|
|
355
|
+
"args": ["trigger.dev@latest", "mcp", "--readonly"]
|
|
355
356
|
}
|
|
356
357
|
```
|
|
357
358
|
|
package/docs/mcp-tools.mdx
CHANGED
|
@@ -4,6 +4,8 @@ sidebarTitle: "Tools"
|
|
|
4
4
|
description: "Learn about how to use the tools available in the Trigger.dev MCP Server"
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
+
import WebhooksBetaNote from "/snippets/webhooks-beta-note.mdx";
|
|
8
|
+
|
|
7
9
|
## Documentation and Search Tools
|
|
8
10
|
|
|
9
11
|
### search_docs
|
|
@@ -102,6 +104,20 @@ Cancel a running or queued run.
|
|
|
102
104
|
- `"Cancel run run_abc123"`
|
|
103
105
|
- `"Stop that task"`
|
|
104
106
|
|
|
107
|
+
### replay_run
|
|
108
|
+
|
|
109
|
+
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.
|
|
110
|
+
|
|
111
|
+
**Parameters:**
|
|
112
|
+
- `runId` (required): The run to replay, starting with `run_`
|
|
113
|
+
- `payload`, `metadata`, `tags` (optional): Replace the original run's values
|
|
114
|
+
- `queue`, `concurrencyKey`, `machine`, `version`, `region`, `delay`, `ttl`, `idempotencyKey`, `maxAttempts`, `maxDuration`, `priority` (optional): Override the trigger options for the new run
|
|
115
|
+
|
|
116
|
+
**Example usage:**
|
|
117
|
+
- `"Replay run run_abc123"`
|
|
118
|
+
- `"Replay that failed run with userId set to user_456"`
|
|
119
|
+
- `"Replay run run_abc123 on a large-1x machine in 10 minutes"`
|
|
120
|
+
|
|
105
121
|
## Deployment Tools
|
|
106
122
|
|
|
107
123
|
### deploy
|
|
@@ -175,7 +191,7 @@ Execute a TRQL query against your Trigger.dev data. TRQL is a SQL-style query la
|
|
|
175
191
|
|
|
176
192
|
### list_dashboards
|
|
177
193
|
|
|
178
|
-
List
|
|
194
|
+
List the built-in dashboards and your organization's custom dashboards, with their widgets.
|
|
179
195
|
|
|
180
196
|
**Example usage:**
|
|
181
197
|
- `"What dashboards are available?"`
|
|
@@ -183,12 +199,28 @@ List available built-in dashboards with their widgets. Each dashboard contains p
|
|
|
183
199
|
|
|
184
200
|
### run_dashboard_query
|
|
185
201
|
|
|
186
|
-
Execute a single widget query from a built-in dashboard. Use `list_dashboards` first to see available dashboards and widget IDs.
|
|
202
|
+
Execute a single widget query from a built-in or custom dashboard. Use `list_dashboards` first to see available dashboards and widget IDs.
|
|
187
203
|
|
|
188
204
|
**Example usage:**
|
|
189
205
|
- `"Run the total runs widget from the overview dashboard"`
|
|
190
206
|
- `"Show me the LLM cost over time from the AI dashboard"`
|
|
191
207
|
|
|
208
|
+
### create_dashboard
|
|
209
|
+
|
|
210
|
+
Create a custom dashboard, optionally with widgets. Each widget has a title, a TRQL query and a display: a table, a bar or line chart, a big number, or a section title. Queries are checked when the dashboard is saved.
|
|
211
|
+
|
|
212
|
+
**Example usage:**
|
|
213
|
+
- `"Make a dashboard for the email tasks with total runs, failures and runs per day"`
|
|
214
|
+
- `"Create a dashboard that charts p95 duration by task"`
|
|
215
|
+
|
|
216
|
+
### set_dashboard_widgets
|
|
217
|
+
|
|
218
|
+
Replace every widget on a custom dashboard, and optionally rename it.
|
|
219
|
+
|
|
220
|
+
**Example usage:**
|
|
221
|
+
- `"Add a failed runs widget to the email dashboard"`
|
|
222
|
+
- `"Change the runs per day chart to a line chart"`
|
|
223
|
+
|
|
192
224
|
### get_report
|
|
193
225
|
|
|
194
226
|
Render an interpreted [health report](/reports) — a deterministic verdict, not a raw panel — as text with sparklines. The `health` report answers whether work is flowing, whether the runs that start are healthy, and whether the telemetry is fresh, with a headline verdict and a suggested next action. Returns markdown by default, or ANSI when `color` is set. Read-only.
|
|
@@ -225,7 +257,7 @@ Check the status of the dev server and view recent output. Shows whether it is s
|
|
|
225
257
|
- `"Are there any build errors?"`
|
|
226
258
|
|
|
227
259
|
<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
|
|
260
|
+
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, replay_run, create_dashboard, and set_dashboard_widgets.
|
|
229
261
|
</Callout>
|
|
230
262
|
|
|
231
263
|
## Agent Chat Tools
|
|
@@ -317,3 +349,81 @@ Append one record to a named side channel's `in` stream. Sends control input to
|
|
|
317
349
|
<Callout type="warning">
|
|
318
350
|
`write_session_channel` is a write operation and is not available in readonly mode.
|
|
319
351
|
</Callout>
|
|
352
|
+
|
|
353
|
+
## Webhook Tools
|
|
354
|
+
|
|
355
|
+
<WebhooksBetaNote />
|
|
356
|
+
|
|
357
|
+
Set up and debug [hosted webhook endpoints](/webhooks/overview). Endpoint ids start with `wh_` and delivery ids with `whd_`; endpoint tools also accept an endpoint's declared id. The same operations are on the [Webhooks API](/management/webhooks/list-endpoints).
|
|
358
|
+
|
|
359
|
+
### list_webhook_endpoints
|
|
360
|
+
|
|
361
|
+
List the environment's webhook endpoints: each one's id, declared id, source, status, URL and whether its signing secret is set.
|
|
362
|
+
|
|
363
|
+
**Example usage:**
|
|
364
|
+
- `"Which webhook endpoints do I have in dev?"`
|
|
365
|
+
|
|
366
|
+
### get_webhook_endpoint_details
|
|
367
|
+
|
|
368
|
+
Get an endpoint's subscribers, with the filters that decide which events each accepts, and its setup prompt: the steps for registering the endpoint and its signing secret with the provider.
|
|
369
|
+
|
|
370
|
+
**Parameters:**
|
|
371
|
+
- `endpointId` (required): the endpoint's declared id (such as `payments`) or `wh_` id
|
|
372
|
+
|
|
373
|
+
**Example usage:**
|
|
374
|
+
- `"Connect my payments webhook to Stripe"`
|
|
375
|
+
|
|
376
|
+
### list_webhook_deliveries
|
|
377
|
+
|
|
378
|
+
List recent deliveries, newest first.
|
|
379
|
+
|
|
380
|
+
**Parameters:**
|
|
381
|
+
- `endpointId` (optional): only this endpoint's deliveries, by declared id or `wh_` id
|
|
382
|
+
- `status` (optional): only these statuses, such as `["failed", "filtered"]`
|
|
383
|
+
- `period` (optional, default: `7d`): how far back to look
|
|
384
|
+
- `limit` (optional, default: `20`): how many to return, up to 100
|
|
385
|
+
- `cursor` (optional): the cursor from a previous call, for the next page
|
|
386
|
+
|
|
387
|
+
**Example usage:**
|
|
388
|
+
- `"Did the Stripe checkout event arrive in the last hour?"`
|
|
389
|
+
- `"Show me failed deliveries on the github endpoint"`
|
|
390
|
+
|
|
391
|
+
### get_webhook_delivery
|
|
392
|
+
|
|
393
|
+
Get one delivery: its status and error, each subscriber's result (the run or session it started, or why its filter skipped the event), how many waiting runs it resumed, and its event and headers.
|
|
394
|
+
|
|
395
|
+
**Parameters:**
|
|
396
|
+
- `deliveryId` (required): the delivery's `whd_` id
|
|
397
|
+
|
|
398
|
+
**Example usage:**
|
|
399
|
+
- `"Why didn't this webhook trigger my order task?"`
|
|
400
|
+
|
|
401
|
+
### replay_webhook_delivery
|
|
402
|
+
|
|
403
|
+
Replay a delivery from its stored event. Without `targetId` it goes to every subscriber again, with their filters checked again. With `targetId` it goes to that subscriber even if its filter skipped the event.
|
|
404
|
+
|
|
405
|
+
**Parameters:**
|
|
406
|
+
- `deliveryId` (required): the delivery's `whd_` id
|
|
407
|
+
- `targetId` (optional): the subscriber id to replay to
|
|
408
|
+
|
|
409
|
+
**Example usage:**
|
|
410
|
+
- `"Replay that delivery to the refunds task"`
|
|
411
|
+
|
|
412
|
+
### generate_webhook_secret
|
|
413
|
+
|
|
414
|
+
Generate a new signing secret for an endpoint and return it once, for providers where you choose the secret (such as GitHub). It replaces any existing secret.
|
|
415
|
+
|
|
416
|
+
**Parameters:**
|
|
417
|
+
- `endpointId` (required): the endpoint's declared id (such as `payments`) or `wh_` id
|
|
418
|
+
|
|
419
|
+
### set_webhook_secret
|
|
420
|
+
|
|
421
|
+
Store a signing secret or public key the provider issued, such as Stripe's `whsec_` secret. It replaces any existing secret.
|
|
422
|
+
|
|
423
|
+
**Parameters:**
|
|
424
|
+
- `endpointId` (required): the endpoint's declared id (such as `payments`) or `wh_` id
|
|
425
|
+
- `secret` (required): the secret or public key
|
|
426
|
+
|
|
427
|
+
<Callout type="warning">
|
|
428
|
+
`replay_webhook_delivery`, `generate_webhook_secret` and `set_webhook_secret` are write operations and are not available in readonly mode.
|
|
429
|
+
</Callout>
|
|
@@ -45,6 +45,68 @@ You can also filter the data by:
|
|
|
45
45
|
4. For charts you write [TRQL queries](/observability/query) and choose a visualization type.
|
|
46
46
|
5. You can resize and reposition widgets on your dashboards.
|
|
47
47
|
|
|
48
|
+
## Managing dashboards with the SDK
|
|
49
|
+
|
|
50
|
+
Custom dashboards can also be created and edited from code, so you can keep them in your repository and set them up from CI or a script. `query.dashboards` covers the same operations as the dashboard UI.
|
|
51
|
+
|
|
52
|
+
```ts scripts/dashboards.ts
|
|
53
|
+
import { query } from "@trigger.dev/sdk";
|
|
54
|
+
|
|
55
|
+
const dashboard = await query.dashboards.create({
|
|
56
|
+
title: "Email tasks",
|
|
57
|
+
widgets: [
|
|
58
|
+
{ title: "Overview", display: { type: "title" } },
|
|
59
|
+
{
|
|
60
|
+
title: "Total runs",
|
|
61
|
+
query: "SELECT count() AS total FROM runs WHERE task_identifier = 'send-email'",
|
|
62
|
+
display: { type: "bignumber", column: "total", aggregation: "sum" },
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
title: "Runs per day",
|
|
66
|
+
query:
|
|
67
|
+
"SELECT timeBucket(), count() AS runs FROM runs WHERE task_identifier = 'send-email' GROUP BY timeBucket ORDER BY timeBucket",
|
|
68
|
+
display: {
|
|
69
|
+
type: "chart",
|
|
70
|
+
chartType: "bar",
|
|
71
|
+
xAxisColumn: "timebucket",
|
|
72
|
+
yAxisColumns: ["runs"],
|
|
73
|
+
groupByColumn: null,
|
|
74
|
+
stacked: false,
|
|
75
|
+
sortByColumn: null,
|
|
76
|
+
sortDirection: "asc",
|
|
77
|
+
aggregation: "sum",
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
],
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
console.log(dashboard.id); // dashboard_...
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
Widgets without a `position` are stacked full width in the order you list them. Pass `position: { x, y, w, h }` on a 12-column grid to place a widget yourself.
|
|
87
|
+
|
|
88
|
+
To keep a dashboard in sync with code, replace all of its widgets in one call. Widgets you keep, matched by `id`, stay where they are unless you pass a new `position`:
|
|
89
|
+
|
|
90
|
+
```ts scripts/dashboards.ts
|
|
91
|
+
const current = await query.dashboards.retrieve(dashboard.id);
|
|
92
|
+
|
|
93
|
+
await query.dashboards.replace(dashboard.id, {
|
|
94
|
+
widgets: [
|
|
95
|
+
{
|
|
96
|
+
id: "failures",
|
|
97
|
+
title: "Failed runs",
|
|
98
|
+
query: "SELECT count() AS failed FROM runs WHERE status = 'Failed'",
|
|
99
|
+
display: { type: "bignumber", column: "failed", aggregation: "sum" },
|
|
100
|
+
},
|
|
101
|
+
],
|
|
102
|
+
revision: current.revision,
|
|
103
|
+
});
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
`revision` is optional. When you pass the revision you last read, the write fails with a 409 if someone changed the dashboard in the meantime, instead of overwriting their change.
|
|
107
|
+
|
|
108
|
+
Every widget query is checked against the queryable tables when you save it, so a typo in a table or column name fails the request with the list of valid columns. `query.dashboards.widgets.add`, `widgets.update` and `widgets.del` change one widget at a time. Creating a dashboard or widget past your plan's limits returns a 403. See the [Query API reference](/management/query/create-dashboard) for every endpoint.
|
|
109
|
+
|
|
48
110
|
## Performance considerations
|
|
49
111
|
|
|
50
112
|
### Optimize queries for metrics
|
|
@@ -98,5 +160,7 @@ There is a separate concurrency limits for metric widgets.
|
|
|
98
160
|
| Limit | Details |
|
|
99
161
|
| :------------------------ | :------------- |
|
|
100
162
|
| Concurrent widget queries | 30 per project |
|
|
163
|
+
| Custom dashboards | Free 0, Hobby 1, Pro 5 per organization |
|
|
164
|
+
| Widgets per dashboard | Free 0, Hobby 10, Pro 20 |
|
|
101
165
|
|
|
102
166
|
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
|
|
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
|
|
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
|
-
- **
|
|
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
|
|
package/docs/quick-start.mdx
CHANGED
|
@@ -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
|
-
##
|
|
13
|
+
## Copy the setup prompt
|
|
13
14
|
|
|
14
|
-
|
|
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
|
|
package/docs/realtime/auth.mdx
CHANGED
|
@@ -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
|
-
|
|
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
|
|