Workflow DSL Reference
The Kubiya Workflow DSL provides a fluent, chainable API for building workflows programmatically.Workflow Builder
Creating a Workflow
Workflow Methods
.description(desc: str)
Set workflow description.
.runner(name: str)
Specify the runner to execute on.
.env(**variables)
Set environment variables.
.params(**parameters)
Define parameters with defaults.
.schedule(cron: str)
Set cron schedule.
.timeout(seconds: int)
Set workflow timeout.
Steps
Basic Steps
.step(name: str, command: str)
Add a simple command step.
.step(name: str).tool(tool_name_or_instance, args=None, timeout=None, **kwargs)
Use a pre-registered tool or Tool class instance with enhanced type safety and automatic configuration.
Parameters:
tool_name_or_instance
: Either a string name of a pre-registered tool, or a Tool class instance fromkubiya_workflow_sdk.tools.models
args
: Optional dictionary of arguments to pass to the tooltimeout
: Optional execution timeout in seconds**kwargs
: Additional configuration options
- Type Safety: Full IDE support with autocomplete and type checking
- Automatic Configuration: Tool definition, arguments, environment, and dependencies are automatically extracted
- Validation: Built-in parameter validation and type checking
- Reusability: Tool instances can be shared across multiple workflows
- Tool name, type, and image
- Script content and entrypoint
- Argument definitions with types and validation
- Environment variables and secrets
- File mounts and volumes
- Service dependencies
Parallel Steps
.parallel_steps(name: str, items: list, command: str, max_concurrent: int = None)
Execute steps in parallel.
Sub-workflows
.sub_workflow(name: str, workflow: str, params: dict = None)
Execute another workflow as a step.
Executors
Use specific executors for steps:Shell Executor
Python Executor
Docker Executor
Inline Agent Executor
Advanced Features
Lifecycle Handlers
Email Notifications
Queue Management
Resource Management
Metadata
Complete Example
Complete Example with Tool Instances
Here’s a comprehensive example showing how to use Tool instances in workflows:- Type Safety: Tool instances provide IDE autocomplete and validation
- Reusability: Tools can be defined once and used multiple times
- Maintainability: Tool logic is separate from workflow orchestration
- Flexibility: Mix tool instances with shell commands and other executors
- Error Handling: Built-in timeout and validation support