Trigger.dev v4.5.0

AI Agents, Sessions, Prompts, dev branches, TriggerClient, and 6 SDK and runtime improvements.

The AI Agents platform is now generally available: chat.agent, Sessions, and AI Prompts are stable on latest, alongside 6 SDK and runtime improvements.

Highlights

AI Agents (chat.agent)

Run Vercel AI SDK chat completions as durable Trigger.dev tasks instead of fragile API routes. A conversation runs as one long-lived task keyed on chatId. It survives page refreshes, client disconnects, redeploys, idle timeouts, and crashes: the run resumes and the stream reconnects from the last chunk. Every turn is a span in the dashboard.


import { chat } from "@trigger.dev/sdk/ai";
import { streamText, stepCountIs } from "ai";
import { anthropic } from "@ai-sdk/anthropic";
export const myChat = chat.agent({
id: "my-chat",
run: async ({ messages, signal }) => {
return streamText({
...chat.toStreamTextOptions(), // system prompt, compaction, steering, telemetry
model: anthropic("claude-sonnet-4-5"),
messages,
abortSignal: signal,
stopWhen: stepCountIs(15),
});
},
});

AI Agents docs

Sessions

The durable primitive underneath chat.agent, usable on its own. A Session is a run-aware, bidirectional stream channel keyed on a stable externalId. Its .in / .out streams survive run boundaries: suspend, crash, idle-timeout, and redeploy. One Session spans many runs, so it fits agent inboxes and approval flows.


import { sessions } from "@trigger.dev/sdk";
// Create the session and trigger its first run (idempotent on externalId)
await sessions.start({
type: "inbox",
externalId: userId,
taskIdentifier: "inbox-agent",
});
const session = sessions.open(userId);
await session.in.send({ text: "hello" });
const stream = await session.out.read({ signal: AbortSignal.timeout(30_000) });
for await (const chunk of stream) console.log(chunk); // durable across run swaps

Sessions docs

AI Prompts

Define prompt templates as code, versioned on every deploy, and override the text or model from the dashboard without redeploying (environment-scoped). Each generation links back to its prompt version for usage, cost, and latency.


import { prompts } from "@trigger.dev/sdk";
import { z } from "zod";
export const supportPrompt = prompts.define({
id: "customer-support",
model: "gpt-4o",
variables: z.object({ customerName: z.string(), issue: z.string() }),
content: `You are a support agent for Acme.
Customer: {{customerName}}
Issue: {{issue}}`,
});
// Honors any active dashboard override, else the current deployed version
const resolved = await supportPrompt.resolve({ customerName: "Alice", issue: "Can't log in" });
// resolved.text, resolved.model, resolved.version

Prompts docs

useChat integration

useTriggerChatTransport is a Vercel AI SDK ChatTransport that runs useChat over Trigger.dev realtime with no API routes. Text, tool calls, reasoning, and data-* parts stream natively. Works with AI SDK v5, v6, and now v7.

First-turn fast path (chat.headStart)

Runs the first turn in your warm server process while the agent boots in parallel. In our tests, first-turn time-to-first-chunk dropped from ~2.8s to ~1.2s. Available via the new @trigger.dev/sdk/chat-server subpath.

Human-in-the-loop controls

Pause a tool call for human approval: mark it needsApproval: true on the backend, and resolve it from your UI with addToolApprovalResponse({ id, approved }). The run stays alive while it waits. The same controls cover client-driven stop-generation, mid-execution steering (pendingMessages), and between-turn context injection (chat.inject / chat.defer), all durable across the conversation.

Human-in-the-loop docs

Agent Skills

skills.define({ id, path }) bundles a SKILL.md folder into your deploy image. The agent gets a one-line summary up front and loads full instructions plus scoped bash / readFile tools on demand (progressive disclosure), so the model pulls in a skill when it needs one instead of you wiring every capability as a typed tool up front.

trigger skills for coding assistants

trigger skills installs version-pinned Trigger.dev skills and a bundled docs snapshot into Claude Code, Cursor, GitHub Copilot, and Codex. Your assistant's Trigger.dev knowledge stays current with your installed SDK version. trigger init now offers to set up the MCP server and skills during project initialization.

Skills docs

Model library

A new Models page in the dashboard: a catalog of models grouped by provider showing context window, capabilities, and input/output pricing per 1M tokens. A "Your models" tab shows per-model usage, cost, and cache-hit sparklines from your traffic.

Dev branches

Run multiple local trigger dev sessions in parallel (separate git worktrees or coding agents) without runs colliding. Each is isolated with its own dashboard via trigger dev --branch <name>.

Dev branches docs

TriggerClient

An instantiable client that lets one process trigger and read across projects, environments, and preview branches, each with its own auth and baseURL, with no shared global state.


import { TriggerClient } from "@trigger.dev/sdk";
const prod = new TriggerClient({ accessToken: process.env.TRIGGER_PROD_KEY });
const preview = new TriggerClient({
accessToken: process.env.TRIGGER_PREVIEW_KEY,
previewBranch: "signup-flow",
});
await prod.tasks.trigger("send-email", { to: "[email protected]" });
await preview.runs.list({ status: ["COMPLETED"] });

Improvements

  • AI SDK 7 support (v5 and v6 still supported), with OpenTelemetry telemetry auto-wired.
  • Trigger payloads at or above 128KB upload to object storage automatically, using the same auth and baseURL as the trigger call.
  • Runs can now be filtered by region via the runs API, and each run exposes its executing region. Also available in MCP list_runs.
  • dev and deploy now fail with a clear error on duplicate task IDs instead of silently overwriting.
  • envvars.upload gains an isSecret flag to import redacted secret variables.
  • TASK_MIDDLEWARE_ERROR now retries under the task's retry policy (behavior change: middleware errors that previously failed a run on the first attempt now retry).

How to upgrade

Update the trigger.dev/* packages to v4.5.0 using your package manager:


npx trigger.dev@latest update # npm
pnpm dlx trigger.dev@latest update # pnpm
yarn dlx trigger.dev@latest update # yarn
bunx trigger.dev@latest update # bun

Self-hosted users: update your Docker image to ghcr.io/triggerdotdev/trigger.dev:v4.5.0.

Ready to start building?

Build and deploy your first task in 3 minutes.

Get started now