Skip to main content

Creating a stage

Since a Workflow is composed of stages, let's create one first.

What is a Stage?

A stage is a step in your Workflow. It is a Python file that will be executed when your Workflow reaches that point in its run.

Depending on the trigger you need for that stage, you can create it as a Form, Hook, Job or Script.

  • Forms: manually triggered stages with a friendly UI. Add them into a Workflow whenever user input is needed in a process.

  • Jobs: stages scheduled to be executed periodically.

  • Hooks: stages triggered by authorized HTTP requests sent to their endpoint.

  • Scripts: a plain Python script, whose trigger is simply the completion of the previous step in the Workflow.

Building a Form

In your Home screen, click on "Create new" and select "Forms". Let's title it "Onboarding Form".

The Form editor shows the Form's code to the left and a preview of the UI to the right.

Forms are created with our abstra.forms library, which generates the widgets you see on the screen. Each command from the lib you add to your code - read_emailread_filedisplay_image, etc. - will appear as a widget in your form. Learn more on Forms here and see the complete list of widgets here.

You can edit a Form's code in the editor or in your preferred IDE. To open your IDE, click on "Open in editor." Whenever you save your changes, all IDEs and previews will be updated.

Inside the Settings tab you can configure welcome and end screens, messages and alerts that appear to the user while they're filling out your form. Experiment changing the title to "Welcome to our service".

The last key element in the Form editor is the Smart Console on the bottom of the screen. Besides exhibiting logs and prints from preview runs, it functions as a powerful AI assistant.

tip

Smart Console is fully contextualized with your project and speeds up coding and debugging. Learn more here.

Building a Script

Another type of stage you can build is a Script. These are handy whenever you simply need to run some Python code within your process.

Once again, navigate to the Home screen, click "Create new" and select "Script". Let's call it "Greeting" and watch as the greeting.py script is created.

This example code is quite simple, just storing some data – which we will understand later on.