Workflow Basics
Encord SDK supports programmatic use of Workflows with the following:WorkflowStage, WorkflowAction, and Task. Typical use would be querying a WorkflowStage to get Tasks matching some criteria, and then executing a WorkflowAction against Tasks (for example: assigning, submitting annotation tasks, or accepting review tasks). The type of actions available depends on the stage queried.
Here is a short description of major parts of the Workflows SDK:
WorkflowStage
WorkflowStage
WorkflowStage: Move your tasks through a Workflow Project using theWorkflowStageclass.AnnotationStageReviewStageConsensusAnnotationStageConsensusReviewStageAgentStageFinalStage(Complete and Archive)
WorkflowAction
WorkflowAction
-
WorkflowAction: Applies an action to a task in a workflow stage The following actions are supported:assign: Assigns a user to one or more tasks.submit: Moves a task to the next stage.release: Releases a task from the current user.accept: Accepts a task.reject: Rejects a task.
Task
Task
Task: Exposes a simple version of the tasks available in a Project.
TaskStatus
TaskStatus
-
TaskStatus: The following statuses are available: The following statuses are available for ANNOTATE tasks:NEW: Tasks that are unassigned.ASSIGNED: Tasks that are assigned to a user.RELEASED: Tasks that were released from an assigned user.REOPENED: Tasks that were reopened.SKIPPED: Tasks that were skipped by annotators.COMPLETED: Tasks that are in the Complete stage. Used for Annotation sub-tasks in Consensus Annotation tasks.
NEW: Tasks that are unassigned.ASSIGNED: Tasks that are assigned to a user.RELEASED: Tasks that were released from an assigned user.REOPENED: Tasks that were reopened.
View all stages in a Workflow
The following code provides you with the method to view all stages in a Workflow in a Project. The code is the same for Consensus and Non-Consensus Projects.

Non-Consensus Projects
In the SDK, a class is defined for every stage type. This allows you to see what properties and actions each stage offers. The following stages are supported for non-Consensus Projects:AnnotationStageReviewStageFinalStage(Complete and Archive)
Tasks provides programmatic access to your tasks available in the UI.The following tasks are supported for non-Consensus Projects::
assign: Assigns a user to one or more tasks.submit: Moves a task to the next stage.release: Releases a task from the current user.
Display Tasks in a Stage
Display Tasks in a Stage
Display Tasks in a Stage
Use the following scripts as templates for annotation and review tasks.Assign a User to Tasks in a Stage
Assign a User to Tasks in a Stage
Assign a User to Tasks in a Stage
Use the following scripts as templates for annotation and review tasks.Submit Tasks as Another User in a Stage
Submit Tasks as Another User in a Stage
Submit Tasks as Another User in a Stage
- Annotation Tasks can only be submitted on behalf of users with the following roles: Annotator, Annotator + Reviewer, Team Manager, or Admin.
- Review Tasks can only be submitted on behalf of users with the following roles: Reviewer, Annotator + Reviewer, Team Manager, or Admin.
Retain Current User and Submit Task
Retain Current User and Submit Task
Retain Current User and Submit Task
- Annotation Tasks can only be submitted by users with the following roles: Annotator, Annotator + Reviewer, Team Manager, or Admin.
- Review Tasks can only be submitted by users with the following roles: Reviewer, Annotator + Reviewer, Team Manager, or Admin.
Get all Tasks
Get all Tasks
Get all Tasks
Filter tasks by data hash
Filter tasks by data hash
Filter tasks by data hash
You can filter tasks in any stage using data hashes.Move all tasks in a stage to the next stage
Move all tasks in a stage to the next stage
Move all tasks in a stage to the next stage
You can submit tasks as the currently assigned user or as a different user. If you do not specify the user to submit the task, you are assigned as the user submitting the task.Use model predictions as an annotator
Use model predictions as an annotator
Use model predictions as an annotator
Consensus Projects
Consensus annotation tasks can be listed, but cannot be assigned or moved into the Consensus review stage. In Consensus Projects, tasks are broken into subtasks. One subtask for each Annotator. Subtasks can be assigned or submitted. Consensus Projects support the following stages:AnnotationStageReviewStageConsensusAnnotationStageConsensusReviewStageFinalStage(Complete and Archive)
assign: Assigns a user to one or more tasks.approve: Moves a task to the next stage.release: Releases a task from the current user.reject: Rejects a task.
Get all Subtasks
Get all Subtasks
Get all Subtasks
Select your labels from a Consensus Project
Select your labels from a Consensus Project
Select your labels from a Consensus Project
The following code includesproduce_result, that is undefined. You need to create and define the custom logic that selects the labels from the label options you have available.Move Tasks
To Next Stage
Submitting a task moves it to the next stage in the Workflow.To Complete
workflow_complete() moves Workflow tasks to the Complete stage.Reopen
Use the workflow_reopen() method to reopen tasks. Reopening tasks moves tasks back to the first stage in your Workflow.Move Tasks Freely
This script shows how to move a data unit directly between workflow stages, bypassing the standard workflow progression. The script shows how to access various Workflow Stage types; you should only use the ones relevant to your project.Task Priority
You can read and assign task priorities using the SDK. Priorities in the SDK are represented by numbers ranging from 0 to 1, where 1 corresponds to100 in the Encord platform, the highest priority value.
End-to-End Example moving tasks through Projects
This example uses a basic non-Consensus Project Workflow moving a number of tasks from ANNOTATE to COMPLETE. !End-to-end Example Workflow !End-to-end Example tasks- Project ID: 01bd7084-b04a-4cd1-87f3-73e8e78925c4
- Data units: apples_01.jpg, apples_02.jpg, apples_03.jpg, apples_04.jpg, apples_05.jpg
STEP 1: View all tasks in the Project
STEP 1: View all tasks in the Project
STEP 2: Submit all tasks for review
STEP 2: Submit all tasks for review
STEP 3: Verify that the tasks are in REVIEW 1
STEP 3: Verify that the tasks are in REVIEW 1
STEP 4: Reject a task
STEP 4: Reject a task
apples-05.jpg does not have any labels, because it was not assigned to any users before we submitted the task. If we REJECT the task, according to the Workflow in the Project, the task returns to the ANNOTATE 1 stage.The following code filters the task in the REVIEW 1 stage based on the task’s data hash, and then rejects the task.apples_05.jpg was acted upon.To verify that the task is now in ANNOTATE 1, run the following:STEP 5: Approve tasks
STEP 5: Approve tasks
STEP 6: Verify tasks are COMPLETE
STEP 6: Verify tasks are COMPLETE
apples01 to apples_04 are in the COMPLETE stage.
