Overview
Tasks represent code execution requests in Executor. The Tasks API provides functions to create, retrieve, and manage task lifecycle and metadata.Main Functions
createTask
Creates a new task for code execution. This is a workspace action that requires authentication.The JavaScript/TypeScript code to execute
Task timeout in milliseconds. Defaults to
DEFAULT_TASK_TIMEOUT_MS if not specified. Maximum value is MAX_TASK_TIMEOUT_MS.The runtime environment to execute the task in. If not specified, a default runtime will be used.
Optional metadata to attach to the task for tracking and context
The account ID associated with this task execution
If true, waits for the task to complete before returning
Unique task identifier
The code that will be executed
Runtime environment identifier
Current task status:
"queued", "running", "completed", "failed", "timed_out", or "denied"Task timeout in milliseconds
Workspace this task belongs to
Account that created the task
Client identifier for tracking
Unix timestamp of task creation
Unix timestamp of last update
Unix timestamp when task execution started
Unix timestamp when task completed
Error message if task failed
Process exit code for completed tasks
Internal Functions
createTask (Internal)
Internal mutation for creating tasks with full control over workspace and account associations.Unique task identifier
Code to execute
Runtime identifier
Timeout in milliseconds
Task metadata
Workspace ID
Account ID
Client identifier
getTask
Retrieves a task by its ID.The task identifier
null if not found.
listTasks
Lists all tasks in a workspace, ordered by creation time (most recent first).Workspace to list tasks from
getTaskInWorkspace
Retrieves a task only if it belongs to the specified workspace.Task identifier
Workspace ID to verify against
null if not found or workspace mismatch.
listQueuedTaskIds
Retrieves task IDs for tasks in the"queued" status, ordered by creation time.
Maximum number of task IDs to return (default: 20)
markTaskRunning
Transitions a task from"queued" to "running" status.
Task to mark as running
null if the task wasn’t in queued status.
markTaskFinished
Marks a task as completed with a final status.Task identifier
Final status:
"completed", "failed", "timed_out", or "denied"Process exit code
Error message if task failed
setTaskStorageDefaultInstance
Sets the default storage instance for a task at a given scope level.Task identifier
Storage scope:
"scratch", "account", "workspace", or "organization"Storage instance identifier
If true (default), also sets this as the current instance
trackTaskStorageAccess
Records storage instance access by a task.Task identifier
Storage instance that was accessed
Storage scope type
Type of access:
"opened", "provided", or "accessed"Related Types
TaskStatus:"queued"|"running"|"completed"|"failed"|"timed_out"|"denied"CompletedTaskStatus:"completed"|"failed"|"timed_out"|"denied"StorageScopeType:"scratch"|"account"|"workspace"|"organization"StorageAccessType:"opened"|"provided"|"accessed"