Metadata-Version: 2.4
Name: runtimeai
Version: 1.0.0
Summary: RuntimeAI Platform SDK — Govern, secure, and observe AI agents at scale
License: MIT
Project-URL: Homepage, https://runtimeai.io
Project-URL: Documentation, https://docs.runtimeai.io/sdks/python
Project-URL: Repository, https://github.com/runtimeai-dev/runtimeai-enterprise
Project-URL: Issues, https://github.com/runtimeai-dev/runtimeai-enterprise/issues
Keywords: runtimeai,ai-governance,ai-agents,mcp,finops,compliance
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Security
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Typing :: Typed
Requires-Python: >=3.9
Description-Content-Type: text/markdown

# runtimeai

Official Python SDK for the **RuntimeAI Control Plane** — govern, secure, and observe AI agents at scale.

## Installation

```bash
pip install runtimeai
```

## Quick Start

```python
from runtimeai import RuntimeAI

client = RuntimeAI(
    "https://api.rt19.runtimeai.io",
    api_key="your-api-key",
)

# Register an AI agent
agent = client.agents.register(
    name="contract-analyzer",
    type="langchain",
    owner="ml-team@company.com",
    risk_level="medium",
)
print(f"Agent registered: {agent['id']}")

# Discover shadow AI usage
findings = client.discovery.list_findings()
print(f"Found {len(findings.get('findings', []))} shadow AI instances")

# Track costs
client.finops.report_usage(
    agent_id=agent["id"],
    model="gpt-4",
    provider="openai",
    input_tokens=1500,
    output_tokens=800,
    cost_usd=0.045,
)

# Check compliance posture
frameworks = client.compliance.list_frameworks()
for fw in frameworks.get("frameworks", []):
    print(f"{fw['name']}: {fw['compliance_pct']}% compliant")
```

## Authentication

### API Key

```python
client = RuntimeAI(
    "https://api.your-pod.runtimeai.io",
    api_key="your-api-key",  # X-API-Key header
)
```

### JWT Token

```python
client = RuntimeAI(
    "https://api.your-pod.runtimeai.io",
    auth_token="your-jwt-token",  # Authorization: Bearer header
    tenant_id="your-tenant-id",   # X-Tenant-ID header
)
```

## Available Clients

| Client | Methods |
|--------|---------|
| `client.agents` | `register`, `list`, `get`, `update`, `kill_switch`, `get_trust_score`, `heartbeat` |
| `client.discovery` | `list_findings`, `triage_finding`, `list_scanners`, `configure_scanner`, `ingest` |
| `client.finops` | `report_usage`, `get_usage_summary`, `list_budgets`, `set_budget`, `get_cost_attribution` |
| `client.policies` | `list_guardrails`, `create_guardrail`, `list_sod_rules`, `list_conditional_access`, `evaluate` |
| `client.mcp` | `list_tools`, `register_tool`, `invoke_tool`, `list_connections`, `get_topology` |
| `client.compliance` | `list_frameworks`, `list_gaps`, `upload_evidence`, `list_risk_scores` |
| `client.audit` | `list`, `search`, `get` |

## Configuration

| Option | Type | Default | Description |
|--------|------|---------|-------------|
| `api_url` | `str` | — | **Required.** Control Plane API URL |
| `api_key` | `str` | `""` | API key (X-API-Key header) |
| `auth_token` | `str` | `""` | JWT token (Bearer header) |
| `tenant_id` | `str` | `""` | Tenant ID for multi-tenant ops |
| `timeout` | `int` | `30` | HTTP timeout in seconds |
| `max_retries` | `int` | `2` | Max retries on 5xx errors |

## Error Handling

```python
from runtimeai import RuntimeAI, RuntimeAIError

try:
    agent = client.agents.get("nonexistent-id")
except RuntimeAIError as e:
    print(f"API Error: {e.status_code} {e.code} — {e}")
```

## Requirements

- Python >= 3.9
- Zero runtime dependencies (stdlib `urllib` only)

## License

MIT © [RuntimeAI](https://runtimeai.io)
