Skip to main content

RuntimeAI Platform SDK — Govern, secure, and observe AI agents at scale

Project description

runtimeai

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

Installation

pip install runtimeai

Quick Start

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

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

JWT Token

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

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

Project details


Download files

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

Source Distribution

runtimeai-1.0.0.tar.gz (10.0 kB view details)

Uploaded Source

Built Distribution

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

runtimeai-1.0.0-py3-none-any.whl (12.7 kB view details)

Uploaded Python 3

File details

Details for the file runtimeai-1.0.0.tar.gz.

File metadata

  • Download URL: runtimeai-1.0.0.tar.gz
  • Upload date:
  • Size: 10.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for runtimeai-1.0.0.tar.gz
Algorithm Hash digest
SHA256 70b6087a0cb795f7eb07879cc92af27179cd4d434a18fb8504fdc6ac9b499518
MD5 e4a38b2a2bb9e7df1a1533e71762cca9
BLAKE2b-256 48c8c9cb0774c67ebeb9d38c000edc87393c24894a5e1cab30898d0722631a34

See more details on using hashes here.

File details

Details for the file runtimeai-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: runtimeai-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 12.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for runtimeai-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8a4b8038b6884b1bb6a1ffc4cbf5d8bba836b01044aeac9a4af1b6110de5aca5
MD5 784602a512c2dcd39d11ab79f314334e
BLAKE2b-256 0faed11d56bd98311a33f25549fcae97a9f1cf4160610198034d557a354597a5

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