Documentation Index

Fetch the complete documentation index at: /docs/llms.txt

Use this file to discover all available pages before exploring further.

Skip to main content
Context (ctx) is a way to get information about a run.
The context object does not change whilst your code is executing. This means values like ctx.run.durationMs will be fixed at the moment the run() function is called.
import { task } from "@trigger.dev/sdk";

export const parentTask = task({
  id: "parent-task",
  run: async (payload: { message: string }, { ctx }) => {
    if (ctx.environment.type === "DEVELOPMENT") {
      return;
    }
  },
});

Context properties

task
object
attempt
object
run
object
queue
object
environment
object
organization
object
project
object
batch
object
Optional information about the batch, if applicable.
machine
object
Optional information about the machine preset used for execution.
Assistant
Responses are generated using AI and may contain mistakes.
Morty Proxy This is a proxified and sanitized view of the page, visit original site.