Skip to main content

constitutional-aiops (Python)

Official Python client for the Constitutional AIOps REST API. Two layers ship together: a hand-written ergonomic client (AIOpsClient, standard library only) and an optional generated typed core (constitutional_aiops_client, full type safety over every endpoint) that rides on httpx + attrs. See the SDK overview for the full status.

Install

pip install constitutional-aiops            # ergonomic client only, zero dependencies
pip install "constitutional-aiops[typed]"   # also install the generated typed core

Or from a source checkout (development):

pip install -e sdk/python
pip install -e "sdk/python[typed]"

Use — ergonomic client

from constitutional_aiops import AIOpsClient, ConstitutionalRefusal

client = AIOpsClient("https://your-instance.example.com", token="aiops_pat_...")

# List every critical incident (pagination handled for you).
for incident in client.paginate("/incidents/", severity="critical"):
    print(incident["id"], incident["title"])

# Read one incident and its root-cause analysis.
inc = client.get_incident("INC-2026-0007")
print(inc.get("rca", {}).get("root_cause"))

# Approve a pending action. This still passes the constitutional gate.
try:
    client.approve_action("act-123", approved=True, approved_by="me")
except ConstitutionalRefusal as refusal:
    print("gate held the action:", refusal.error_code)

# Stream a chat turn.
result = client.stream_chat("why is nextcloud slow?", on_delta=lambda t: print(t, end=""))
print("\n", result.get("message", {}).get("content"))

Use — typed core

With the typed extra installed, every path, parameter, request body and response is typed from the API's OpenAPI schema.

from constitutional_aiops_client import AuthenticatedClient
from constitutional_aiops_client.api.incidents import incidents_get_incident

client = AuthenticatedClient(
    base_url="https://your-instance.example.com", token="aiops_pat_..."
)
incident = incidents_get_incident.sync(incident_id="INC-2026-0007", client=client)
print(incident.id, incident.severity)

Regenerating the typed core

constitutional_aiops_client/ is generated from the committed API snapshot (openapi/openapi.json) by openapi-python-client. It is committed so the package installs offline; regenerate it whenever the snapshot changes:

pip install "openapi-python-client==0.29.1"
bash sdk/python/scripts/generate.sh

Auth

Create a personal access token in the app (Settings, or POST /api/v1/auth/tokens) and pass it as token=; it is sent as Authorization: Bearer aiops_pat_... and resolves to your user even when AUTH_REQUIRED is off, so calls are attributed and cost-fenced. Against a single-user instance with AUTH_REQUIRED unset the token is optional.

License

AGPL-3.0-or-later, matching the app.

Metadata

Release files for constitutional-aiops 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for constitutional-aiops 0.1.1
File Size Uploaded
constitutional_aiops-0.1.1.tar.gz 113.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for constitutional-aiops 0.1.1
File Interpreter ABI Platform
constitutional_aiops-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 517.1 kB

Release files / constitutional_aiops-0.1.1.tar.gz

Download URL constitutional_aiops-0.1.1.tar.gz
Size 113.9 kB
Tags Source
SHA-256 checksum
How to use checksums
90654ab24c86b1dc8dd43d9c9724dac292c148eac7f175980a1ce26b4354c733
BLAKE2b-256 checksum
How to use checksums
e51182c11a7a0a63f26ebb709e06a19089a0bb9ee2beab0f90af6c04aa06fe15
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 14, 2026.

Transparency log

Release files / constitutional_aiops-0.1.1-py3-none-any.whl

Download URL constitutional_aiops-0.1.1-py3-none-any.whl
Size 403.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d492ccf14f158daac1cd71fb64fef9a3d0fe96bf805a91e211cfe9483b55d008
BLAKE2b-256 checksum
How to use checksums
75425f2f261b76e58200afec770f2cb42a72c649be02f309e88e311fdf660c02
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 14, 2026.

Transparency log

Release history Release notifications | RSS feed

0.3.0

2 release files

0.2.0

2 release files

This release

0.1.1 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page