Templates Overview
The Templates section provides practical examples of the BindAI workflow system. These templates demonstrate common workflow execution patterns, including sequential execution, conditional branching, loops, parallel execution, human-in-the-loop tasks, retry handling, timeout protection, and scheduled execution. Each template focuses on one workflow capability while showing how that capability fits into the BindAI workflow runtime.Purpose
The workflow templates are designed to:- demonstrate workflow execution patterns
- explain how workflow nodes interact
- show how execution state is managed
- demonstrate failure and recovery behavior
- illustrate workflows that pause for human interaction
- demonstrate scheduling and execution management
- provide practical examples of workflow orchestration
Workflow Template Set
The current workflow template documentation contains the following examples:
These templates cover the main workflow-control and execution-management mechanisms documented in this section.
Basic Workflow
The workflow templates build on the same general execution model. A basic workflow follows a sequence of nodes:Conditional Execution
The condition template demonstrates branching based on workflow state. Conceptually:Loops
The loop template demonstrates intentional repetition within a workflow. Conceptually:- Loop — intentional repetition as part of workflow logic.
- Retry — repeated execution caused by a node execution failure.
Parallel Execution
The parallel template demonstrates multiple workflow branches that can execute independently. Conceptually:Human Tasks
The human template demonstrates workflows that pause while waiting for human interaction. Conceptually:- Approvals
- Reviews
- Validation
- Manual decisions
- Human confirmation
Retry
The retry template demonstrates recovery from failed node execution. When a node raises an exception and aRetryPolicy is configured, the executor can attempt the node again.
Conceptually:
max_attempts to control the number of attempts.
The configured delay_seconds and exponential_backoff values are not currently applied by the executor, so retries occur without an implemented delay/backoff mechanism.
This distinction is important when using retry configuration in the current release.
Timeout
The timeout template demonstrates protection against workflows running beyond their configured execution limit. ATimeoutPolicy defines the maximum workflow duration.
Conceptually:
Scheduling
The schedule template demonstrates time-based workflow scheduling. AWorkflowSchedule contains scheduling information including:
workflow_idnext_runinterval_secondsenabled
WorkflowScheduler provides operations for managing schedules, including:
next_run using the configured interval.
Scheduling should therefore be considered separate from workflow execution.
How the Templates Relate
The templates demonstrate different aspects of workflow behavior.Control Flow vs Execution Management
The templates can also be grouped by responsibility.
This distinction helps explain which part of the workflow system is responsible for each behavior.
Learning Path
A practical order for learning the workflow system is:Templates and Implementation
The templates document behavior provided by the BindAI workflow system. Important implementation concepts include:- workflow definitions
- workflow nodes
- execution context
- node execution
- execution state
- control-flow decisions
- human tasks
- retry policies
- timeout policies
- workflow scheduling
- workflow events where supported
Best Practices
When using the workflow templates:- Start with the basic workflow.
- Understand normal node execution before studying advanced control flow.
- Distinguish intentional loops from retries.
- Treat human tasks as waiting for external interaction.
- Use retry policies for recoverable node failures.
- Use timeout policies to limit workflow execution duration.
- Remember that timeout checks do not forcibly terminate a running node.
- Keep scheduling separate from workflow execution.
- Design recurring workflows so repeated execution is safe.
- Test workflows with both successful and failure paths.
- Use execution events and application-level observability where available when troubleshooting.
Current Implementation Notes
The current workflow implementation has several important boundaries.Retry
RetryPolicy exposes configuration for attempts, delay, and exponential backoff.
The executor currently uses the attempt limit but does not implement the configured delay or exponential backoff.
Timeout
Timeouts are checked between node executions. A running node is not forcibly terminated when the timeout is exceeded.Scheduling
WorkflowScheduler manages schedule state and determines which schedules are due.
It does not itself execute the workflow.
Human Tasks
Human-task execution can place workflow processing into a waiting state until the required human interaction is completed.Persistence
The workflow templates should not be interpreted as providing a general durable workflow persistence system. Persistence and deployment behavior depend on the surrounding BindAI components and application architecture.Template Scope
The templates are intentionally focused examples rather than production-ready application architectures. For production systems, applications should additionally consider:- Error handling
- Input validation
- Authentication and authorization
- External-service failures
- Idempotency
- Logging
- Observability
- Resource limits
- Security
- Deployment strategy
