@trigger.dev/sdk 4.5.15 → 4.6.0

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 (159) hide show
  1. package/dist/commonjs/imports/ai-runtime-cjs.cjs.map +1 -1
  2. package/dist/commonjs/imports/ai-runtime.js +2 -0
  3. package/dist/commonjs/v3/ai-shared.d.ts +15 -0
  4. package/dist/commonjs/v3/ai-shared.js +35 -1
  5. package/dist/commonjs/v3/ai-shared.js.map +1 -1
  6. package/dist/commonjs/v3/ai.d.ts +311 -25
  7. package/dist/commonjs/v3/ai.js +1633 -380
  8. package/dist/commonjs/v3/ai.js.map +1 -1
  9. package/dist/commonjs/v3/auth.d.ts +10 -4
  10. package/dist/commonjs/v3/auth.js.map +1 -1
  11. package/dist/commonjs/v3/chat-client.d.ts +11 -2
  12. package/dist/commonjs/v3/chat-client.js +227 -111
  13. package/dist/commonjs/v3/chat-client.js.map +1 -1
  14. package/dist/commonjs/v3/chat-react.d.ts +88 -0
  15. package/dist/commonjs/v3/chat-react.js +130 -1
  16. package/dist/commonjs/v3/chat-react.js.map +1 -1
  17. package/dist/commonjs/v3/chat-server.d.ts +42 -6
  18. package/dist/commonjs/v3/chat-server.js +52 -7
  19. package/dist/commonjs/v3/chat-server.js.map +1 -1
  20. package/dist/commonjs/v3/chat.d.ts +92 -10
  21. package/dist/commonjs/v3/chat.js +328 -73
  22. package/dist/commonjs/v3/chat.js.map +1 -1
  23. package/dist/commonjs/v3/chatSnapshotIo.d.ts +2 -0
  24. package/dist/commonjs/v3/chatSnapshotIo.js +173 -0
  25. package/dist/commonjs/v3/chatSnapshotIo.js.map +1 -0
  26. package/dist/commonjs/v3/chatVersionSkew.d.ts +12 -0
  27. package/dist/commonjs/v3/chatVersionSkew.js +30 -0
  28. package/dist/commonjs/v3/chatVersionSkew.js.map +1 -0
  29. package/dist/commonjs/v3/externalDeploymentId.d.ts +23 -0
  30. package/dist/commonjs/v3/externalDeploymentId.js +43 -0
  31. package/dist/commonjs/v3/externalDeploymentId.js.map +1 -0
  32. package/dist/commonjs/v3/retry.d.ts +4 -0
  33. package/dist/commonjs/v3/retry.js +22 -13
  34. package/dist/commonjs/v3/retry.js.map +1 -1
  35. package/dist/commonjs/v3/sessions.d.ts +15 -2
  36. package/dist/commonjs/v3/sessions.js +12 -1
  37. package/dist/commonjs/v3/sessions.js.map +1 -1
  38. package/dist/commonjs/v3/shared.js +30 -36
  39. package/dist/commonjs/v3/shared.js.map +1 -1
  40. package/dist/commonjs/v3/test/index.d.ts +1 -0
  41. package/dist/commonjs/v3/test/index.js +3 -1
  42. package/dist/commonjs/v3/test/index.js.map +1 -1
  43. package/dist/commonjs/v3/test/mock-chat-agent.d.ts +47 -4
  44. package/dist/commonjs/v3/test/mock-chat-agent.js +116 -10
  45. package/dist/commonjs/v3/test/mock-chat-agent.js.map +1 -1
  46. package/dist/commonjs/v3/test/test-session-handle.js +6 -0
  47. package/dist/commonjs/v3/test/test-session-handle.js.map +1 -1
  48. package/dist/commonjs/v3/test/transcript-storage-tests.d.ts +40 -0
  49. package/dist/commonjs/v3/test/transcript-storage-tests.js +258 -0
  50. package/dist/commonjs/v3/test/transcript-storage-tests.js.map +1 -0
  51. package/dist/commonjs/v3/transcriptStorage.d.ts +261 -0
  52. package/dist/commonjs/v3/transcriptStorage.js +374 -0
  53. package/dist/commonjs/v3/transcriptStorage.js.map +1 -0
  54. package/dist/commonjs/version.js +1 -1
  55. package/dist/esm/imports/ai-runtime.d.ts +2 -2
  56. package/dist/esm/imports/ai-runtime.js +2 -2
  57. package/dist/esm/imports/ai-runtime.js.map +1 -1
  58. package/dist/esm/v3/ai-shared.d.ts +15 -0
  59. package/dist/esm/v3/ai-shared.js +33 -0
  60. package/dist/esm/v3/ai-shared.js.map +1 -1
  61. package/dist/esm/v3/ai.d.ts +311 -25
  62. package/dist/esm/v3/ai.js +1625 -377
  63. package/dist/esm/v3/ai.js.map +1 -1
  64. package/dist/esm/v3/auth.d.ts +10 -4
  65. package/dist/esm/v3/auth.js.map +1 -1
  66. package/dist/esm/v3/chat-client.d.ts +11 -2
  67. package/dist/esm/v3/chat-client.js +228 -112
  68. package/dist/esm/v3/chat-client.js.map +1 -1
  69. package/dist/esm/v3/chat-react.d.ts +88 -0
  70. package/dist/esm/v3/chat-react.js +127 -1
  71. package/dist/esm/v3/chat-react.js.map +1 -1
  72. package/dist/esm/v3/chat-server.d.ts +42 -6
  73. package/dist/esm/v3/chat-server.js +53 -8
  74. package/dist/esm/v3/chat-server.js.map +1 -1
  75. package/dist/esm/v3/chat.d.ts +92 -10
  76. package/dist/esm/v3/chat.js +329 -74
  77. package/dist/esm/v3/chat.js.map +1 -1
  78. package/dist/esm/v3/chatSnapshotIo.d.ts +2 -0
  79. package/dist/esm/v3/chatSnapshotIo.js +165 -0
  80. package/dist/esm/v3/chatSnapshotIo.js.map +1 -0
  81. package/dist/esm/v3/chatVersionSkew.d.ts +12 -0
  82. package/dist/esm/v3/chatVersionSkew.js +27 -0
  83. package/dist/esm/v3/chatVersionSkew.js.map +1 -0
  84. package/dist/esm/v3/externalDeploymentId.d.ts +23 -0
  85. package/dist/esm/v3/externalDeploymentId.js +38 -0
  86. package/dist/esm/v3/externalDeploymentId.js.map +1 -0
  87. package/dist/esm/v3/retry.d.ts +4 -0
  88. package/dist/esm/v3/retry.js +14 -8
  89. package/dist/esm/v3/retry.js.map +1 -1
  90. package/dist/esm/v3/sessions.d.ts +15 -2
  91. package/dist/esm/v3/sessions.js +11 -1
  92. package/dist/esm/v3/sessions.js.map +1 -1
  93. package/dist/esm/v3/shared.js +17 -23
  94. package/dist/esm/v3/shared.js.map +1 -1
  95. package/dist/esm/v3/test/index.d.ts +1 -0
  96. package/dist/esm/v3/test/index.js +1 -0
  97. package/dist/esm/v3/test/index.js.map +1 -1
  98. package/dist/esm/v3/test/mock-chat-agent.d.ts +47 -4
  99. package/dist/esm/v3/test/mock-chat-agent.js +118 -12
  100. package/dist/esm/v3/test/mock-chat-agent.js.map +1 -1
  101. package/dist/esm/v3/test/test-session-handle.js +6 -0
  102. package/dist/esm/v3/test/test-session-handle.js.map +1 -1
  103. package/dist/esm/v3/test/transcript-storage-tests.d.ts +40 -0
  104. package/dist/esm/v3/test/transcript-storage-tests.js +255 -0
  105. package/dist/esm/v3/test/transcript-storage-tests.js.map +1 -0
  106. package/dist/esm/v3/transcriptStorage.d.ts +261 -0
  107. package/dist/esm/v3/transcriptStorage.js +360 -0
  108. package/dist/esm/v3/transcriptStorage.js.map +1 -0
  109. package/dist/esm/version.js +1 -1
  110. package/docs/ai-chat/actions.mdx +55 -23
  111. package/docs/ai-chat/anatomy.mdx +47 -27
  112. package/docs/ai-chat/backend.mdx +125 -48
  113. package/docs/ai-chat/background-injection.mdx +122 -19
  114. package/docs/ai-chat/client-protocol.mdx +5 -4
  115. package/docs/ai-chat/compaction.mdx +13 -7
  116. package/docs/ai-chat/custom-agents.mdx +23 -0
  117. package/docs/ai-chat/fast-starts.mdx +27 -20
  118. package/docs/ai-chat/frontend.mdx +19 -14
  119. package/docs/ai-chat/how-it-works.mdx +1 -1
  120. package/docs/ai-chat/lifecycle-hooks.mdx +6 -2
  121. package/docs/ai-chat/migrating-from-a-route-handler.mdx +16 -14
  122. package/docs/ai-chat/migrating-from-hydrate-messages.mdx +299 -0
  123. package/docs/ai-chat/patterns/database-persistence.mdx +24 -9
  124. package/docs/ai-chat/patterns/native-compaction.mdx +310 -0
  125. package/docs/ai-chat/patterns/persistence-and-replay.mdx +34 -23
  126. package/docs/ai-chat/patterns/skills.mdx +7 -10
  127. package/docs/ai-chat/patterns/version-upgrades.mdx +79 -6
  128. package/docs/ai-chat/pending-messages.mdx +3 -3
  129. package/docs/ai-chat/prompt-caching.mdx +23 -25
  130. package/docs/ai-chat/quick-start.mdx +11 -11
  131. package/docs/ai-chat/reference.mdx +69 -10
  132. package/docs/ai-chat/sessions.mdx +6 -1
  133. package/docs/ai-chat/side-channels.mdx +1 -1
  134. package/docs/ai-chat/testing.mdx +2 -1
  135. package/docs/ai-chat/tools.mdx +18 -13
  136. package/docs/ai-chat/transcript-storage.mdx +247 -0
  137. package/docs/ai-chat/upgrade-guide.mdx +2 -2
  138. package/docs/apikeys.mdx +27 -45
  139. package/docs/config/extensions/custom.mdx +14 -1
  140. package/docs/config/extensions/syncEnvVars.mdx +6 -0
  141. package/docs/deploy-environment-variables.mdx +23 -2
  142. package/docs/deployment/overview.mdx +4 -8
  143. package/docs/deployment/preview-branches.mdx +4 -4
  144. package/docs/deployment/version-skew-protection.mdx +62 -0
  145. package/docs/github-integration.mdx +1 -1
  146. package/docs/introduction.mdx +58 -152
  147. package/docs/manual-setup.mdx +7 -7
  148. package/docs/mcp-tools.mdx +9 -0
  149. package/docs/quick-start.mdx +3 -3
  150. package/docs/realtime/auth.mdx +1 -1
  151. package/docs/reports.mdx +157 -0
  152. package/docs/self-hosting/security.mdx +17 -0
  153. package/docs/tasks/scheduled.mdx +24 -0
  154. package/docs/triggering.mdx +1 -1
  155. package/docs/troubleshooting-zod.mdx +158 -0
  156. package/docs/troubleshooting.mdx +1 -1
  157. package/package.json +4 -4
  158. package/skills/trigger-authoring-chat-agent/SKILL.md +41 -29
  159. package/skills/trigger-chat-agent-advanced/SKILL.md +54 -19
