
Security News
/Research
Popular node-ipc npm Package Infected with Credential Stealer
Socket detected malicious node-ipc versions with obfuscated stealer/backdoor behavior in a developing npm supply chain attack.
@loopstack/dynamic-routing-example-workflow
Advanced tools
A workflow demonstrating how to create dynamic routing an a workflow
A module for the Loopstack AI automation framework.
This module provides an example workflow demonstrating how to implement conditional routing based on runtime values.
The Dynamic Routing Example Workflow shows how to create branching logic in workflows using the if condition on transitions. It demonstrates how to route execution through different paths based on input values.
By using this workflow as a reference, you'll learn how to:
if property with expression syntax@Input for workflow arguments with UI form configurationThis example is useful for developers building workflows that require decision trees, validation flows, or any logic that branches based on data.
See SETUP.md for installation and setup instructions.
The workflow class declares input arguments using @Input:
@Workflow({
configFile: __dirname + '/dynamic-routing-example.workflow.yaml',
})
export class DynamicRoutingExampleWorkflow {
@InjectTool() private createChatMessage: CreateChatMessage;
@Input({
schema: z
.object({
value: z.number().default(150),
})
.strict(),
})
args: {
value: number;
};
}
Use the if property with expression syntax (${{ }}) to define conditions for transitions. The first matching transition from a given state is taken:
- id: route-to-place-A
from: prepared
to: placeA
if: ${{ args.value > 100 }}
- id: route-to-place-B
from: prepared
to: placeB
# No condition = fallback route
The expression syntax ${{ }} supports JavaScript-like comparison operators (>, <, >=, <=, ==, etc.) directly, without needing helper functions.
Chain conditional transitions to create decision trees:
# First level: value > 100?
- id: route-to-place-A
from: prepared
to: placeA
if: ${{ args.value > 100 }}
- id: route-to-place-B
from: prepared
to: placeB
# Fallback: value <= 100
# Second level: value > 200?
- id: route-to-place-C
from: placeA
to: placeC
if: ${{ args.value > 200 }}
- id: route-to-place-D
from: placeA
to: placeD
# Fallback: 100 < value <= 200
Configure the input form in YAML:
ui:
form:
properties:
value:
title: 'A number between 0 and 300'
The workflow routes through different states based on the input value:
This workflow uses the following Loopstack modules:
@loopstack/core - Core framework functionality@loopstack/create-chat-message-tool - Provides CreateChatMessage toolAuthor: Jakob Klippel
License: Apache-2.0
FAQs
A workflow demonstrating how to create dynamic routing an a workflow
The npm package @loopstack/dynamic-routing-example-workflow receives a total of 213 weekly downloads. As such, @loopstack/dynamic-routing-example-workflow popularity was classified as not popular.
We found that @loopstack/dynamic-routing-example-workflow demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
/Research
Socket detected malicious node-ipc versions with obfuscated stealer/backdoor behavior in a developing npm supply chain attack.

Security News
TeamPCP and BreachForums are promoting a Shai-Hulud supply chain attack contest with a $1,000 prize for the biggest package compromise.

Security News
Packagist urges PHP projects to update Composer after a GitHub token format change exposed some GitHub Actions tokens in CI logs.