What youβll build
The workflow follows this structure:- Trigger receives zone state updates for vehicle zones across the site
- Zone Activity Check evaluates how many qualifying vehicles are in the zone
- Event Orchestrator routes based on check results β scoped by zone to prevent duplicate events per zone
- Create path finds the closest frame, captures a still, runs a VLM confirmation, and creates the event
- Close path closes the event when conditions are no longer met
- Replay Trigger (disabled) is available for testing
Prerequisites
- A Worlds site with aisle zones configured
- GraphQL Subscription API credentials in the Workflow Builder
- The state machine running and connected to your Workflow Builder instance
- Azure OpenAI or similar LLM credentials (optional, for VLM confirmation)
- SendGrid API credentials (optional, for email alerts)
Step 1: Detection Webhook Trigger
Configure the trigger to receive zone state updates for vehicles.Why zone state?
For congestion, the question isnβt βwhat is this specific forklift doing?β β itβs βare there too many vehicles in this aisle?β Zone state gives you exactly that: updates whenever the occupancy of a zone changes. Each execution tells you how many tracks are in the zone, what types they are, and how long each has been there. Youβll receive three signal types:Step 2: Zone Activity Check
The check node evaluates whether there are enough qualifying vehicles in the zone to constitute congestion.
What happens: For every zone state update, the node counts how many active tracks in the zone meet the dwell time and intersection thresholds. If 4+ vehicles each have at least 5 seconds dwell time and 10% intersection, the check passes.
Output: Adds
checks.zoneActivity.passed (boolean) and checks.zoneActivity.qualified_track_ids (array of track IDs that met thresholds) to the data. The qualified track IDs are used downstream for image capture and event metadata.
Adapting for similar use cases
Step 3: Event Orchestrator
The orchestrator reads the Zone Activity Check results and manages the event lifecycle.
Routing:
Why the close path matters here
Unlike the batch track state workflow which uses batch mode (where each track arrives once, already expired), this streaming workflow sees continuous zone updates. When vehicles leave the zone and the track count drops below the threshold, the checks fail β and the orchestrator routes to Close Event so you can close the event in Worlds with the end time.Step 4: Closest Frame
Before capturing an image, find the optimal timestamp where the qualifying vehicles are closest together in the frame. Node: Worlds Actions β Closest Frame
Why this node: With multiple vehicles involved in congestion, you want an image that shows them all clearly. The Closest Frame node analyzes the bounding box positions across recent detections and finds the timestamp where the tracks are closest together β giving you the best possible single image of the congestion.
Output: Adds
closest_frame.optimal_timestamp to the data, which you pass to the image processor.
Step 5: Create still image
Capture the congestion scene at the optimal timestamp. Node: Worlds Actions β Process Detection Image β Create Still
The image will show all qualifying vehicles with bounding boxes and the zone overlay drawn on the frame.
Step 6: VLM confirmation (optional)
Pass the captured image through a Vision Language Model to add context or confirm congestion. This step uses the built-in Basic LLM Chain node with an image input. The model analyzes the still image and returns structured data:- As context metadata (this workflow) β the VLM output is merged back with the detection data and attached as event metadata. The event is always created regardless of VLM output.
- As a check gate (advanced pattern) β feed the
congestion_booleaninto an IF node to gate whether the event is created. This adds AI confirmation to reduce false positives.
Step 7: Create event in Worlds
Write the congestion event to the Worlds platform. Node: Event Manager β Create Event
Metadata:
Unlike the batch obstruction workflow, we donβt set an end time here because the congestion may still be ongoing. The close path handles setting the end time when conditions clear.
Step 8: Close event path
When vehicles leave the zone and the track count drops below the threshold, the orchestrator routes to Close Event. Node: Event Manager β Close Event
Metadata:
This calculates the congestion duration in seconds from the event start time (stored by the orchestrator) to the current zone update time.
Step 9: Optional β GIF and email
After creating the event, you can optionally generate a GIF and send an email alert, following the same pattern as the batch track state workflow.How it works end-to-end
- Cameras monitor factory aisles, detecting vehicles in predefined zones
- The state machine tracks zone occupancy and emits
zone_updatedsignals as vehicles enter and leave - Two vehicles enter an aisle zone β
zone_updatedβ Zone Activity Check: 2 tracks, threshold is 4 β fails β No Action - A third vehicle enters β
zone_updatedβ 3 tracks β fails β No Action - A fourth vehicle enters β
zone_updatedβ 4 tracks, all with 5s+ dwell and 10%+ intersection β passes - Orchestrator sees no existing event for this zone β routes to Create Event
- Closest Frame finds the optimal timestamp with all 4 vehicles visible
- A still image is captured with bounding boxes and zone overlay
- The VLM analyzes the image and confirms congestion with a context description
- An event is created in Worlds with track data, VLM context, and the image
- More vehicles enter β checks still pass β orchestrator routes to Update Event (unwired)
- Vehicles leave, count drops to 3 β checks fail β orchestrator routes to Close Event with duration
Other use cases for this pattern
The streaming zone state pattern works for any use case where you care about aggregate zone activity rather than individual tracks:
The core structure stays the same β Trigger (zone state) β Zone Activity Check β Orchestrator (zone scope) β Actions β only the threshold configuration and event metadata change.