@@ -1,181 +1,69 @@
1
1
  ---
2
- title: "Welcome to the Trigger.dev docs"
2
+ title: "Trigger.dev docs"
3
3
  sidebarTitle: "Introduction"
4
- description: "Find all the resources and guides you need to get started"
4
+ description: "Build and run durable AI agents and workflows in TypeScript. Long-running tasks with retries, queues, observability, and elastic scaling. Open source and self-hostable."
5
5
  mode: "center"
6
6
  ---
7
7
 
8
8
  <CardGroup cols={2}>
9
- <Card title="Quick start" img="/images/intro-quickstart.jpg" href="/quick-start">
10
- Get started with Trigger.dev and run your first task in 3 minutes
9
+ <Card title="Quick start" icon="rocket" href="/quick-start" color="#A8FF53">
10
+ Go from zero to your first task in 3 minutes.
11
11
  </Card>
12
- <Card
13
- title="Guides, frameworks & examples"
14
- img="/images/intro-examples.jpg"
15
- href="/guides/introduction#example-tasks"
16
- >
17
- Browse our wide range of guides, frameworks and example projects
12
+ <Card title="Build AI agents" icon="robot" href="/guides/ai-agents/overview" color="#a855f7">
13
+ Agent patterns, worked examples, and the tools to run them in production.
18
14
  </Card>
