Ctrl AI

Python SDK

Install and use the Ctrl AI Python SDK.

The Python SDK is coming soon. This page documents the planned API.

Installation

pip install ctrlai

Quick Start

from ctrlai import CtrlAI

client = CtrlAI(
    api_key="ctrlai_pk_...",
    base_url="https://app.ctrlai.com",  # or your self-hosted URL
)

# Run an inference query
result = client.inference.query(
    query="What is the credit risk for this applicant?"
)

print(result.response)
print(result.coverage_percent)  # e.g., 83
print(result.trust_summary)     # {"verified": 2, "expert_reviewed": 3, ...}

Available Methods

Inference

# Run a query
client.inference.query(query, domain_id=None, jurisdiction=None)

# Resume a multi-turn session
client.inference.query(session_id=session_id, additional_inputs={...})

# Save a response segment as a unit
client.inference.save_as_unit(segment_text, domain_id)

Units

# List units
client.units.list(status=None, unit_type=None, domain_id=None)

# Get a unit
client.units.get(unit_id)

# Create a unit
client.units.create(name, unit_type, domain_id, **kwargs)

Workflows

# List workflows
client.workflows.list(domain_id=None)

# AI-assisted composition
client.workflows.compose(description, domain_id)

On this page