Upgrading from v2
How to upgrade v2 jobs to v3 tasks, and how to use them together.
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.
Convert your v2 job using an AI prompt
The prompt in the accordion below gives good results when using Anthropic Claude 3.5 Sonnet. You’ll need a relatively large token limit.
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:
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:
Triggering tasks comparison
v2
In v2 there were different trigger types and triggering each type was slightly different.
v3
We’ve unified triggering in v3. You use trigger()
or batchTrigger()
which you can do on any type of task. Including scheduled, webhooks, etc if you want.
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).
Was this page helpful?