19
- <Card title="Building with AI" img="/images/intro-ai.jpg" href="/building-with-ai">
20
- Learn how to build Trigger.dev projects using AI coding assistants
15
+ <Card title="AI coding assistants" icon="wand-magic-sparkles" href="/building-with-ai" color="#3B82F6">
16
+ Let Claude Code, Cursor and Windsurf write correct Trigger.dev code with the MCP server, Skills and rules.
21
17
  </Card>
22
- <Card title="Video walkthrough" img="/images/intro-video.jpg" href="/video-walkthrough">
23
- Watch an end-to-end demo of Trigger.dev in 10 minutes
18
+ <Card title="Guides & examples" icon="book-open" href="/guides/introduction" color="#f6cd46">
19
+ Frameworks like Next.js, worked example projects, and step-by-step how-to guides.
24
20
  </Card>
25
21
  </CardGroup>
26
22
 
27
23
  ## What is Trigger.dev?
28
24
 
29
- Trigger.dev is an open source background jobs framework that lets you write reliable workflows in plain async code. Run long-running AI tasks, handle complex background jobs, and build AI agents with built-in queuing, automatic retries, and real-time monitoring. No timeouts, elastic scaling, and zero infrastructure management required.
25
+ 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.
26
+
27
+ You write agents and tasks in your existing codebase using our CLI and SDK, and get durable execution, queues, waits, full tracing, and elastic scaling without building any of it yourself.
30
28
 
