Metadata-Version: 2.4
Name: rbek
Version: 0.3.0a3
Summary: Developer façade for governed execution with RBEK
License-Expression: LicenseRef-RBEK-SDK
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: license-file

# RBEK Python SDK

Keep your orchestrator. Govern the execution boundary.

Your framework decides what to do. RBEK decides what may execute.

## Install the Python SDK

```bash
pip install rbek
```

## 60-second quickstart

Start with a simple business rule. This example performs local policy
evaluation only. It does not invoke an external provider and is not
canonical RBEK gate authorization.

```python
from rbek import GovernedAction, Policy

policy = Policy.allow_if("amount <= 100")
action = GovernedAction("purchase", policy=policy)

allowed = action.evaluate(amount=75)
denied = action.evaluate(amount=150)

print(allowed.status)  # ALLOWED
print(denied.status)   # DENIED
```

## Real governed execution

Real governed execution requires the RBEK CLI.

The Python SDK can evaluate local business policy without the CLI, but provider execution crosses the RBEK CLI boundary.

Install the CLI:

```bash
curl -fsSL https://releases.rbekplatform.com/cli/stable/install.sh | bash
```

Then bind a governed capability:

```python
from rbek import CLIExecutionBinding, GovernedAction, Policy

policy = Policy.allow_if(
    "latitude >= -90 and latitude <= 90"
)

binding = CLIExecutionBinding(
    provider="open-meteo",
    capability="weather.current",
)

action = GovernedAction(
    "weather",
    policy=policy,
    binding=binding,
)

result = action.execute(
    latitude=32.66,
    longitude=-16.92,
)

print(result.status)
```

If the CLI cannot be found, the SDK fails closed with
`RBEKCLIUnavailable` and shows the official installer command.

Advanced installations may provide `cli_path=` explicitly.

---

# RBEK Python SDK candidate

RBEK is the governed execution layer for AI agents, workflows and software.

Your framework or application decides what it wants to do. RBEK decides what may execute at the governed execution boundary.

## 60-second governed action

```python
from rbek import CLIExecutionBinding, GovernedAction, Policy

weather = GovernedAction(
    name="weather.current",
    policy=Policy.allow_if(
        "latitude <= 90",
        deny_reason="Latitude outside business policy",
    ),
    binding=CLIExecutionBinding(
        provider="open-meteo",
    ),
)

result = weather.execute(
    latitude=32.66,
    longitude=-16.92,
)

print(result.status)
print(result.executed)
print(result.output)
```

The public Python layer stays small:

- `Policy`
- `GovernedAction`
- `GovernedResult`
- `CLIExecutionBinding`

`CLIExecutionBinding` sends a versioned declarative JSON request to:

```text
rbek-cli developer execute
```

The developer does not manage project roots, provider registration files, plans, gates or evidence paths for this managed execution path.

## Two different policy roles

`Policy.allow_if(...)` is a deterministic pre-execution business policy in the Python SDK. If it denies, the execution binding is not called.

It is not claimed to be equivalent to the canonical RBEK runtime gate policy.

After the SDK business policy allows an action, RBEK CLI remains the execution authority and the private runtime materializes the governed execution inputs before the canonical gate and provider execution.

## Framework-agnostic integration

Keep your orchestrator. Govern the execution boundary.

The same `GovernedAction` pattern can be called from plain Python or wrapped by an agent/workflow framework. Framework-specific examples are reference integrations; they do not move orchestration authority into RBEK.

## Publication status

This source tree is the release candidate for `rbek 0.3.0a3`.

Publication requires a separate certification and explicit authorization.
