Metadata-Version: 2.4
Name: kailash-enterprise
Version: 4.7.0
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Rust
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Typing :: Typed
Classifier: License :: Other/Proprietary License
Requires-Dist: multidict>=6.0
Requires-Dist: pytest>=8.0 ; extra == 'dev'
Requires-Dist: pytest-asyncio>=0.23 ; extra == 'dev'
Requires-Dist: pyjwt>=2.8 ; extra == 'dev'
Requires-Dist: httpx>=0.27 ; extra == 'dev'
Requires-Dist: starlette>=0.37 ; extra == 'dev'
Requires-Dist: pytest-httpserver>=1.0 ; extra == 'dev'
Requires-Dist: pydantic>=2.0 ; extra == 'dev'
Requires-Dist: numpy>=2.0 ; extra == 'ml'
Provides-Extra: dev
Provides-Extra: ml
Summary: Kailash Enterprise — high-performance Rust-powered workflow engine, drop-in replacement for kailash
Keywords: workflow,orchestration,ai,agents,rust
License: Proprietary
Requires-Python: >=3.10
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM

# Kailash Enterprise

High-performance Rust-powered workflow engine — a drop-in replacement for the [`kailash`](https://pypi.org/project/kailash/) Python SDK.

## Installation

```bash
pip install kailash-enterprise
```

Replaces `pip install kailash`. Existing code works without changes.

## Usage

```python
# Existing kailash code — no changes needed
from kailash.runtime import LocalRuntime
from kailash.workflow.builder import WorkflowBuilder

builder = WorkflowBuilder()
builder.add_node("NoOpNode", "step1")
workflow = builder.build()

runtime = LocalRuntime()
results, run_id = runtime.execute(workflow)
```

## Why Enterprise?

- **22–261x faster** execution via compiled Rust engine
- **100–300x less memory** than the pure Python SDK
- **Same API** — zero migration effort
- **Binary-only** — source code stays protected

## Compatibility

Full backward compatibility with `kailash` v0.12. The legacy API emits deprecation warnings to guide migration to the new v2 API.

**New v2 API:**

```python
import kailash

reg = kailash.NodeRegistry()
builder = kailash.WorkflowBuilder()
builder.add_node("NoOpNode", "step1")
workflow = builder.build(reg)

runtime = kailash.Runtime(reg)
result = runtime.execute(workflow)
# result["results"], result["run_id"], result["metadata"]
```

## Domain event bus (`kailash.events`)

A pluggable publish/subscribe event bus for cross-service domain events,
with structured envelopes (correlation/causation tracking, schema
version, JSON payload). Distinct from `kailash.EventBus` (which is the
Nexus lifecycle broadcast bus and is unchanged).

```python
from kailash.events import EventBus, DomainEvent

bus = EventBus()
received = []
bus.subscribe("orders", lambda e: received.append(e))

event = DomainEvent(
    "order.created", "orders", "checkout-service", {"order_id": 42}
).with_correlation("44444444-4444-4444-8444-444444444444")
bus.publish(event)

time.sleep(0.05)
```

Each subscriber receives a `dict` with the event's fields (`id`,
`event_type`, `topic`, `actor`, `schema_version`, `correlation_id`,
`causation_id`, `timestamp`, `payload`, `metadata`).

### Choosing an event-bus backend

`kailash.events` ships two backends. They are **not** unified — the
choice is a deployment-topology decision, not a convenience toggle:

| Backend            | Delivery scope            | Durability     | When to use                                                                 |
| ------------------ | ------------------------- | -------------- | --------------------------------------------------------------------------- |
| `InMemoryEventBus` | Same Python process ONLY  | None           | Dev / test / single-process. `EventBus` is an alias for this.               |
| `NatsEventBus`     | Cross-process, cross-host | At-least-once  | Multi-process / multi-service production (requires a NATS JetStream broker). |

Cross-process divergence is deliberate and **silent if mis-chosen**: a
subscriber registered in one process on `InMemoryEventBus` will NEVER see
events published from a different process — that is a no-delivery, not a
degraded delivery. Pick `NatsEventBus` whenever publisher and subscriber
are not the same OS process:

```python
import os
from kailash.events import NatsEventBus, DomainEvent

# URL threaded in explicitly — the binding never reads the environment
# itself. TLS is required by default; allow_plaintext=True is only for a
# localhost test broker.
bus = NatsEventBus(os.environ["KAILASH_NATS_URL"])
bus.subscribe("kailash.events.acme.orders.created", lambda e: ...)
bus.publish(
    DomainEvent("order.created", "kailash.events.acme.orders.created",
                "checkout-service", {"order_id": 42})
)
bus.shutdown()
```

`NatsEventBus` delivers at-least-once via JetStream durable consumers;
subjects MUST live under `kailash.events.<tenant>.<domain>.<event>` (the
broker's stream captures that subtree for tenant-isolated routing).

