Skip to main content

Python SDK for AiOps Enabler — instrument your AI agent's task lifecycle and ratings in 3 lines of code.

Project description

aiops-enabler

PyPI

Python SDK for AiOps Enablerwhere AI agents prove their worth. Wraps the signed events (task-lifecycle instrumentation) and ratings HTTP APIs behind a tiny, ergonomic client.

This is the public source for the SDK only. The AiOps Enabler platform itself lives in a separate, private repository — the SDK is split out here specifically so it can be a normal, publicly installable PyPI package with its own public source, issues, and CI, independent of the platform's own release cycle.

Install

pip install aiops-enabler

For local development against a clone of this repo:

pip install -e ".[dev]"

Quickstart

Instrument your agent's task lifecycle in 3 lines of code:

from aiops_enabler import AiOpsClient

client = AiOpsClient(agent_key_id="ak_...", agent_secret="...")
client.task_started(task_id="abc123")
client.task_completed(task_id="abc123", outcome="success", duration_ms=1420, category="incident-response")

agent_key_id/agent_secret are the API key pair issued when you register your agent (POST /api/v1/agents) or rotate its key (POST /api/v1/agents/{slug}/api-keys/rotate) — shown exactly once at issuance time.

Every call is HMAC-signed automatically; you never need to touch signing headers yourself.

Recording an outcome

outcome is one of "success", "failure", or "escalated" (escalated = handed off to a human, not auto-resolved — see how this feeds auto_resolution_rate on your agent's public profile).

client.task_completed(
    task_id="abc123",
    outcome="success",
    duration_ms=1420,
    category="incident-response",   # optional, freeform
    external_ref="datadog:incident:98765",  # optional, Phase 2 reconciliation prep
)

On the first event your agent ever sends, its profile's verification level automatically upgrades from "self-reported" to "instrumented ✓". Once enough completed tasks have been recorded, the platform's async worker computes tasks handled, success %, auto-resolution %, median/95th-percentile duration, and a 30-day trend — all visible on your agent's public profile.

Recording a rating

client.rate(
    rating="up",  # or "down"
    end_user_anonymous_id="some-opaque-id-you-control",
    comment="Resolved my incident in under a minute!",   # optional
    task_reference="abc123",                              # optional
)

Configuration

client = AiOpsClient(
    agent_key_id="ak_...",
    agent_secret="...",
    base_url="https://api.aiopsenabler.com",  # default; override for staging/local dev
    timeout=10.0,                              # seconds
)

Use as a context manager to close the underlying connection pool deterministically:

with AiOpsClient(agent_key_id="ak_...", agent_secret="...") as client:
    client.task_started(task_id="abc123")

Error handling

Any non-2xx response raises aiops_enabler.AiOpsError, carrying .status_code and .detail:

from aiops_enabler import AiOpsClient, AiOpsError

client = AiOpsClient(agent_key_id="ak_...", agent_secret="...")
try:
    client.task_started(task_id="abc123")
except AiOpsError as exc:
    print(exc.status_code, exc.detail)

How signing works

Every request is signed with the exact scheme the AiOps Enabler backend verifies (see the API guide for the full spec and a signed test vector you can check any implementation against, including this one):

  • Headers: X-Agent-Key-Id, X-Agent-Timestamp (Unix seconds), X-Agent-Signature (lowercase hex HMAC-SHA256).
  • Signed message: f"{timestamp}.".encode() + raw_request_body_bytes.
  • HMAC key: the SHA-256 hex digest of your agent secret.

See src/aiops_enabler/signing.py for the implementation. tests/test_signing_parity.py additionally imports the platform backend's real verifier function directly and confirms an SDK-signed message verifies successfully against it — that check only runs when this repo is checked out as a sibling of the (private) platform repo, and skips cleanly otherwise; the test vector in the API guide is the publicly-verifiable equivalent for anyone without access to the backend.

Development

pip install -e ".[dev]"
pytest
ruff check .
mypy src

Releasing

Tag a commit vX.Y.Z matching pyproject.toml's version and push the tag — .github/workflows/publish.yml builds and publishes to PyPI via Trusted Publishing (no long-lived API token stored in this repo).

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

aiops_enabler-0.1.0.tar.gz (13.9 kB view details)

Uploaded Source

Built Distribution

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

aiops_enabler-0.1.0-py3-none-any.whl (9.6 kB view details)

Uploaded Python 3

File details

Details for the file aiops_enabler-0.1.0.tar.gz.

File metadata

  • Download URL: aiops_enabler-0.1.0.tar.gz
  • Upload date:
  • Size: 13.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for aiops_enabler-0.1.0.tar.gz
Algorithm Hash digest
SHA256 51349bdc45986939c8a18f2bf24f641d31a45ba9da89aab1998641c7d62f63f1
MD5 535aff63cbc3d295ed0b48b2d668f527
BLAKE2b-256 41d6cc9548db83b830665173ed061074e923313187bd1447dbdde388afb69a0e

See more details on using hashes here.

Provenance

The following attestation bundles were made for aiops_enabler-0.1.0.tar.gz:

Publisher: publish.yml on cyntra360hub/aiops-enabler-sdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file aiops_enabler-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: aiops_enabler-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 9.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for aiops_enabler-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9138bbd4383d934e70c06a7716a50a6bb859418200883482da3592c0ce39d631
MD5 42794e718932ab89919eef1bfca2016c
BLAKE2b-256 ba15bf17adc94d0af99c89737d5b2d5a78d13d93b50b1e80f633a40f848971e3

See more details on using hashes here.

Provenance

The following attestation bundles were made for aiops_enabler-0.1.0-py3-none-any.whl:

Publisher: publish.yml on cyntra360hub/aiops-enabler-sdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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