Metadata-Version: 2.4
Name: rcabench
Version: 1.3.3
Summary: RCABench - A comprehensive root cause analysis benchmarking platform for microservices
Author: Lincyaw, rainystevn1, YifanYang6
Author-email: Lincyaw <814750204@qq.com>, rainystevn1 <rainystevn1@gmail.com>, YifanYang6 <yifanyang6@link.cuhk.edu.cn>
License-Expression: Apache-2.0
Requires-Dist: setuptools>=75.6.0
Requires-Dist: tqdm>=4.67.1
Requires-Dist: twine>=5.1.1
Requires-Dist: wheel>=0.45.1
Requires-Dist: urllib3>=2.2.3,<3.0.0
Requires-Dist: python-dateutil>=2.9.0.post0
Requires-Dist: typing-extensions>=4.12.2
Requires-Dist: lazy-imports>=1.0.1
Requires-Dist: sseclient-py>=1.8.0
Requires-Dist: pydantic>=2.12.3
Requires-Dist: uv>=0.9.10
Requires-Python: >=3.10
Project-URL: Pypi, https://pypi.org/project/rcabench/
Project-URL: Repository, https://github.com/OperationsPAI/aegislab
Description-Content-Type: text/markdown

# RCABench Python SDK

The SDK exposes two handwritten entry clients on top of the generated OpenAPI package:

- `RCABenchClient`: public/business API client authenticated by `Key ID` + `Key Secret`
- `RCABenchRuntimeClient`: runtime-only client authenticated by service token

Generated OpenAPI code lives under `src/rcabench/openapi`. Handwritten auth/session logic lives under `src/rcabench/client`.

## Installation

```bash
pip install rcabench
```

For local development:

```bash
cd sdk/python
pip install -e .
```

## Authentication Model

Secrets are never passed directly in code. The SDK reads credentials from environment variables only.

### Public Client

Required environment variables:

```bash
export RCABENCH_BASE_URL="http://localhost:8082"
export RCABENCH_KEY_ID="pk_xxx"
export RCABENCH_KEY_SECRET="sk_xxx"
```

`RCABenchClient` exchanges the key pair for a bearer token through the API-key token endpoint, then reuses the authenticated OpenAPI client.

### Runtime Client

Required environment variables:

```bash
export RCABENCH_BASE_URL="http://localhost:8082"
export RCABENCH_SERVICE_TOKEN="runtime_token_xxx"
```

`RCABenchRuntimeClient` is intended for managed runtime/wrapper usage. It injects the service token into the generated OpenAPI client directly.

## Usage

### Public API Client

```python
from rcabench import RCABenchClient
from rcabench.openapi.api.datasets_api import DatasetsApi

client = RCABenchClient()
api = DatasetsApi(client.get_client())

datasets = api.list_sdk_dataset_samples(page=1, size=10)
print(datasets)
```

You may still override `base_url` in code when needed:

```python
client = RCABenchClient(base_url="http://localhost:8082")
```

### Runtime API Client

```python
from rcabench import RCABenchRuntimeClient

runtime_client = RCABenchRuntimeClient()
api_client = runtime_client.get_client()

print(api_client.configuration.host)
```

`RCABenchRuntimeClient` stays as a thin authenticated connector only. Runtime upload/report timing and orchestration semantics belong in the external managed wrapper layer, not in this SDK client.

## Development

Run type checking only on handwritten SDK code:

```bash
cd sdk/python
uv run --with pyright pyright src/rcabench/client
```

The generated package under `src/rcabench/openapi` is excluded from Pyright.
