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/FastAPI) 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"})
runtime = LocalRuntime()
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)
Advanced Topics
- async-workflow-patterns - Asynchronous workflow execution
- 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
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/FastAPI (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/FastAPI: 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
sdk-navigator - Find specific nodes or patterns
testing-specialist - Test workflow implementations
1---2name: core-sdk3description: Kailash Core SDK fundamentals including workflow creation, node patterns, connections, runtime execution, parameter passing, error handling, cyclic workflows, async patterns, MCP integration, and installation. Use when asking about 'workflow basics', 'core sdk', 'create workflow', 'workflow builder', 'node patterns', 'connections', 'runtime', 'parameters', 'imports', 'installation', 'getting started', 'workflow execution', 'async workflows', 'error handling', 'cyclic workflows', 'PythonCode node', 'SwitchNode', or 'MCP integration'.4---5
6# Kailash Core SDK - Foundational Skills
7
8Comprehensive guide to Kailash Core SDK fundamentals for workflow automation and integration.
9
10## Features
11
12The Core SDK provides the foundational building blocks for creating custom workflows with fine-grained control:
13
14- **110+ Workflow Nodes**: Pre-built nodes for AI, API, database, file operations, logic, and more
15- **WorkflowBuilder API**: String-based workflow construction with type safety
16- **Dual Runtime Support**: AsyncLocalRuntime (Docker/FastAPI) and LocalRuntime (CLI/scripts)
17- **Advanced Patterns**: Cyclic workflows, conditional execution, error handling
18- **MCP Integration**: Built-in Model Context Protocol support
19- **Parameter Passing**: Flexible data flow between nodes
20- **Zero Configuration**: Auto-detection of runtime context
21- **Production Ready**: Enterprise features including monitoring, validation, and debugging
22
23## Quick Start
24
25```python
26from kailash.workflow.builder import WorkflowBuilder
27from kailash.runtime.local import LocalRuntime
28
29workflow = WorkflowBuilder()
30workflow.add_node("NodeName", "id", {"param": "value"})
31runtime = LocalRuntime()
32results, run_id = runtime.execute(workflow.build())
33```
34
35## Reference Documentation
36
37### Getting Started
38- **[workflow-quickstart](workflow-quickstart.md)** - Create basic workflows with WorkflowBuilder
39- **[kailash-installation](kailash-installation.md)** - Installation and setup guide
40- **[kailash-imports](kailash-imports.md)** - Import patterns and module organization
41
42### Core Patterns
43- **[node-patterns-common](node-patterns-common.md)** - Common node usage patterns
44- **[connection-patterns](connection-patterns.md)** - Linking nodes and data flow
45- **[param-passing-quick](param-passing-quick.md)** - Parameter passing strategies
46- **[runtime-execution](runtime-execution.md)** - Executing workflows (sync/async)
47
48### Advanced Topics
49- **[async-workflow-patterns](async-workflow-patterns.md)** - Asynchronous workflow execution
50- **[cycle-workflows-basics](cycle-workflows-basics.md)** - Cyclic workflow patterns
51- **[error-handling-patterns](error-handling-patterns.md)** - Error management strategies
52- **[switchnode-patterns](switchnode-patterns.md)** - Conditional routing with SwitchNode
53- **[pythoncode-best-practices](pythoncode-best-practices.md)** - PythonCode node best practices
54- **[mcp-integration-guide](mcp-integration-guide.md)** - Model Context Protocol integration
55
56## Key Concepts
57
58### WorkflowBuilder Pattern
59- String-based node API: `workflow.add_node("NodeName", "id", {})`
60- Always call `.build()` before execution
61- Never `workflow.execute(runtime)` - always `runtime.execute(workflow.build())`
62
63### Runtime Selection
64- **AsyncLocalRuntime**: For Docker/FastAPI (async contexts) - async-first, no threading, 10-100x faster
65- **LocalRuntime**: For CLI/scripts (sync contexts) - synchronous execution with thread support
66- **get_runtime()**: Auto-detection helper that selects appropriate runtime based on context
67
68Both runtimes return identical structure: `(results, run_id)` tuple.
69
70### Runtime Architecture
71Both LocalRuntime and AsyncLocalRuntime inherit from BaseRuntime with shared capabilities:
72
73**BaseRuntime Foundation**:
74- 29 configuration parameters (debug, enable_cycles, conditional_execution, connection_validation, etc.)
75- Execution metadata management
76- Common initialization and validation modes (strict, warn, off)
77
78**Shared Mixins**:
79- **CycleExecutionMixin**: Cyclic workflow execution with validation
80- **ValidationMixin**: Workflow structure validation (5 methods)
81- **ConditionalExecutionMixin**: Conditional execution and branching with SwitchNode support
82
83**AsyncLocalRuntime-Specific**:
84- WorkflowAnalyzer for optimal execution strategy
85- Level-based parallelism for concurrent execution
86- Thread pool for sync nodes without blocking
87- Semaphore control to prevent resource exhaustion
88
89## Critical Rules
90
91- ✅ ALWAYS: `runtime.execute(workflow.build())`
92- ✅ String-based nodes: `workflow.add_node("NodeName", "id", {})`
93- ✅ 4-parameter connections: `(source_id, source_param, target_id, target_param)`
94- ✅ Docker/FastAPI: Use AsyncLocalRuntime (mandatory)
95- ✅ CLI/Scripts: Use LocalRuntime
96- ❌ NEVER: `workflow.execute(runtime)`
97- ❌ NEVER: Instance-based nodes
98- ❌ NEVER: Use LocalRuntime in Docker (causes hangs)
99
100## When to Use This Skill
101
102Use this skill when you need to:
103- Create custom workflows from scratch
104- Understand workflow fundamentals
105- Learn node patterns and connections
106- Set up runtime execution
107- Handle errors in workflows
108- Implement cyclic or async patterns
109- Integrate with MCP
110- Get started with Kailash SDK
111
112## Related Skills
113
114- **[02-dataflow](../02-dataflow/SKILL.md)** - Database operations framework built on Core SDK
115- **[03-nexus](../03-nexus/SKILL.md)** - Multi-channel platform framework built on Core SDK
116- **[04-kaizen](../04-kaizen/SKILL.md)** - AI agent framework built on Core SDK
117- **[06-cheatsheets](../06-cheatsheets/SKILL.md)** - Quick reference patterns
118- **[08-nodes-reference](../08-nodes-reference/SKILL.md)** - Complete node reference
119- **[09-workflow-patterns](../09-workflow-patterns/SKILL.md)** - Industry workflow templates
120- **[17-gold-standards](../17-gold-standards/SKILL.md)** - Mandatory best practices
121
122## Support
123
124For complex workflows or debugging, invoke:
125- `pattern-expert` - Workflow patterns and cyclic debugging
126- `sdk-navigator` - Find specific nodes or patterns
127- `testing-specialist` - Test workflow implementations