In the ever-evolving landscape of workflow automation, Kestra has emerged as a powerful contender, offering robust features that cater to the dynamic needs of modern businesses. This tutorial delves into one of Kestra’s most potent capabilities: the use of inputs to create flexible and reusable workflows.
Understanding Kestra Inputs
Inputs in Kestra allow you to parameterize your workflows, making them adaptable to various scenarios without the need for constant rewrites. This feature is crucial for teams looking to streamline their processes and reduce redundancy in their automation efforts.
Types of Inputs
Kestra supports several input types, including:
- Strings
- Integers
- Booleans
- Arrays
- Objects
Each type serves a specific purpose, allowing you to fine-tune your workflows to handle different data structures and requirements.
Implementing Inputs in Your Workflow
To illustrate the power of inputs, let’s walk through a simple example:
id: input_example
namespace: my_project
inputs:
- name: user
type: string
required: true
default: 'World'
tasks:
- id: greet
type: io.kestra.core.tasks.scripts.Bash
script: echo "Hello, {{ inputs.user }}!"
In this example, we’ve defined an input named ‘user’ of type string. It’s set as required, but we’ve also provided a default value of ‘World’. This means if no value is provided at runtime, the workflow will use ‘World’ as the input.
Dynamic Workflow Execution
The real power of inputs shines when executing workflows. You can now run the same workflow with different parameters:
kestra run input_example -i user="Alice"
kestra run input_example -i user="Bob"
These commands will result in different outputs without any changes to the workflow definition.
Advanced Input Usage
As your workflows become more complex, you can leverage inputs in more sophisticated ways:
Conditional Execution
Use inputs to determine which tasks should run:
tasks:
- id: conditional_task
type: io.kestra.core.tasks.flows.Switch
value: '{{ inputs.environment }}'
cases:
production:
- id: prod_task
type: io.kestra.core.tasks.scripts.Bash
script: echo "Running in production"
development:
- id: dev_task
type: io.kestra.core.tasks.scripts.Bash
script: echo "Running in development"
Dynamic API Requests
Use inputs to customize API endpoints or payloads:
tasks:
- id: api_request
type: io.kestra.core.tasks.scripts.Http
uri: '{{ inputs.api_url }}'
method: POST
body: '{{ inputs.payload | json_encode }}'
Best Practices for Input Management
- Document Your Inputs: Clearly describe each input’s purpose and expected values in your workflow documentation.
- Use Sensible Defaults: Provide default values where appropriate to make your workflows more user-friendly.
- Validate Inputs: Implement input validation to ensure your workflows receive the correct data types and values.
- Version Your Workflows: As you modify inputs, maintain version control to track changes and ensure backward compatibility.
Conclusion
Mastering Kestra’s input system opens up a world of possibilities for creating flexible, reusable workflows. By parameterizing your processes, you can build a library of versatile automations that adapt to your organization’s evolving needs. As we move further into 2025, the ability to create dynamic, input-driven workflows will become increasingly crucial for businesses looking to stay agile and efficient in a rapidly changing technological landscape.
Remember, the key to successful workflow automation lies not just in the tools you use, but in how creatively and effectively you apply them. With Kestra’s input system, you’re well-equipped to tackle the complex automation challenges of today and tomorrow.
References:
- https://thedigitalprojectmanager.com/tools/workflow-management-software/
- https://www.cflowapps.com/best-workflow-management-tools/
- https://support.atlassian.com/jira-work-management/docs/how-to-create-workflows/
- https://www.youtube.com/watch?v=x3vxD_Dgt5M
- https://ossisto.com/blog/it-automation-tools/
- https://help.klaviyo.com/hc/en-us/articles/115002774932
- https://www.youtube.com/watch?v=uml91UcDd-E
- https://www.custify.com/blog/workflow-automation-tools/
- https://idratherbewriting.com/learnapidoc/pubapis_github_pull_requests.html
- https://project-aeon.com/blogs/media-workflow-automation-boost-production-efficiency
- https://www.jotform.com/products/workflows/workflow-management-tools/
- https://dataplatform.cloud.ibm.com/docs/content/wsj/analyze-data/fm-prompt-samples.html?context=wx&pos=10
- https://stripo.email/blog/unskippable-marketing-automation-workflows/
- https://www.proofhub.com/articles/workflow-automation-software
- https://www.cflowapps.com/document-review-process/
- https://blog.n8n.io
- https://thedigitalprojectmanager.com/tools/best-workflow-automation-software/
- https://help.hootsuite.com/hc/en-us/articles/4403597090459-Create-engaging-and-effective-social-media-content
- https://clickup.com/blog/task-management-software/
- https://support.knowledgeowl.com/help/article-settings