Skip to content

Fetching & Recreating

Starting Tasks covers the handle you get back when you start a task. This page covers the two things you do with a task you did not just start — read it, or run it again.

import { getTask } from '@requence/task'
const task = await getTask('some-task-id')
// or: getTask({ taskId: 'some-task-id', accessToken: '...' })
task.status // 'SUCCESSFUL' | 'FAILED' | 'IDLE' | 'PENDING' | 'RUNNING'
// | 'STOPPED' | 'AWAITING_DELIVERY'
task.statusText // Human-readable status description, if any
task.taskTemplate // The task template name
task.name // Human-readable task name
task.branch // 'live' or a branch name
task.context.input // The task's input
task.context.result // The task's result (if finished)
task.context.getNodeData(alias) // Output from a specific node
task.context.getNodeError(alias) // Error from a specific node

This is a one-shot read, not a subscription. To follow a task as it runs, use Streaming Updates or Watching Tasks.

Re-run an existing task with the same template and input. Name and priority may be overridden; everything else is taken from the original.

import { recreateTask } from '@requence/task'
const task = await recreateTask({
taskId: 'some-task-id',
name: 'My Retry', // Optional — overrides the original name
priority: 3, // Optional — overrides the original priority
})
const result = await task

You get back a task handle, exactly as createTask returns one, so it streams and awaits the same way.