Normal Steps
You can useStep
to define a normal step. Normal steps takes a body function that is called when the step is reached.
lambda
keyword) or as a separate function.
Body functions can use the context (ctx
) to access data from previous steps or external systems. Read more in the context section.
The return value of each function can be accessed by subsequent steps using ctx.get_step_result("step-id")
.
Screen Steps
Screen steps are steps that present a UI to the user for input or review. To define a screen step, you need to both define- a React component (a
.tsx
file) - a
ScreenStep
in the workflow that points to the React component by file path
result
field of the handleComplete
function. In the example above (see greeting-screen.tsx
), the return value will be the string "confirmed"
.
See the screens section for more information on how to create and customize screens.
Step Outputs
Every step in a workflow can return a value. This value can be accessed by subsequent steps usingctx.get_step_result("step-id")
.
IMPORTANT: All outputs from workflow steps must be JSON serializable. This is critical for Sample Workflows to function properly, as step outputs are stored and passed between steps in a serialized format.
JSON Serializable Types
Step outputs can include:- Primitive types:
string
,number
,boolean
,null
- Arrays: Lists of JSON-serializable values
- Objects: Plain objects with JSON-serializable properties
- Nested structures: Any combination of the above
Example: Correct Step Output
Example: Incorrect Step Output
Version Control and Deployment
Sample Workflows are version controlled through Git, making it easy to track changes, collaborate with team members, and maintain different versions of your workflows.Git-Based Version Control
- Workflow definitions (Python files) and screen components (TypeScript files) are stored in a Git repository
- This provides full history tracking and the ability to revert to previous versions if needed
Automatic Deployment
When changes are made to workflow files:- Automatic Detection: Sample automatically detects changes to workflow files
- Deployment: Updated workflows are deployed and become available for use
- Version Management: Previous versions remain accessible, ensuring running workflows can complete even after updates