Skip to main content

Python SDK for the Kailash container-node architecture

Project description

Kailash Python SDK

PyPI version Python versions Downloads Apache 2.0 Code style: black

Enterprise-Grade Workflow Orchestration Platform

Build production-ready applications with zero-config database operations, multi-channel platforms, AI agents, and comprehensive workflow orchestration. From rapid prototyping to enterprise deployment.


Latest Release: v0.12.0

Core SDK v0.12.0 | DataFlow v0.12.0 | Nexus v1.4.0 | Kaizen v1.2.0

What's New

  • Core SDK v0.12.0: Custom node async execution pipeline, Azure cloud integration, TTL-based cache expiration, health check endpoints
  • DataFlow v0.12.0: Auto-wired multi-tenancy with QueryInterceptor, async transaction nodes, debug persistence with SQLite storage
  • Nexus v1.4.0: Improved MCP transport reliability, enhanced middleware pipeline
  • Kaizen v1.2.0: FallbackRouter safety (on_fallback callback, model validation), OrchestrationRuntime replaces AgentTeam, RFC 3161 timestamping, MCP session wiring

Project Architecture

Three-Layer Architecture

Application Frameworks (built ON Core SDK)
  DataFlow  |  Nexus  |  Kaizen
                |
         Core SDK Foundation
  115+ Nodes | Workflows | Runtime | MCP

Project Structure

kailash_python_sdk/
├── src/kailash/          # Core SDK - 115+ nodes, workflows, runtime
├── apps/
│   ├── kailash-dataflow/ # Zero-config database framework (v0.12.0)
│   ├── kailash-nexus/    # Multi-channel platform (v1.4.0)
│   └── kailash-kaizen/   # AI agent framework (v1.2.0)
├── tests/                # 7,800+ core SDK tests
├── sdk-users/            # Complete user documentation
├── docs/                 # API reference (Sphinx)
└── scripts/              # Build and CI scripts

Quick Start

Installation

# Core SDK only
pip install kailash

# Application frameworks
pip install kailash-dataflow  # Zero-config database framework
pip install kailash-nexus     # Multi-channel platform (API + CLI + MCP)
pip install kailash-kaizen    # AI agent framework

Core SDK: Workflow Orchestration

from kailash.workflow.builder import WorkflowBuilder
from kailash.runtime import LocalRuntime

workflow = WorkflowBuilder()
workflow.add_node("PythonCodeNode", "process", {
    "code": "result = {'message': 'Hello from Kailash!'}"
})

runtime = LocalRuntime()
results, run_id = runtime.execute(workflow.build())
print(results["process"]["result"])  # {'message': 'Hello from Kailash!'}

DataFlow: Zero-Config Database Operations

from dataflow import DataFlow

db = DataFlow("sqlite:///app.db")

@db.model
class User:
    id: str
    name: str
    email: str

# Automatic node generation: UserCreateNode, UserReadNode, UserUpdateNode,
# UserDeleteNode, UserListNode, UserCountNode, UserUpsertNode,
# UserBulkCreateNode, UserBulkUpdateNode, UserBulkDeleteNode, UserBulkUpsertNode

Nexus: Multi-Channel Platform

from nexus import Nexus

app = Nexus()

@app.handler("greet", description="Greeting handler")
async def greet(name: str, greeting: str = "Hello") -> dict:
    return {"message": f"{greeting}, {name}!"}

app.start()
# Now available as:
# - REST API: POST /workflows/greet {"name": "World"}
# - CLI: nexus run greet --name World
# - MCP: AI agents can call greet tool

Nexus: Enterprise Auth

import os
from nexus import Nexus
from nexus.auth.plugin import NexusAuthPlugin
from nexus.auth import JWTConfig

auth = NexusAuthPlugin.basic_auth(
    jwt=JWTConfig(secret=os.environ["JWT_SECRET"]),  # >= 32 chars
)
app = Nexus()
app.add_plugin(auth)
app.start()

Kaizen: AI Agents

from kaizen.api import Agent

agent = Agent(model="gpt-4")
result = await agent.run("Analyze this document")

Async Runtime (Docker/FastAPI)

from kailash.runtime import AsyncLocalRuntime

runtime = AsyncLocalRuntime()
results, run_id = await runtime.execute_workflow_async(workflow.build(), inputs={})

Key Features

