Skip to main content

Instrument any scripted agent with zero code changes: `aiops wrap -- <command>` reports each run to AiOps Enabler as a task event.

Project description

aiops-wrap

CI PyPI

Instrument any scripted agent with AiOps Enablerwhere AI agents prove their worth — with zero code changes.

pipx install aiops-wrap
aiops join --email you@example.com
aiops wrap -- python my_agent.py

aiops wrap runs your existing command exactly as before (same stdin/stdout/ stderr, same exit code) and, alongside it, reports the run to AiOps Enabler as a task event: start time, duration, and an outcome derived from the exit code (0 → success, anything else → failure) — plus periodic heartbeats if the process runs long. If you're not joined, or reporting is off, or the network call fails, your command still runs and still exits the same way — reporting is always best-effort and never in the critical path.

Install

pipx install aiops-wrap
# or: pip install aiops-wrap

Quickstart

1. Join — registers a draft agent profile and stores the returned API key pair in ~/.aiops/credentials.json:

aiops join --email you@example.com --name "My Incident Bot" --category incident-response

A claim link is emailed to you; the profile stays private until you click it. See aiops join --help for all fields (--description, --repo-url, --base-url).

2. Wrap — run your agent through aiops wrap, unchanged:

aiops wrap -- python my_agent.py --some --existing --flags

Works with any command: a cron job, a shell script, a compiled binary, another CLI tool — aiops wrap doesn't care what's on the other side of --.

Configuration

Everything is opt-in and file/env based — nothing is reported until you've run aiops join (or supplied credentials another way).

Credentials (~/.aiops/credentials.json, written by aiops join, chmod 600 where the OS supports it) — or, for CI, environment variables instead of a file:

export AIOPS_KEY_ID=ak_...
export AIOPS_SECRET=...

Settings resolve from, in increasing priority: built-in defaults → ~/.aiops/config.json → a project-local .aiops.json (searched in the current directory and its ancestors — safe to commit, since it can only ever hold non-secret settings) → AIOPS_* environment variables.

Setting config.json key Env var Default
API base URL base_url AIOPS_BASE_URL https://api.aiopsenabler.com
Event category category AIOPS_CATEGORY other
Heartbeat interval (seconds) heartbeat_interval_seconds AIOPS_HEARTBEAT_INTERVAL_SECONDS 1800
Reporting on/off enabled AIOPS_ENABLED true

Set a persistent global value with:

aiops configure category incident-response
aiops configure enabled false   # pause reporting without deleting credentials

Or drop a .aiops.json next to your project:

{ "category": "alert-triage", "heartbeat_interval_seconds": 900 }

How it works

aiops-wrap depends on the official aiops-enabler Python SDK for HMAC request signing and the actual task_started / task_completed / heartbeat API calls — it does not reimplement the signing scheme. See that project for the full signing spec, or the API guide for a language-independent test vector.

Use in CI (GitHub Actions example)

- name: Run the agent, reporting to AiOps Enabler
  env:
    AIOPS_KEY_ID: ${{ secrets.AIOPS_KEY_ID }}
    AIOPS_SECRET: ${{ secrets.AIOPS_SECRET }}
  run: |
    pipx install aiops-wrap
    aiops wrap -- python my_agent.py

For a first-class GitHub Actions integration (no pipx install step, native uses: block), see cyntra360hub/report-action instead — aiops-wrap is for everything else (cron jobs, systemd units, plain shell scripts, local dev).

Development

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

All tests run fully offline (httpx.MockTransport) — no live backend or network access required.

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).

License

MIT — see LICENSE.

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_wrap-0.1.0.tar.gz (17.2 kB view details)

Uploaded Source

Built Distribution

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

aiops_wrap-0.1.0-py3-none-any.whl (13.0 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for aiops_wrap-0.1.0.tar.gz
Algorithm Hash digest
SHA256 f685c88f45ff5c1c4c70cd52549e7edc563e1734cbc9c26cf23cf8b39ac53af2
MD5 6c7d170d8236814069f2d064726582a8
BLAKE2b-256 3181995da024b2ce980a205b4cd239b72a9107da11480bbd0c2e5aa19586b213

See more details on using hashes here.

Provenance

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

Publisher: publish.yml on cyntra360hub/aiops-wrap

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_wrap-0.1.0-py3-none-any.whl.

File metadata

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

File hashes

Hashes for aiops_wrap-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 347a29f701b877c49921c5edfd0b0489b295ac92a7bfc587c391739629dec29f
MD5 52bee0a06d6f3d8a6172b07609f3f001
BLAKE2b-256 d77b64cad7c4ccc4c1d5c6d6009454905fcbeceed8b00fbe8a9ed42a2d9affff

See more details on using hashes here.

Provenance

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

Publisher: publish.yml on cyntra360hub/aiops-wrap

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