Kailash Core SDK - Foundational Skills
Comprehensive guide to Kailash Core SDK fundamentals for workflow automation and integration.
Features
The Core SDK provides the foundational building blocks for creating custom workflows with fine-grained control:
- 110+ Workflow Nodes: Pre-built nodes for AI, API, database, file operations, logic, and more
- WorkflowBuilder API: String-based workflow construction with type safety
- Dual Runtime Support: AsyncLocalRuntime (Docker/async) and LocalRuntime (CLI/scripts)
- Advanced Patterns: Cyclic workflows, conditional execution, error handling
- MCP Integration: Built-in Model Context Protocol support
- Parameter Passing: Flexible data flow between nodes
- Zero Configuration: Auto-detection of runtime context
- Production Ready: Enterprise features including monitoring, validation, and debugging
Quick Start
from kailash.workflow.builder import WorkflowBuilder
from kailash.runtime.local import LocalRuntime
workflow = WorkflowBuilder()
workflow.add_node("NodeName", "id", {"param": "value"})
# Use context manager for proper resource cleanup (recommended)
with LocalRuntime() as runtime:
results, run_id = runtime.execute(workflow.build())
Reference Documentation
Getting Started
- workflow-quickstart - Create basic workflows with WorkflowBuilder
- kailash-installation - Installation and setup guide
- kailash-imports - Import patterns and module organization
Core Patterns
- node-patterns-common - Common node usage patterns
- connection-patterns - Linking nodes and data flow
- param-passing-quick - Parameter passing strategies
- runtime-execution - Executing workflows (sync/async)
- runtime-lifecycle - Runtime lifecycle, ref counting, acquire/release, context managers
Advanced Topics
- async-workflow-patterns - Asynchronous workflow execution
- async-resource-safety -
__del__ hardening, double-check locking, pool lifecycle, static analysis guardrails
- cycle-workflows-basics - Cyclic workflow patterns
- error-handling-patterns - Error management strategies
- switchnode-patterns - Conditional routing with SwitchNode
- pythoncode-best-practices - PythonCode node best practices
- mcp-integration-guide - Model Context Protocol integration
Key Concepts
Canonical Node Pattern (4-Parameter)
This is the single source of truth for node configuration. All other skills reference this section.
workflow.add_node(
"NodeClassName", # 1. Node type (PascalCase, string)
"unique_node_id", # 2. Unique ID (snake_case, string)
{ # 3. Configuration dict
"param1": "value",
"param2": 123
},
connections=[] # 4. Optional: input connections
)
| Parameter |
Type |
Description |
Example |
| Node type |
str |
The node class name (PascalCase) |
"LLMNode", "HTTPRequest" |
| Node ID |
str |
Unique identifier (snake_case) |
"fetch_data", "process_1" |
| Config |
dict |
Node-specific configuration |
{"url": "..."} |
| Connections |
list |
Optional input connections (4-tuple) |
[("src", "out", "dst", "in")] |
Connection Methods:
# Method 1: add_connection (4-positional params - explicit)
workflow.add_connection("read_file", "content", "transform", "input")
# Method 2: connect (flexible API with keyword args)
workflow.connect("read_file", "transform", from_output="content", to_input="input")
# Method 3: connect with mapping (multiple outputs)
workflow.connect("node1", "node2", mapping={"content": "input", "meta": "metadata"})
WorkflowBuilder Pattern
- String-based node API:
workflow.add_node("NodeName", "id", {})
- Always call
.build() before execution
- Never
workflow.execute(runtime) - always runtime.execute(workflow.build())
Runtime Selection
- AsyncLocalRuntime: For Docker/async (async contexts) - async-first, no threading, 10-100x faster
- LocalRuntime: For CLI/scripts (sync contexts) - synchronous execution with thread support
- get_runtime(): Auto-detection helper that selects appropriate runtime based on context
Both runtimes return identical structure: (results, run_id) tuple.
Runtime Architecture
Both LocalRuntime and AsyncLocalRuntime inherit from BaseRuntime with shared capabilities:
BaseRuntime Foundation:
- 29 configuration parameters (debug, enable_cycles, conditional_execution, connection_validation, etc.)
- Execution metadata management
- Common initialization and validation modes (strict, warn, off)
Shared Mixins:
- CycleExecutionMixin: Cyclic workflow execution with validation
- ValidationMixin: Workflow structure validation (5 methods)
- ConditionalExecutionMixin: Conditional execution and branching with SwitchNode support
AsyncLocalRuntime-Specific:
- WorkflowAnalyzer for optimal execution strategy
- Level-based parallelism for concurrent execution
- Thread pool for sync nodes without blocking
- Semaphore control to prevent resource exhaustion
Critical Rules
- ✅ ALWAYS:
runtime.execute(workflow.build())
- ✅ String-based nodes:
workflow.add_node("NodeName", "id", {})
- ✅ 4-parameter connections:
(source_id, source_param, target_id, target_param)
- ✅ Docker/async: Use AsyncLocalRuntime (mandatory)
- ✅ CLI/Scripts: Use LocalRuntime
- ❌ NEVER:
workflow.execute(runtime)
- ❌ NEVER: Instance-based nodes
- ❌ NEVER: Use LocalRuntime in Docker (causes hangs)
When to Use This Skill
Use this skill when you need to:
- Create custom workflows from scratch
- Understand workflow fundamentals
- Learn node patterns and connections
- Set up runtime execution
- Handle errors in workflows
- Implement cyclic or async patterns
- Integrate with MCP
- Get started with Kailash SDK
Related Skills
Support
For complex workflows or debugging, invoke:
pattern-expert - Workflow patterns and cyclic debugging
testing-specialist - Test workflow implementations
Converted and distributed by TomeVault — claim your Tome and manage your conversions.
1---2name: integrum-global-kailash-vibe-cc-setup-01-core-sdk3description: Kailash Core SDK - Foundational Skills4---56# Kailash Core SDK - Foundational Skills78Comprehensive guide to Kailash Core SDK fundamentals for workflow automation and integration.910## Features1112The Core SDK provides the foundational building blocks for creating custom workflows with fine-grained control:1314- **110+ Workflow Nodes**: Pre-built nodes for AI, API, database, file operations, logic, and more15- **WorkflowBuilder API**: String-based workflow construction with type safety16- **Dual Runtime Support**: AsyncLocalRuntime (Docker/async) and LocalRuntime (CLI/scripts)17- **Advanced Patterns**: Cyclic workflows, conditional execution, error handling18- **MCP Integration**: Built-in Model Context Protocol support19- **Parameter Passing**: Flexible data flow between nodes20- **Zero Configuration**: Auto-detection of runtime context21- **Production Ready**: Enterprise features including monitoring, validation, and debugging2223## Quick Start2425```python26from kailash.workflow.builder import WorkflowBuilder27from kailash.runtime.local import LocalRuntime2829workflow = WorkflowBuilder()30workflow.add_node("NodeName", "id", {"param": "value"})3132# Use context manager for proper resource cleanup (recommended)33with LocalRuntime() as runtime:34 results, run_id = runtime.execute(workflow.build())35```3637## Reference Documentation3839### Getting Started4041- **[workflow-quickstart](workflow-quickstart.md)** - Create basic workflows with WorkflowBuilder42- **[kailash-installation](kailash-installation.md)** - Installation and setup guide43- **[kailash-imports](kailash-imports.md)** - Import patterns and module organization4445### Core Patterns4647- **[node-patterns-common](node-patterns-common.md)** - Common node usage patterns48- **[connection-patterns](connection-patterns.md)** - Linking nodes and data flow49- **[param-passing-quick](param-passing-quick.md)** - Parameter passing strategies50- **[runtime-execution](runtime-execution.md)** - Executing workflows (sync/async)51- **[runtime-lifecycle](runtime-lifecycle.md)** - Runtime lifecycle, ref counting, acquire/release, context managers5253### Advanced Topics5455- **[async-workflow-patterns](async-workflow-patterns.md)** - Asynchronous workflow execution56- **[async-resource-safety](async-resource-safety.md)** - `__del__` hardening, double-check locking, pool lifecycle, static analysis guardrails57- **[cycle-workflows-basics](cycle-workflows-basics.md)** - Cyclic workflow patterns58- **[error-handling-patterns](error-handling-patterns.md)** - Error management strategies59- **[switchnode-patterns](switchnode-patterns.md)** - Conditional routing with SwitchNode60- **[pythoncode-best-practices](pythoncode-best-practices.md)** - PythonCode node best practices61- **[mcp-integration-guide](mcp-integration-guide.md)** - Model Context Protocol integration6263## Key Concepts6465### Canonical Node Pattern (4-Parameter)6667**This is the single source of truth for node configuration.** All other skills reference this section.6869```python70workflow.add_node(71 "NodeClassName", # 1. Node type (PascalCase, string)72 "unique_node_id", # 2. Unique ID (snake_case, string)73 { # 3. Configuration dict74 "param1": "value",75 "param2": 12376 },77 connections=[] # 4. Optional: input connections78)79```8081| Parameter | Type | Description | Example |82| ----------- | ---- | ------------------------------------ | ------------------------------- |83| Node type | str | The node class name (PascalCase) | `"LLMNode"`, `"HTTPRequest"` |84| Node ID | str | Unique identifier (snake_case) | `"fetch_data"`, `"process_1"` |85| Config | dict | Node-specific configuration | `{"url": "..."}` |86| Connections | list | Optional input connections (4-tuple) | `[("src", "out", "dst", "in")]` |8788**Connection Methods**:8990```python91# Method 1: add_connection (4-positional params - explicit)92workflow.add_connection("read_file", "content", "transform", "input")9394# Method 2: connect (flexible API with keyword args)95workflow.connect("read_file", "transform", from_output="content", to_input="input")9697# Method 3: connect with mapping (multiple outputs)98workflow.connect("node1", "node2", mapping={"content": "input", "meta": "metadata"})99```100101### WorkflowBuilder Pattern102103- String-based node API: `workflow.add_node("NodeName", "id", {})`104- Always call `.build()` before execution105- Never `workflow.execute(runtime)` - always `runtime.execute(workflow.build())`106107### Runtime Selection108109- **AsyncLocalRuntime**: For Docker/async (async contexts) - async-first, no threading, 10-100x faster110- **LocalRuntime**: For CLI/scripts (sync contexts) - synchronous execution with thread support111- **get_runtime()**: Auto-detection helper that selects appropriate runtime based on context112113Both runtimes return identical structure: `(results, run_id)` tuple.114115### Runtime Architecture116117Both LocalRuntime and AsyncLocalRuntime inherit from BaseRuntime with shared capabilities:118119**BaseRuntime Foundation**:120121- 29 configuration parameters (debug, enable_cycles, conditional_execution, connection_validation, etc.)122- Execution metadata management123- Common initialization and validation modes (strict, warn, off)124125**Shared Mixins**:126127- **CycleExecutionMixin**: Cyclic workflow execution with validation128- **ValidationMixin**: Workflow structure validation (5 methods)129- **ConditionalExecutionMixin**: Conditional execution and branching with SwitchNode support130131**AsyncLocalRuntime-Specific**:132133- WorkflowAnalyzer for optimal execution strategy134- Level-based parallelism for concurrent execution135- Thread pool for sync nodes without blocking136- Semaphore control to prevent resource exhaustion137138## Critical Rules139140- ✅ ALWAYS: `runtime.execute(workflow.build())`141- ✅ String-based nodes: `workflow.add_node("NodeName", "id", {})`142- ✅ 4-parameter connections: `(source_id, source_param, target_id, target_param)`143- ✅ Docker/async: Use AsyncLocalRuntime (mandatory)144- ✅ CLI/Scripts: Use LocalRuntime145- ❌ NEVER: `workflow.execute(runtime)`146- ❌ NEVER: Instance-based nodes147- ❌ NEVER: Use LocalRuntime in Docker (causes hangs)148149## When to Use This Skill150151Use this skill when you need to:152153- Create custom workflows from scratch154- Understand workflow fundamentals155- Learn node patterns and connections156- Set up runtime execution157- Handle errors in workflows158- Implement cyclic or async patterns159- Integrate with MCP160- Get started with Kailash SDK161162## Related Skills163164- **[02-dataflow](../02-dataflow/SKILL.md)** - Database operations framework built on Core SDK165- **[03-nexus](../03-nexus/SKILL.md)** - Multi-channel platform framework built on Core SDK166- **[04-kaizen](../04-kaizen/SKILL.md)** - AI agent framework built on Core SDK167- **[06-cheatsheets](../06-cheatsheets/SKILL.md)** - Quick reference patterns168- **[08-nodes-reference](../08-nodes-reference/SKILL.md)** - Complete node reference169- **[09-workflow-patterns](../09-workflow-patterns/SKILL.md)** - Industry workflow templates170- **[17-gold-standards](../17-gold-standards/SKILL.md)** - Mandatory best practices171172## Support173174For complex workflows or debugging, invoke:175176- `pattern-expert` - Workflow patterns and cyclic debugging177- `testing-specialist` - Test workflow implementations178179---180> Converted and distributed by [TomeVault](https://tomevault.io/claim/integrum-global) — claim your Tome and manage your conversions.181<!-- tomevault:4.0:skill_md:2026-04-13 -->