Skip to main content

Action Playbook Bricks


PurposeExplore this guide to discover the various types of Action Playbook Bricks, along with examples of popular ones used in the Playbook App. Learn how to set them up with easy-to-follow instructions, giving you a understanding of how they work and where they can be useful.
Last UpdatedSeptember 03, 2024
Expertise Level:Expertise level icon
Coding experience required.

Introduction to Action Playbook Bricks: Support Video

What are Action Playbook bricks?

Action Playbook Bricks are used to automate various tasks. These bricks can be created and managed within the Brick Management section.

Brick types

Trigger Bricks

Triggers are events that initiate a playbook. They can be internal events, such as a scheduled time, or external events, such as a webhook. When a Trigger is activated, it starts the Playbook.

Triggers can be thought of as a special type of Action Brick that activates a Flow when certain conditions are met.

You can determine the category of the Trigger Brick by the red color assigned to it.

Operator Bricks

Operator Bricks determine how a Playbook flows. Think of them as the decision-makers of the Playbook. They are like inspectors set up at certain levels of the Playbook which check if the parameters set up by you are being followed. For example, you might configure an Operator Brick to examine incoming data and check if it meets specific criteria. If the data matches these criteria, the Operator Brick allows it to continue down a particular path, perhaps performing certain actions or transformations. On the other hand, if the data doesn't meet the criteria, the Operator Brick can reroute it or trigger different actions.

You can determine the category of the Operator Brick by the blue color assigned to it.

Transform Bricks

Transforms are used to modify data that is passed between actions. They can be used to filter data, add metadata, or perform calculations. Transforms are especially useful when working with data from multiple sources or when the data needs to be formatted in a specific way.

You can determine the category of the Transform Brick by the orange color assigned to it.

Execute Bricks

Executes are tasks that are performed by the Playbook. They can be anything from sending an email to making an API call. Each action has specific inputs and outputs and can be customized to suit the needs of the Playbook.

You can determine the category of the Action Brick by the green color assigned to it.

Creating an Action Playbook Brick

To create a new Playbook Brick:

  1. Navigate to Settings / Brick Management V3.

  2. Click CREATE BRICK in the top right corner.

  3. Fill in the name and description, and select Action Playbook Brick as the type.

If you have an existing Brick you can use the fork option to skip various steps of the configuration process.

Configuration

Before using a Playbook Brick, several configurations are required. These configurations can be set in the Configuration > Configuration tab.

The configuration JSON includes the following fields:

NameDescriptionType
brickIdA random identifierString
labelThe name of the brick as it will appear in PlaybooksString
descriptionThe description of the brickString
placeholderPlaceholder value for the brickString
paramsWhat parameters the brick can use. These parameters will be explained in the parameters sectionList of objects
iconThe icon that will appear next to the brick in Playbooks. The icons section below will explain how to use iconsString
typeCan be one of execute, trigger, transform, operator.String
inputWhether the brick allows input nodesBoolean
outputWhether the brick allows output nodesBoolean
canTestWhether the brick gets a debug optionBoolean

Parameters

Playbook Bricks can have multiple parameters to determine their behavior. The parameters can be of the following types:

  • text: Allows any string input.

  • select: Provides a dropdown menu for selection.

  • secret: Allows selection from configured secrets.

  • jinja2: Indicates that the input string contains a Jinja template.

  • prompt: Indicates that the input string contains an LLM prompt.

Each parameter has the following fields:

NameDescriptionTypeRequired
nameName of the parameter. Use this name to reference the parameter in your code.StringYes
labelThe name that will be shown in the playbookStringYes
typeThe parameter type. This can be one of the types shown aboveStringYes
placeholderPlaceholder valueStringNo
defaultDefault valueStringNo
requiredWhether the parameter is requiredBooleanNo, will default to False
optionsA list of options for the select parameter type. These options have a value and a labelList of objectsOnly required for select type
secretTypeWhat type of secret to use (e.g. "BASIC", "APIKEY")StringNo, will default to all secret types

Icons

The icon string should begin with:

data:image/{{image_type}}+xml;base64,

Where image_type can be png, jpeg, or svg.

This prefix should be followed by your base64 encoded icon.

Writing the Brick Code

To start coding your brick:

  1. Navigate to Code.

  2. Click + to add a Python file.

  3. Name the file main.py.

Brick Class

Implement a Brick class that contains the core logic of your brick. This class should extend BaseBrick.

__init__()

This method initializes the brick and sets up its configuration.

Parameters:

  • config: A configuration object containing the parameters. You can retrieve the values using the parameter names as keys.

run()

This method contains the logic for executing the brick's task.

Parameters:

  • task (Object): An object containing task information with the following attributes:

    • event (dict): The base event.
    • state (dict): The playbook state.
    • variables (dict): The output from upstream tasks.
  • in_nodes (list): Input nodes.

  • out_nodes (list): Output nodes.

Returns: A routed_task (RoutedTask):

  • session_id (String): The task's session ID, retrievable from the input task (task.session_id).

    • event (Dict): The base event, retrievable from the input task (task.event).
  • state (Dict): The playbook state, retrievable from the input task (state).

  • variables (Dict): The variables, retrievable from the input task (variables).

  • out_nodes (List): The output nodes.