Workflow Human Template
The Workflow Human template demonstrates how BindAI can introduce a human interaction point into a workflow. TheHumanTaskNode creates a HumanTask, associates it with the current workflow instance and node, stores it on the workflow context, and sets the context to a waiting state.
The node provides the workflow-engine side of human interaction. The actual user interface, task handling, completion, and resumption mechanism are outside the HumanTaskNode implementation.
Purpose
This template demonstrates how to:- Create a human task
- Associate the task with a workflow instance
- Associate the task with a workflow node
- Store the task in the workflow context
- Put the workflow context into a waiting state
- Configure an optional assignee
- Configure an optional form identifier
Workflow Structure
A workflow can place a Human Task node between normal workflow nodes.HumanTaskNode executes, it creates a task, stores it in the workflow context, and sets:
HumanTaskNode
The implementation is provided byHumanTaskNode.
A node can be created with:
The
assignee and form values are configuration stored on the node. The node itself does not perform assignment, notification, or form rendering.
Task Creation
When the node executes, it creates a newHumanTask.
The task receives a generated UUID:
- A generated task ID
- The current workflow instance ID
- The ID of the Human Task node
- The task creation timestamp
Workflow Instance Association
The task records the ID of the current workflow instance:Node Association
The task also records the ID of the node that created it:HumanTaskNode in the workflow definition.
Task Storage
After creating the task, the node stores it on the workflow context:Waiting State
After storing the task, the node sets:HumanTaskNode itself does not implement the external interaction or completion mechanism.
External Task Handling
HumanTaskNode does not provide a user interface.
A surrounding application can use the created task in systems such as:
- A web application
- An administrative dashboard
- An approval interface
- A mobile application
- An internal task-management system
Assignee
A Human Task node can optionally specify an assignee:- Resolve the assignee
- Notify the assignee
- Assign the task through an external system
- Enforce permissions
Form
A Human Task node can also specify an optional form identifier:Task IDs
Each task receives a newly generated UUID:Task Lifecycle
The lifecycle implemented directly byHumanTaskNode is intentionally small:
- Approving a task
- Rejecting a task
- Completing a task
- Collecting form responses
- Notifying an assignee
- Persisting the task in an external task system
- Resuming the workflow after human interaction
Workflow Waiting
The node’s waiting behavior should be distinguished from task completion. The node only sets:Serialization
HumanTaskNode extends the normal workflow-node serialization.
Its to_dict() method adds:
Loading Configuration
The node restores its optional configuration throughload_dict():
None.
Conceptually:
Human + AI Workflow
A common pattern is to place human review after an AI operation:HumanTaskNode does not perform the review. It creates the runtime task and places the workflow context into the waiting state.
Human Tasks vs Conditions
These nodes serve different purposes.
They can be combined in a larger workflow.
For example:
HumanTaskNode.
Human Tasks vs Loops
Human Tasks and loops also have different purposes.
A loop controls workflow routing based on its predicate.
A Human Task introduces a waiting point for external interaction.
Example
A document-review workflow can be structured conceptually as:Human Task Configuration Example
A node with both optional configuration values can be created as:execute() method and stored in:
assignee and form values remain node configuration; they are not automatically copied into the HumanTask object by this implementation.
Important Implementation Boundaries
The currentHumanTaskNode does:
- Create a
HumanTask - Generate a unique task ID
- Associate the task with
context.instance.id - Associate the task with the node ID
- Set the task creation timestamp
- Store the task in
context.task - Set
context.waiting = True - Serialize
assigneeandform - Restore
assigneeandformfrom serialized data
HumanTaskNode does not:
- Approve a task
- Reject a task
- Complete a task
- Collect form responses
- Notify an assignee
- Render a form
- Persist tasks to an external task-management system
- Automatically resume the workflow
Best Practices
- Give each Human Task node a meaningful
node_id. - Use
assigneewhen surrounding application infrastructure needs an intended task owner. - Use
formwhen an external interface needs to identify the appropriate form. - Keep human-facing UI outside the workflow node.
- Use
context.taskto access the task created by the node during execution. - Provide application infrastructure for handling waiting workflows.
- Define an explicit continuation strategy for human interactions.
- Keep human interaction concerns separate from workflow-definition logic.
- Avoid assuming that
assigneeorformautomatically trigger external behavior.
Summary
The Workflow Human template demonstrates how BindAI introduces a human interaction point into workflow execution.HumanTaskNode creates a uniquely identified HumanTask, associates it with the current workflow instance and node, stores it in context.task, and sets:
assignee and form configuration and can serialize and restore those values.
The node itself does not implement approval, rejection, form handling, notifications, task persistence, or workflow resumption.
Those responsibilities belong to the surrounding workflow and application infrastructure.