Execution Model Overview
- Client executes workflow β
POST /workflows/{id}/execute - Create
TrackedExecution(statusPENDING) β publish message to Pub/Sub - Pub/Sub triggers
ProcessWorkflowβ engine processes a tick (ready nodes)- Sync nodes (
plai_agent,http,markdown_report) β complete immediately - Async nodes (
firecrawl) β markedRUNNING, wait for a webhook, then callcomplete_node()
- Sync nodes (
- More work?
- Yes β republish to Pub/Sub and repeat from step 3
- No β workflow is
COMPLETED
Key Concepts
Tick-Based Scheduling
A tick is a single execution cycle where the engine:- Loads the current execution context and step states
- Determines which nodes are ready to run (dependencies satisfied)
- Executes up to 5 nodes in parallel per tick
- Updates step executions and workflow metadata
- Republishes a continuation message if work remains
- Prevents any single tick from consuming too many resources
- Enables fair scheduling across multiple workflows
- Allows for monitoring and intervention between steps
Batch Processing
The engine processes nodes in batches:- Batch size: 5 nodes per tick
- Execution: Parallel within the batch
- Continuation: Automatic via Pub/Sub when more nodes are ready
Asynchronous Continuation
For long-running operations:- Synchronous nodes complete within the same tick
- Asynchronous nodes (like firecrawl) mark their status as
RUNNINGand wait - External services complete the work and call a webhook
- The webhook endpoint completes the node and republishes to Pub/Sub
- Next tick processes dependent nodes
Execution Lifecycle
Step 1: Workflow Trigger
- Workflow definition is resolved
- TrackedExecution is created with status
PENDING - Initial context stores the input
- Pub/Sub message published
Step 2: First Tick Processing
Engine loads the execution and:- Identifies root nodes (no dependencies)
- Executes them in parallel
- Stores outputs in context
- Updates step execution records
fetch_data: COMPLETEDsearch_web: COMPLETEDanalyze_a: PENDING (waiting forfetch_data)analyze_b: PENDING (waiting forfetch_data)analyze_c: PENDING (waiting forsearch_web)
Step 3: Subsequent Ticks
Each tick:- Checks which nodes have satisfied dependencies
- Executes ready nodes (up to 5 per tick)
- Repeats until terminal state
fetch_data: COMPLETEDsearch_web: COMPLETEDanalyze_a: COMPLETEDanalyze_b: COMPLETEDanalyze_c: RUNNING (async firecrawl)report: PENDING (waiting foranalyze_a,analyze_b,analyze_c)
Step 4: Async Completion
For firecrawl nodes:Step 5: Workflow Completion
Final state:- All sync nodes: COMPLETED
- All async nodes: COMPLETED or FAILED
- Workflow status: COMPLETED or FAILED
- COMPLETED: All nodes succeeded
- FAILED: At least one node failed
Execution States
Each workflow execution has a status:
Each node execution has step-level states:
Monitoring Execution
Get Execution Status
Get Detailed Logs
Performance Characteristics
Execution Speed Factors
- Node duration: How long each step takes
- Parallelization: Nodes without dependencies run together
- Batch size: 5 nodes per tick (limits parallelism)
- Async operations: External APIs determine speed
Example Timings
Scenario 1: Sequential Pipeline- Node A: 3 seconds
- Node B: 2 seconds β runs after Node A
- Node C: 4 seconds β runs after Node B
- Total: 9 seconds (3 + 2 + 4)
- Ticks: 3 (A, B, C)
- Node A: 3 seconds β all run in Tick 1 (parallel)
- Node B: 2 seconds β all run in Tick 1 (parallel)
- Node C: 4 seconds β all run in Tick 1 (parallel)
- Total: 4 seconds (max of all)
- Ticks: 1
- Tick 1: A (3s), B (2s)
- Tick 2: C (depends on A+B, 4s)
- Tick 3: D (depends on C, 2s)
- Total: 9 seconds
- Ticks: 3
Error Handling
Node Failure
When a node fails:- Step is marked as
FAILED - Error details are logged
- Dependent nodes become
SKIPPED - Workflow status becomes
FAILED - Execution stops processing
Timeout Handling
Each node has configurable timeout:- Default: 300 seconds (5 minutes)
- Configurable: Per node in parameters
- On timeout: Node marked as FAILED, workflow halted
Advanced Features
Tick Continuation
When a tick completes with remaining work:Context Persistence
Workflow context remains in memory and persistent storage:- input: Original input data
- nodes: Outputs of all completed nodes
- workflow: Workflow metadata
- loop: Current loop iteration data (for loop nodes)
Next Steps
- Node Types - Available node types for workflows
- Dependencies - How to define execution order
- Execution Variables - Access data between nodes