31
- We provide everything you need to build and manage background tasks: a CLI and SDK for writing tasks in your existing codebase, support for both [regular](/tasks/overview) and [scheduled](/tasks/scheduled) tasks, full observability through our dashboard, and a [Realtime API](/realtime) with [React hooks](/realtime/react-hooks#realtime-hooks) for showing task status in your frontend. You can use [Trigger.dev Cloud](https://cloud.trigger.dev) or [self-host](/self-hosting/overview) on your own infrastructure.
29
+ Trigger.dev's core is Apache-2.0 licensed, a genuine OSI license. [Self-host it](/self-hosting/overview) on your own infrastructure, or let [Trigger.dev Cloud](https://cloud.trigger.dev) run it for you.
32
30
 
33
- ## Learn the concepts
31
+ ## Core concepts
34
32
 
35
33
  <CardGroup cols={2}>
36
- <Card title="Writing tasks" icon="wand-magic-sparkles" href="/tasks/overview" color="#3B82F6">
37
- Tasks are the core of Trigger.dev. Learn what they are and how to write them.
34
+ <Card title="Writing tasks" icon="pen-to-square" href="/tasks/overview" color="#A8FF53">
35
+ The durable functions at the core of Trigger.dev. Write them in your existing codebase, with retries and no timeouts.
38
36
  </Card>
39
- <Card title="Triggering tasks" icon="bullseye-pointer" href="/triggering" color="#fbbf24">
40
- Learn how to trigger tasks from your codebase.
37
+ <Card title="Triggering tasks" icon="bullseye-pointer" href="/triggering" color="#3b82f6">
38
+ Trigger a task from your backend, your frontend, a schedule, or another task.
41
39
  </Card>
42
- <Card title="Runs" icon="person-running" href="/runs" color="#EA189E">
43
- Runs are the instances of tasks that are executed. Learn how they work.
40
+ <Card title="Runs" icon="play" href="/runs" color="#28bf5c">
41
+ Every execution of a task is a run, with its status, retries, and logs recorded.
44
42
  </Card>
45
- <Card title="API keys" icon="key" href="/apikeys" color="#EAEA08">
46
- API keys are used to authenticate requests to the Trigger.dev API. Learn how to create and use
47
- them.
43
+ <Card title="Idempotency" icon="fingerprint" href="/idempotency" color="#F43F5E">
44
+ Use an idempotency key so a retried or duplicated trigger runs once, not twice.
48
45
  </Card>
49
46
  </CardGroup>
50
47
 
51
- ## Explore by feature
48
+ ## Build with agents
52
49
 
53
- <CardGroup>
54
- <Card title="Scheduled tasks (cron)" icon="clock" href="/tasks/scheduled" color="#EAEA08">
55
- Scheduled tasks are a type of task that is scheduled to run at a specific time.
56
- </Card>
57
- <Card title="Realtime API" icon="loader" href="/realtime" color="#22C55E">
58
- The Realtime API allows you to trigger tasks and get the status of runs.
59
- </Card>
60
- <Card title="React hooks" icon="react" href="/realtime/react-hooks" color="#3B82F6">
61
- React hooks are a way to show task status in your frontend.
62
- </Card>
63
- <Card title="Waits" icon="calendar-clock" href="/wait" color="#F59E0B">
64
- Waits are a way to wait for a task to finish before continuing.
65
- </Card>
66
- <Card
67
- title="Errors and retries"
68
- icon="message-exclamation"
69
- href="/errors-retrying"
70
- color="#F43F5E"
71
- >
72
- Learn how to handle errors and retries.
73
- </Card>
74
- <Card title="Concurrency & Queues" icon="line-height" href="/queue-concurrency" color="#D946EF">
75
- Configure what you want to happen when there is more than one run at a time.
76
- </Card>
77
- <Card
78
- title="Wait for token (human-in-the-loop)"
79
- icon="hand"
80
- href="/wait-for-token"
81
- color="#EAEA08"
82
- >
83
- Pause runs until a token is completed via an approval workflow.
84
- </Card>
85
- <Card title="Build extensions" icon="gear" href="/config/extensions/overview" color="#22C55E">
86
- Customize the build process or the resulting bundle and container image.
87
- </Card>
88
- </CardGroup>
50
+ Build durable, multi-turn agents with the [chat agent](/ai-chat/overview): one long-running task per conversation, with the tools it can call, streaming, and resumability handled for you. Add human-in-the-loop approval by pausing a run on a [waitpoint](/wait-for-token) until a person signs off, and a waiting run doesn't consume compute. Stream run status and LLM output straight to your frontend with the [Realtime API](/realtime/overview) and React hooks, and record your Vercel AI SDK calls as spans with the model, token counts, cost and latency using [AI observability](/ai/observability). Version your [prompts](/ai/prompts) in code, then edit the text or swap the model from the dashboard without redeploying.
89
51
 
90
- ## Explore by build extension
91
-
92
- | Extension | What it does | Docs |
93
- | :-------------------- | :----------------------------------------------------------- | :----------------------------------------------------- |
94
- | prismaExtension | Use Prisma with Trigger.dev | [prismaExtension docs](/config/extensions/prismaExtension) |
95
- | pythonExtension | Execute Python scripts in Trigger.dev | [pythonExtension docs](/config/extensions/pythonExtension) |
96
- | playwright | Use Playwright with Trigger.dev | [playwright extension docs](/config/extensions/playwright) |
97
- | puppeteer | Use Puppeteer with Trigger.dev | [puppeteer extension docs](/config/extensions/puppeteer) |
98
- | lightpanda | Use Lightpanda with Trigger.dev | [lightpanda extension docs](/config/extensions/lightpanda) |
99
- | ffmpeg | Use FFmpeg with Trigger.dev | [ffmpeg extension docs](/config/extensions/ffmpeg) |
100
- | aptGet | Install system packages with aptGet | [aptGet extension docs](/config/extensions/aptGet) |
101
- | additionalFiles | Copy additional files to the build directory | [additionalFiles docs](/config/extensions/additionalFiles) |
102
- | additionalPackages | Include additional packages in the build | [additionalPackages docs](/config/extensions/additionalPackages) |
103
- | syncEnvVars | Automatically sync environment variables to Trigger.dev | [syncEnvVars docs](/config/extensions/syncEnvVars) |
104
- | esbuildPlugin | Add existing or custom esbuild plugins to your build process | [esbuildPlugin docs](/config/extensions/esbuildPlugin) |
105
- | emitDecoratorMetadata | Support for the emitDecoratorMetadata TypeScript compiler | [emitDecoratorMetadata docs](/config/extensions/emitDecoratorMetadata) |
106
- | audioWaveform | Support for Audio Waveform in your project | [audioWaveform docs](/config/extensions/audioWaveform) |
107
-
108
- ## Explore by example
109
-
110
- <CardGroup cols={3}>
111
- <Card
112
- title="FFmpeg"
113
- img="/images/intro-ffmpeg.jpg"
114
- href="/guides/examples/ffmpeg-video-processing"
115
- />
116
- <Card
117
- title="Fal.ai"
118
- img="/images/intro-fal.jpg"
119
- href="/guides/examples/fal-ai-image-to-cartoon"
120
- />
121
- <Card title="Puppeteer" img="/images/intro-puppeteer.jpg" href="/guides/examples/puppeteer" />
122
- <Card
123
- title="LibreOffice"
124
- img="/images/intro-libreoffice.jpg"
125
- href="/guides/examples/libreoffice-pdf-conversion"
126
- />
127
- <Card
128
- title="OpenAI"
129
- img="/images/intro-openai.jpg"
130
- href="/guides/examples/open-ai-with-retrying"
131
- />
132
- <Card
133
- title="Browserbase"
134
- img="/images/intro-browserbase.jpg"
135
- href="/guides/examples/scrape-hacker-news"
136
- />
137
- <Card
138
- title="Sentry"
139
- img="/images/intro-sentry.jpg"
140
- href="/guides/examples/sentry-error-tracking"
141
- />
142
- <Card
143
- title="Resend"
144
- img="/images/intro-resend.jpg"
145
- href="/guides/examples/resend-email-sequence"
146
- />
147
- <Card
148
- title="Vercel AI SDK"
149
- img="/images/intro-vercel.jpg"
150
- href="/guides/examples/vercel-ai-sdk"
151
- />
152
- <Card
153
- title="Sharp"
154
- img="/images/intro-sharp.jpg"
155
- href="/guides/examples/sharp-image-processing"
156
- />
157
- <Card
158
- title="Deepgram"
159
- img="/images/intro-deepgram.jpg"
160
- href="/guides/examples/deepgram-transcribe-audio"
161
- />
162
- <Card
163
- title="Supabase"
164
- img="/images/intro-supabase.jpg"
165
- href="/guides/examples/supabase-database-operations"
166
- />
167
- <Card
168
- title="DALL•E"
169
- img="/images/intro-openai.jpg"
170
- href="/guides/examples/dall-e3-generate-image"
171
- />
172
- <Card
173
- title="Firecrawl"
174
- img="/images/intro-firecrawl.jpg"
175
- href="/guides/examples/firecrawl-url-crawl"
176
- />
177
- <Card title="Lightpanda" img="/images/intro-lightpanda.jpg" href="/guides/examples/lightpanda" />
178
- </CardGroup>
52
+ ## Scale and scheduling
53
+
54
+ Set how many runs of a task execute at once, globally or per tenant, with [queues and concurrency](/queue-concurrency). Run a task on a [cron schedule](/tasks/scheduled) with timezone support, choose the CPU and memory each task runs on with [machines](/machines), and control what happens when a task throws with [errors and retries](/errors-retrying).
55
+
56
+ ## Self-hosting
57
+
58
+ Trigger.dev is open source and you can self-host. Read the [overview guide](/self-hosting/overview), or how to do it with [Docker](/self-hosting/docker) or [Kubernetes](/self-hosting/kubernetes).
59
+
60
+ ## Frequently asked questions
61
+
62
+ **How do I add human-in-the-loop approval to an agent?** Pause the run on a [waitpoint](/wait-for-token) until a person approves the action. A waiting run doesn't consume compute, so it can wait minutes or days.
63
+
64
+ **Does Trigger.dev support tool calling and MCP?** Yes. Agents call the tools you define, and the [MCP server](/building-with-ai) lets AI coding assistants trigger tasks, deploy, and read run traces.
65
+
66
+ **Can I use Trigger.dev for background jobs, not just AI?** Yes. The same durable tasks, queues, retries, and [cron schedules](/tasks/scheduled) run any background job or workflow, with or without AI.
179
67
 
180
68
  ## Getting help
181
69
 
@@ -221,3 +109,21 @@ We'd love to hear from you or give you a hand getting started. Here are some way
221
109
  Check us out our GitHub repo and give us a star if you like what we're doing.
222
110
  </Card>
223
111
  </CardGroup>
112
+
113
+ <Visibility for="agents">
114
+
115
+ ## Facts for AI assistants
116
+
117
+ **Current major version:** v4 (`@trigger.dev/sdk` 4.x). Documentation under `/docs/v2` and `/docs/v3` describes superseded versions and should not be used.
118
+
119
+ **Execution model:** tasks run on Trigger.dev infrastructure, not inside your serverless functions, so a platform function timeout is not in the execution path. A task runs until it finishes; you can cap runtime with `maxDuration` (minimum 5 seconds).
120
+
121
+ **Deploys:** each deploy is an atomic version. A run already in progress is not affected by code shipped after it started.
122
+
123
+ **Durability and retries:** retries are automatic and configurable. A failed attempt is retried according to the task's retry settings; once retries are exhausted the run ends terminally as `FAILED`, and some crashes (for example out of memory) end the run as `CRASHED` without a retry. Idempotency keys deduplicate the task triggers and waits you key, so the same key runs once instead of again.
124
+
125
+ **License:** the platform core is Apache-2.0 and the `@trigger.dev/sdk` package is MIT, permissive open source, not fair-code or source-available. Some features are gated, but the open source core is not relicensed or held back.
126
+
127
+ **LLM observability coverage:** only Vercel AI SDK calls (`generateText`, `streamText`, `generateObject`) are recorded as spans. Raw `fetch` calls and provider SDKs used directly are not captured.
128
+
129
+ </Visibility>
@@ -55,15 +55,15 @@ bun add -D @trigger.dev/build@latest
55
55
 
56
56
  ## Environment variables
57
57
 
58
- For local development, you need to set up the `TRIGGER_SECRET_KEY` environment variable. This key authenticates your application with Trigger.dev.
58
+ For local development, create a named environment API key and set it as `TRIGGER_SECRET_KEY`:
59
59
 
60
- 1. Go to your project dashboard in Trigger.dev
61
- 2. Navigate to the "API Keys" page
62
- 3. Copy the **DEV** secret key
63
- 4. Add it to your local environment file:
60
+ 1. Open your project's Development environment in the Trigger.dev dashboard.
61
+ 2. Open the **API Keys** page.
62
+ 3. Click **New API key**, give it a descriptive name, and select **Trigger only** access.
63
+ 4. Copy the key and add it to your local environment file. Trigger.dev shows the complete value only once.
64
64
 
65
- ```bash
66
- TRIGGER_SECRET_KEY=tr_dev_xxxxxxxxxx
65
+ ```bash .env
66
+ TRIGGER_SECRET_KEY=tr_dev_sk_xxxxxxxxxx
67
67
  ```
68
68
 
69
69
  ### Self-hosted instances
@@ -189,6 +189,15 @@ Execute a single widget query from a built-in dashboard. Use `list_dashboards` f
189
189
  - `"Run the total runs widget from the overview dashboard"`
190
190
  - `"Show me the LLM cost over time from the AI dashboard"`
191
191
 
192
+ ### get_report
193
+
194
+ 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.
195
+
196
+ **Example usage:**
197
+ - `"Is my production project healthy?"`
198
+ - `"Run the health report for the last 24 hours"`
199
+ - `"Why are my runs backing up?"`
200
+
192
201
  ## Dev Server Tools
193
202
 
194
203
  ### start_dev_server
@@ -26,7 +26,7 @@ Help me add Trigger.dev to this project.
26
26
  - Install the "Hello World" example task when prompted.
27
27
  3. Run `npx trigger.dev@latest dev` to start the dev server.
28
28
  4. Once the dev server is running, test the example task from the Trigger.dev dashboard.
29
- 5. Set TRIGGER_SECRET_KEY in my .env file (or .env.local for Next.js). I can find it on the API Keys page in the 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
30
  6. Ask me what framework I'm using and show me how to trigger the task from my backend code.
31
31
 
32
32
  If I've already run init and want the MCP server, run: npx trigger.dev@latest install-mcp
@@ -70,10 +70,10 @@ Sign up at [Trigger.dev Cloud](https://cloud.trigger.dev) (or [self-host](/self-
70
70
 
71
71
  ## Triggering tasks from your app
72
72
 
73
- The test page in the dashboard is great for verifying your task works. To trigger tasks from your own code, you'll need to set the `TRIGGER_SECRET_KEY` environment variable. Grab it from the API Keys page in the dashboard and add it to your `.env` file.
73
+ The test page in the dashboard verifies that your task works. To trigger tasks from your own code, open the API Keys page for your Development environment and create a named key with **Trigger only** access. Set the key as `TRIGGER_SECRET_KEY` in your `.env` file.
74
74
 
75
75
  ```bash .env
76
- TRIGGER_SECRET_KEY=tr_dev_...
76
+ TRIGGER_SECRET_KEY=tr_dev_sk_...
77
77
  ```
78
78
 
79
79
  See [Triggering](/triggering) for the full guide, or jump straight to framework-specific setup for [Next.js](/guides/frameworks/nextjs), [Remix](/guides/frameworks/remix), or [Node.js](/guides/frameworks/nodejs).
@@ -131,7 +131,7 @@ const publicToken = await auth.createPublicToken({
131
131
  - If `expirationTime` is a number, it will be treated as a Unix timestamp in **seconds**
132
132
  - If `expirationTime` is a `Date`, it will be treated as a date
133
133
 
134
- When using non-root API keys (recommended), the expiration cannot be more than 30 days in the future.
134
+ Public Access Tokens cannot expire more than 30 days in the future.
135
135
 
136
136
  The format used for a time span is the same as the [jose package](https://github.com/panva/jose), which is a number followed by a unit. Valid units are: "sec", "secs", "second", "seconds", "s", "minute", "minutes", "min", "mins", "m", "hour", "hours", "hr", "hrs", "h", "day", "days", "d", "week", "weeks", "w", "year", "years", "yr", "yrs", and "y". It is not possible to specify months. 365.25 days is used as an alias for a year. If the string is suffixed with "ago", or prefixed with a "-", the resulting time span gets subtracted from the current unix timestamp. A "from now" suffix can also be used for readability when adding to the current unix timestamp.
137
137
 
@@ -0,0 +1,157 @@
1
+ ---
2
+ title: "Project health report"
3
+ sidebarTitle: "Health report"
4
+ description: "Get a deterministic verdict on your project's health — split into Flow, Execution, and Liveness — from the CLI, an MCP tool or prompt, or the HTTP API."
5
+ ---
6
+
7
+ **The health report answers one question — "is my project healthy, and if not, is the problem my code or the platform?" — with a deterministic verdict, not a dashboard.** The server computes the verdict from your telemetry; no LLM interprets it, so the same numbers always produce the same answer.
8
+
9
+ Every report reads a live window of your project's data and returns a headline verdict, the evidence behind it, and a single suggested next action. The only report today is `health`.
10
+
11
+ ## What the report measures
12
+
13
+ The report splits a project into three dimensions, each with its own verdict:
14
+
15
+ | Dimension | Question | What a bad verdict means |
16
+ | --- | --- | --- |
17
+ | **Flow** | Is work starting? | Runs are queuing but not being picked up — a concurrency limit, a throttle, or a trigger spike. |
18
+ | **Execution** | Are the runs that start succeeding? | Runs are failing or slowing more than your baseline — usually your code. |
19
+ | **Liveness** | Is the telemetry fresh? | The data behind the report is stale, so the verdict can't be trusted. |
20
+
21
+ Splitting Flow from Execution is the point: a project can be failing to _start_ work (Flow) while every run that does start _completes_ fine (Execution), or the reverse. The report names which one, so you know whether to look at your concurrency settings or your task code.
22
+
23
+ Each dimension carries a severity — healthy, degraded, or failing — and the report leads with the worst one as its headline. The headline finding is expanded with its supporting metrics; the others collapse to a one-line verdict.
24
+
25
+ ## Reading the report
26
+
27
+ Here is `trigger report health` for a project whose runs are backing up against the environment concurrency limit:
28
+
29
+ ```text
30
+ /report health prod · last 1h · vs 7d normal
31
+
32
+ ✕ Flow stalled — at your env concurrency limit for the last 40 min
33
+
34
+ concurrency 100/100 ▄▅▆▇████ 40 min at limit
35
+ pending 1,240 ↑ 6× ▁▂▄▅▆▇██ (normal ~120)
36
+ start latency p95 8.2s ↑ 4× ▁▂▃▄▆▇██ (normal ~2s)
37
+
38
+ why: runs are finishing at ~90/min
39
+ nothing dead-lettered
40
+
41
+ ✓ EXECUTION runs are executing normally
42
+
43
+ ✓ LIVENESS fresh — telemetry current, updated 12s ago
44
+
45
+ read: limit saturated → incoming work exceeds capacity → backlog grows
46
+
47
+ → Raise the env concurrency limit
48
+ Read concurrency docs
49
+ or do nothing — backlog drains in ~26.7 min once triggers ease
50
+ ```
51
+
52
+ The verdict reads top to bottom:
53
+
54
+ - **Headline** — the worst finding, stated as a verdict with the breach window. Here Flow is stalled because concurrency has been pinned at its limit for 40 minutes.
55
+ - **Evidence** — the metrics behind the headline, each with a sparkline over the window, its movement against your baseline (`↑ 6×` means six times normal), and an annotation (`40 min at limit`) or baseline (`normal ~120`).
56
+ - **`why:`** — the facts that support the verdict, including what the problem _isn't_ (runs are still finishing, nothing is dead-lettered — so it's not your code).
57
+ - **Sibling findings** — Execution and Liveness, each a one-line verdict.
58
+ - **`read:`** — the causal chain in one line.
59
+ - **Next steps** — the primary action first (`→`), then any alternatives.
60
+
61
+ ### The verdict vocabulary
62
+
63
+ Every surface carries meaning in glyphs, never color alone, so the report is legible in a monochrome terminal or a plain-text MCP host:
64
+
65
+ | Glyph | Meaning |
66
+ | --- | --- |
67
+ | `✓` | Healthy |
68
+ | `⚠` | Degraded |
69
+ | `✕` | Failing |
70
+ | `○` | Genuinely unknown — neither good nor bad |
71
+ | `⚑` | The data behind the report can't be trusted |
72
+ | `↑` `↓` `→` | Above, below, or flat against the baseline |
73
+
74
+ <Note>
75
+ The markdown surface swaps the status glyphs for traffic-light emoji (`🟢` `🟡` `🔴` `⚪` `🚩`) — the one color cue a chat host that renders neither ANSI nor HTML can show. The glyph and the emoji mean the same thing.
76
+ </Note>
77
+
78
+ ## Surfaces
79
+
80
+ The same report renders four ways.
81
+
82
+ ### CLI: `trigger report`
83
+
84
+ Print an interpreted report for an environment. The command defaults to the `health` report and the `prod` environment — a manual production check.
85
+
86
+ ```bash
87
+ npx trigger.dev@latest report health --env prod --period 24h
88
+ ```
89
+
90
+ | Flag | Default | Description |
91
+ | --- | --- | --- |
92
+ | `[key]` | `health` | The report to render (positional argument). |
93
+ | `-e, --env` | `prod` | The environment: `dev`, `staging`, `prod`, or `preview`. |
94
+ | `-b, --branch` | — | The preview branch. Required when `--env preview`. |
95
+ | `--period` | `1h` | The live window: `30m`, `1h`, `24h`, `7d`. Minutes to weeks, max 90 days. |
96
+ | `-p, --project-ref` | from config | The project ref (`proj_…`). Required if there is no `trigger.config.ts`. |
97
+ | `-c, --config` | — | Path to the config file. |
98
+
99
+ The command prints only the report — no banner — so it pipes cleanly. Output is ANSI-colored in a real terminal and plain markdown when piped:
100
+
101
+ ```bash
102
+ trigger report health > health.md # markdown, no escape codes
103
+ ```
104
+
105
+ Color follows the [supports-color](https://github.com/chalk/supports-color) convention: `NO_COLOR` (any value) or `FORCE_COLOR=0` disables color outright; `FORCE_COLOR` set to anything else force-enables it. Both win over TTY detection — which matters for agents spawned on a PTY, where `isTTY` is `true` but escape codes would be garbled.
106
+
107
+ ### MCP tool: `get_report`
108
+
109
+ Fetch the report from an AI coding tool through the [Trigger.dev MCP server](/mcp-introduction). The tool returns plain markdown by default, or ANSI when `color` is set (for hosts that display escapes in tool output). It is read-only.
110
+
111
+ | Parameter | Default | Description |
112
+ | --- | --- | --- |
113
+ | `key` | — | The report to render. Currently only `health`. |
114
+ | `environment` | `dev` | The environment. The MCP server is dev-centric, so an unspecified environment reports on `dev` — pass `environment` explicitly to report on production. |
115
+ | `period` | `1h` | Time window shorthand, e.g. `1h`, `24h`, `7d`. |
116
+ | `color` | `false` | Return ANSI-colored text instead of markdown. |
117
+ | `projectRef` | auto-detected | The project ref. Detected from `trigger.config.ts` if present. |
118
+ | `branch` | — | The preview branch, for preview or branchable dev environments. |
119
+
120
+ ### MCP prompt: `/report`
121
+
122
+ The MCP server also registers a `report` prompt, which hosts that support MCP prompts surface as a slash command (Claude Code renders it as `/mcp__trigger__report`). Running `/report health` calls `get_report` for you and shows the result verbatim in a fenced code block, preserving the monospace alignment and sparklines.
123
+
124
+ ### HTTP API: `GET /api/v1/reports/:key`
125
+
126
+ The endpoint behind every surface. It accepts a `period` and a `format`, and authenticates with a token scoped to read the report's query tables (`read:query`).
127
+
128
+ | Query param | Default | Description |
129
+ | --- | --- | --- |
130
+ | `period` | `1h` | The live window, same grammar as the CLI. |
131
+ | `format` | `markdown` | `markdown`, `ansi`, or `json`. |
132
+
133
+ `format=markdown` and `format=ansi` return the rendered text. `format=json` returns the `ReportViewModel` — the semantic payload behind the render, where verdicts are codes rather than prose, for building your own surface on top of the report.
134
+
135
+ ```bash
136
+ curl "https://api.trigger.dev/api/v1/reports/health?period=24h&format=json" \
137
+ -H "Authorization: Bearer $TRIGGER_ACCESS_TOKEN"
138
+ ```
139
+
140
+ An unknown report key returns `404` with the list of available keys.
141
+
142
+ ## Next steps
143
+
144
+ <CardGroup cols={2}>
145
+ <Card title="MCP server" icon="plug" href="/mcp-introduction">
146
+ Connect your AI coding tool to Trigger.dev.
147
+ </Card>
148
+ <Card title="MCP tools" icon="wrench" href="/mcp-tools">
149
+ Every tool the MCP server exposes, including `get_report`.
150
+ </Card>
151
+ <Card title="Concurrency & queues" icon="layer-group" href="/queue-concurrency">
152
+ Configure the concurrency limits the Flow verdict checks against.
153
+ </Card>
154
+ <Card title="Query your data" icon="magnifying-glass" href="/observability/query">
155
+ Run TRQL queries against the same telemetry the report reads.
156
+ </Card>
157
+ </CardGroup>
@@ -6,10 +6,27 @@ sidebarTitle: "Security"
6
6
 
7
7
  We take the security of Trigger.dev seriously, for both Cloud and self-hosted deployments. This page covers how to report a vulnerability, what to expect, and how to stay informed about security releases.
8
8
 
9
+ <Note>
10
+ Unlike Trigger.dev Cloud, the self-hosted setup is optimized for single-tenant use, with code and
11
+ users you trust. It is not designed to run untrusted code or untrusted payloads.
12
+ </Note>
13
+
9
14
  <Warning>
10
15
  Do not report security vulnerabilities through public GitHub issues, pull requests, or Discord. Use one of the private channels below.
11
16
  </Warning>
12
17
 
18
+ ## What is in scope
19
+
20
+ A self-hosted deployment is a single trust domain: as above, it is built for code and users you trust. Role separation inside an organization is therefore not a security boundary there. Role-based access control comes from a plugin that is not part of the open-source distribution, and without it the permission layer falls back to a permissive ability for session users and personal access tokens. That is deliberate.
21
+
22
+ **Out of scope for self-hosted:** a member of an organization performing a privileged action inside that same organization, such as renaming or deleting the organization or managing other members. Control who you invite, or use Cloud, if you need that separation.
23
+
24
+ **In scope from any deployment:** reaching data or actions belonging to an organization the caller is not a member of, or bypassing authentication. Organization is a hard boundary on Trigger.dev Cloud, and Cloud runs this same code, so report these even though your own install is single-tenant.
25
+
26
+ Tell us which deployment you tested against. The same report can be out of scope for self-hosting and in scope for Cloud.
27
+
28
+ The [security policy](https://github.com/triggerdotdev/trigger.dev/blob/main/SECURITY.md) is canonical.
29
+
13
30
  ## Reporting a vulnerability
14
31
 
15
32
  <Steps>
@@ -184,6 +184,30 @@ const createdSchedule = await schedules.create({
184
184
  is the assigned time the run will actually start.
185
185
  </Note>
186
186
 
187
+ ### Free-plan minimum window
188
+
189
+ Schedules created while an organization is on a free plan run no more than once per hour and use a minimum 60-minute window.
190
+
191
+ - The minimum applies to the **cron cadence**: creating or deploying a schedule whose cron fires more often than once an hour is rejected with an actionable error. Change the cron expression or upgrade before saving.
192
+ - Omitted, zero (`"0m"` / `"0%"`), or smaller windows are treated as the 60-minute minimum. A larger configured window still wins, subject to the usual cap at the next cron occurrence.
193
+ - The policy applies to **all environment types**, including Development.
194
+ - It is captured when the schedule is created. Existing schedules — and schedules created while paid, even after a later downgrade — are **grandfathered** and keep running unchanged.
195
+ - Upgrading does not immediately rewrite existing schedules. A free-created restriction is cleared the next time the schedule is saved (imperative/dashboard) or redeployed (declarative) while the organization is paying.
196
+ - No runs are ever skipped or coalesced: unsupported high-frequency schedules are rejected at create/update time rather than silently thinned out.
197
+ - Self-hosted deployments, and any case where the billing plan can't be determined, are unrestricted.
198
+
199
+ When a schedule is subject to this policy, the API returns an `appliedSchedulePolicy` object alongside the configured `window`:
200
+
201
+ ```json
202
+ {
203
+ "window": "0m",
204
+ "appliedSchedulePolicy": {
205
+ "minimumWindowSeconds": 3600,
206
+ "reason": "free_schedule"
207
+ }
208
+ }
209
+ ```
210
+
187
211
  ## Supported cron syntax
188
212
 
189
213
  ```
@@ -27,7 +27,7 @@ Trigger tasks **from inside a another task**:
27
27
 
28
28
  ## Triggering from your backend
29
29
 
30
- When you trigger a task from your backend code, you need to set the `TRIGGER_SECRET_KEY` environment variable. If you're [using a preview branch](/deployment/preview-branches), you also need to set the `TRIGGER_PREVIEW_BRANCH` environment variable. You can find the value on the API keys page in the Trigger.dev dashboard. [More info on API keys](/apikeys).
30
+ When you trigger a task from your backend code, create a named API key with **Trigger only** access in the environment you want to target and set it as `TRIGGER_SECRET_KEY`. If you're [using a preview branch](/deployment/preview-branches), also set `TRIGGER_PREVIEW_BRANCH`. [More info on API keys](/apikeys).
31
31
 
32
32
  If a single process needs to trigger across multiple projects, environments, or preview branches, use [`new TriggerClient({...})`](/management/multiple-clients) for each target instead of relying on the global env vars.
33
33