Changes from v2 to v3
The main difference is that things in v3 are far simpler. That’s because in v3 your code is deployed to our servers (unless you self-host) which are long-running.- No timeouts.
- No
io.runTask()
(and nocacheKeys
). - Just use official SDKs, not integrations.
task
s are the new primitive, notjob
s.
OpenAI example comparison
This is a (very contrived) example that does a long OpenAI API call (>10s), stores the result in a database, waits for 5 mins, and then returns the result.v2
First, the old v2 code, which uses the OpenAI integration. Comments inline:v2 OpenAI task
v3
In v3 we eliminate a lot of code mainly because we don’t need tricks to try avoid timeouts. Here’s the equivalent v3 code:v3 OpenAI task
Triggering tasks comparison
v2
In v2 there were different trigger types and triggering each type was slightly different.v2 triggering
v3
We’ve unified triggering in v3. You usetrigger()
or batchTrigger()
which you can do on any type of task. Including scheduled, webhooks, etc if you want.
v3 triggering
Upgrading your project
- Make sure to upgrade all of your trigger.dev packages to v3 first.
- Follow the v3 quick start to get started with v3. Our new CLI will take care of the rest.
Using v2 together with v3
You can use v2 and v3 in the same codebase. This can be useful where you already have v2 jobs or where we don’t support features you need (yet).We do not support calling v3 tasks from v2 jobs or vice versa.