SDK Deep Dive
Master every aspect of the Kubiya Workflow SDK - from core architecture to advanced patterns.SDK Architecture
Core Components
1. Workflow Engine
The heart of the SDK - manages workflow lifecycle:2. Step Management
There is a huge variety of step types available, including shell commands, shell scripts, Python code, etc… Here are some simple common examples of how to define steps using the DSL:3. Multistep workflows
As we saw in the examples below, we can define workflows and different types of steps, including shell commands, scripts, and Python code. Now let’s combine them. Here is an example of a more complex workflow with multiple steps:4. DSL Parser
Transform Python DSL to internal representation, JSON and YAML:5. Clients and Executors
Here we can see an example how to execute a multistep workflow using the Kubiya SDK client.:Advanced SDK Features
Complex dependent steps and async client
In this example, we will create a more complex workflow that includes multiple steps, dependencies, and outputs. The workflow will fetch data from an API, perform a health check on a server, and generate a final summary based on the results. Last 2 steps use Docker containers to run shell scripts. It is possible to use any Docker image, but in this example we will use thealpine:latest
image for simplicity.
At the end we will use the async StreamingKubiyaClient
to execute the workflow and stream the results.
SDK Internals
Execution Pipeline
Error Handling
Performance Optimization
Best Practices
1. Workflow Design
2. Resource Management
3. Error Handling
SDK Ecosystem
CLI Tools
Command-line interface for workflow management
VS Code Extension
IntelliSense and debugging for workflows
Testing Framework
Unit and integration testing utilities
Monitoring Tools
Real-time workflow monitoring