Workflows
A workflow in Orion101 is a series of steps designed to accomplish a task or process. These steps are expressed in natural language, making workflows intuitive and accessible for both developers and non-technical users. Workflows share many similarities with agents but include additional features such as Parameters and Steps, which allow for more structured and dynamic processes.
Parameters
Parameters are optional fields that allow you to define inputs for your workflow. These inputs are particularly useful when workflows are triggered by another workflow or an agent. By specifying parameters, you enable greater flexibility and reusability, allowing workflows to adapt dynamically to various scenarios.
Steps
Steps define the actions that a workflow will perform. Each step can have its own tools and logic, enabling workflows to handle complex processes. Steps can also call other workflows or agents, allowing for modularity and reusability.
Orion101 supports two special types of steps to add conditional logic and iterative capabilities:
If Statements:
Allow you to define a condition and specify different actions based on whether the condition evaluates to true or false.
Example: If a parameter “age” is greater than 18, proceed with step A; otherwise, proceed with step B.
While Loops:
Allow you to repeatedly execute a set of steps as long as a specified condition remains true.
Example: While an inventory count is greater than zero, continue processing orders.
Triggering Workflows
Workflows in Orion101 can be triggered in several ways, offering flexibility for various use cases.
Via CLI Command
You can invoke workflows directly from the command line using the invoke command. For example, to trigger a workflow with two parameters:
orion101 --debug invoke w1km9xw "name='John Doe', address='123 Main Street'"
You can list all available workflows and their IDs with the following command:
orion101 workflows
Via Webhooks Workflows can also be triggered via webhooks. While this feature is still under development, it can currently be set up using curl. Here’s an example of creating a webhook:
curl -X POST 'http://127.0.0.1:8080/api/webhooks' -d '{ \
"description": "Webhook to respond to PagerDuty events", \
"alias": "pd-hook", \
"workflowID": "w1km9xw"}'
This will generate a webhook accessible at:
http://localhost:8080/api/webhooks/pd-hook.
When this webhook is called, the body of the request will be passed as input to the workflow.
Optional Fields for Webhooks
When setting up webhooks, Orion101 provides additional fields for customization and security:
Headers:
Specify headers as an array to include them in webhook requests. For example:
{ ... "headers": ["X-HEADER-1", "X-HEADER-2"] ... }
These headers, if present in the webhook request, will be passed to the workflow.
Secret and Validation Header:
To secure webhook invocations, you can include a shared secret and a validation header. For example:
{ ...
"secret": "<SHARED SECRET>",
"validationHeader": "<SIGNATURE HEADER>"
...
}
Services offering webhook integration, like GitHub and PagerDuty, often provide shared secrets for verifying requests. Orion101 validates these signatures to ensure secure communication.
Last updated