Trigger.dev

repository·main·Indexed 12 days ago

https://github.com/triggerdotdev/trigger.dev

An open-source platform for building and deploying durable, long-running AI agents and workflows in TypeScript. It provides infrastructure for timeouts, retries, queues, and observability, including a self-hosting stack via Helm for v4 deployments.

Tokens
557.1K
Snippets
1.4K
Records
2K
Agent score
93%

What's inside Trigger.dev

  1. Overview of the Redis worker

    main

    The Redis worker is a specialized worker designed to pull tasks from a Redis queue. It is part of the redis-worker package and provides a mechanism for processing background jobs with the following capabilities:

    • Configurable Concurrency: Control how many tasks are processed simultaneously.
    • Configurable Pull Speed: Adjust how frequently the worker polls the queue.
    • Job Payloads: Support for passing data alongside tasks.
    • Schema Validation: Uses a schema to ensure that only predefined, valid jobs are added to the queue.
    • Scheduled Jobs: Supports the ability to schedule jobs for future execution dates.
  2. Overview of Trigger.dev use cases

    main

    Trigger.dev is designed for workflows that exceed the capabilities of traditional automation platforms. It is specifically optimized for:

    • Long-running operations: Workflows that take minutes or hours to complete.
    • Unpredictable API latencies: Handling external services that may be slow or inconsistent.
    • Multi-hour processing: Tasks that require extended execution times without being killed by timeouts.
    • Complex orchestration: Managing intricate patterns of dependencies and logic between tasks.

    Key platform features that support these use cases include no timeout limits, automatic retries, and real-time progress tracking.

  3. Overview of Trigger.dev features

    main

    Trigger.dev is an open-source platform for building durable AI workflows and agents in TypeScript. Key capabilities include:

    • Long-running tasks: Execute resource-heavy tasks without timeouts.
    • Durability & Retries: Automatic retries for uncaught errors and checkpointing for task resilience.
    • Human-in-the-loop: Use waitpoints to pause tasks for human approval or feedback.
    • Realtime & Streaming: Subscribe to runs or stream LLM responses to your frontend using React hooks.
    • Runtime Freedom: Customize tasks with system packages (e.g., Python, FFmpeg, browsers) via build extensions.
    • Scheduling: Create durable cron schedules for recurring tasks.
    • Observability: Full tracing, logging, and real-time alerts for every job run.
    • Concurrency Control: Manage task execution using queues and concurrency rules.
  4. What is Trigger.dev?

    main

    Trigger.dev is an open source background jobs framework designed for writing reliable workflows in plain async code. It is optimized for long-running AI tasks and complex background jobs, providing built-in queuing, automatic retries, and real-time monitoring without requiring infrastructure management.

    Key Capabilities:

    • Task Management: Write tasks directly in your existing codebase using a CLI and SDK.
    • Task Types: Supports both regular tasks and scheduled (cron) tasks.
    • Observability: Full visibility into job runs via a dashboard.
    • Realtime Integration: A Realtime API with React hooks to display task status in your frontend.
    • Deployment Options: Use Trigger.dev Cloud or self-host on your own infrastructure.
  5. Overview of writing tasks in Trigger.dev

    main
    Tasks are the core building blocks of Trigger.dev. They are long-running processes that are triggered by events. To build effective tasks, you can leverage several built-in capabilities including logging, error handling with retries, waiting for external events, and managing concurrency. Tasks can also be configured with specific hardware requirements (Machines), versioning, and idempotency protections to ensure reliability in distributed environments.
  6. Overview of the Trigger.dev CLI

    main

    The Trigger.dev CLI is a tool designed for Trigger.dev v3 projects and later. It enables developers to create, run locally, and deploy background tasks.

    Important Compatibility Note: This CLI is specifically for v3 projects. If you are working with older projects, you must use the @trigger.dev/cli package instead.

  7. Use Realtime and Frontend features in React/Next.js

    main

    The trigger-realtime-and-frontend skill provides tools for building frontend interfaces that interact with Trigger.dev runs. This is used for showing live progress, status badges, token streams, or trigger buttons in React, Next.js, or Remix applications.

    Key Capabilities:

    • Realtime Subscriptions: Subscribe to run updates using runs.subscribeToRun or the @trigger.dev/react-hooks hook useRealtimeRun.
    • Stream Consumption: Consume AI/text streams in React using useRealtimeStream.
    • Frontend Triggering: Trigger tasks directly from the browser using useTaskTrigger or useRealtimeTaskTrigger.
    • Scoped Credentials: Mint scoped frontend credentials using auth.createPublicToken or auth.createTriggerPublicToken.

    Important Note: This is for the consumer side (the frontend). It is NOT for writing the backend tasks themselves (which uses streams.define or metadata.set).

  8. Explore Trigger.dev use cases

    main

    Trigger.dev can be used to build and orchestrate various long-running, complex workflows without worrying about execution timeouts. Key use cases include:

    • Data processing & ETL workflows: Build complex data pipelines that process large datasets.
    • Media processing workflows: Batch process videos, images, audio, and documents.
    • AI media generation workflows: Generate images, videos, audio, documents, and other media using AI models.
    • Marketing workflows: Build drip campaigns, create marketing content, and orchestrate multi-channel campaigns.
  9. Identify the core Trigger.dev public packages

    main

    Trigger.dev is distributed via several key public packages that you will use to build and deploy workflows:

    • @trigger.dev/sdk: The main SDK package used to define tasks and interact with the platform.
    • trigger.dev (CLI): The command-line interface used for development and deployment. Refer to the Deployment docs for usage.
    • @trigger.dev/core: Shared logic used across the SDK and other packages.
    • @trigger.dev/build: Defines types and provides prebuilt build extensions. See build extensions docs for details.
    • @trigger.dev/react-hooks: Provides React hooks for realtime updates and triggering tasks from the frontend.
    • @trigger.dev/redis-worker: A custom background job/worker system powered by Redis, used for offloading work.
  10. Real-time capabilities: Run updates and Streaming

    main

    Trigger.dev provides two primary categories of real-time backend capabilities:

    • Run updates: Subscribe to changes in run status, metadata, and tags. See Run updates.
    • Streaming: Read continuous data streams such as AI model outputs, file chunks, or other data emitted during task execution. See Streaming.

    Note: To emit these streams from your own tasks, refer to the Streaming data from tasks guide.

  11. Compare Trigger.dev Cloud vs. Self-hosted

    main

    While the self-hosted version is functionally similar to Trigger.dev Cloud, there are key differences in features and support:

    FeatureCloudSelf-hosted
    Warm starts
    Auto-scaling
    Checkpoints
    Dedicated support
    Community support
    ARM support

    Note on v3 Compatibility: Trigger.dev 4.5.0 is the last version that officially supports running v3 (SDK v3) tasks. Versions 4.5.1 and later will reject v3 triggers, batch triggers, and deploys. If you have v3 tasks, you should stay on 4.5.0 or migrate to v4.