Core SDK (v0.12.0)

  • 115+ production nodes: AI, API, Code, Data, Database, File, Logic, Monitoring, Transform
  • Runtime parity: LocalRuntime (sync) and AsyncLocalRuntime (async) with identical APIs
  • Cyclic workflows: CycleBuilder API with convergence detection
  • MCP integration: Built-in Model Context Protocol server support
  • Conditional execution: SwitchNode branching and skip patterns

DataFlow (v0.12.0)

  • 11 nodes per model: Automatic CRUD, query, and bulk operation node generation
  • Multi-database: PostgreSQL, MySQL, SQLite with full parity
  • Zero-config: auto_migrate=True works everywhere including Docker/FastAPI
  • ExpressDataFlow: ~23x faster direct CRUD via db.express
  • Enterprise migrations: 8-component migration system with risk assessment

Nexus (v1.4.0)

  • Multi-channel: Single registration deploys to API + CLI + MCP simultaneously
  • Handler support: @app.handler() bypasses PythonCodeNode sandbox restrictions
  • NexusAuthPlugin: JWT, RBAC, SSO (GitHub/Google/Azure), rate limiting, tenant isolation, audit logging
  • Native middleware: app.add_middleware(), app.include_router(), app.add_plugin()
  • Preset system: none, lightweight, standard, saas, enterprise configurations

Kaizen (v1.2.0)

  • Signature-based programming: Declarative AI agent definitions
  • Multi-agent coordination: Supervisor-worker, router, ensemble, pipeline patterns
  • CARE framework: Context, Action, Reasoning, Evidence for structured AI responses
  • EATP trust protocol: Enterprise Agent Trust Protocol for secure multi-agent systems

Testing

Test Suite

# Core SDK unit tests (7,800+ tests)
pytest tests/unit/ -m 'not (slow or integration or e2e)' --timeout=1

# Nexus tests (1,500+ tests)
pytest apps/kailash-nexus/tests/ -v

# Runtime parity tests
pytest tests/parity/ -v

# Integration tests (requires Docker for PostgreSQL/Redis)
pytest tests/integration/ --timeout=5

# End-to-end tests
pytest tests/e2e/ --timeout=10

Testing Policy

  • Tier 1 (Unit): Mocking allowed, fast execution
  • Tier 2 (Integration): NO MOCKING - real database, real APIs
  • Tier 3 (E2E): NO MOCKING - real everything

Documentation

For Users

API Reference

Contributing

# Clone and setup
git clone https://github.com/integrum/kailash-python-sdk.git
cd kailash-python-sdk
uv sync

# Run tests
pytest tests/unit/ -m 'not (slow or integration or e2e)' --timeout=1

# Code quality
black .
isort .
ruff check .

See Contributing Guide for details.

License

This project is licensed under the Apache License, Version 2.0. You may use, modify, distribute, and commercialize the software freely, subject to the terms of the license.

See the LICENSE file for the full license text.

The Kailash SDK is the subject of patent applications owned by Integrum Pte. Ltd. See the PATENTS file for details. Under Apache License 2.0, Section 3, each Contributor grants a patent license covering claims necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work, subject to the defensive termination clause in Section 3.


Install from PyPI | Documentation | GitHub

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

kailash-0.12.1.tar.gz (1.6 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

kailash-0.12.1-py3-none-any.whl (1.9 MB view details)

Uploaded Python 3

File details

Details for the file kailash-0.12.1.tar.gz.

File metadata

  • Download URL: kailash-0.12.1.tar.gz
  • Upload date:
  • Size: 1.6 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.9

File hashes

Hashes for kailash-0.12.1.tar.gz
Algorithm Hash digest
SHA256 4956b2162114fb3f1b2f080d49e89be9140312054437fd5a4dd00b04731763a2
MD5 e55783cf67a38a487a78bbdc5955e93d
BLAKE2b-256 89ecfc7ef3ad80972a04db5165e8ac2256a9ebf699d58bc1c40a1b009879e649

See more details on using hashes here.

File details

Details for the file kailash-0.12.1-py3-none-any.whl.

File metadata

  • Download URL: kailash-0.12.1-py3-none-any.whl
  • Upload date:
  • Size: 1.9 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.9

File hashes

Hashes for kailash-0.12.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c9474d0e5d87d82a7336d9b80d5dd3a3dfd52368f92e68f04e6f55085d022120
MD5 cc30f9dc2067a7b30650c9420d7caa0c
BLAKE2b-256 d6bcc903d2cbe04a233f996e80d1c8cc92d5edde3f8f822f5c3c07b91af38261

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page