Metadata-Version: 2.4
Name: okf-agentbus-ops
Version: 0.1.0
Summary: Opinionated SRE ops for AgentBus: edge-triggered health watchdog and SREWatchdogAgent.
Project-URL: Homepage, https://github.com/onicarps/agentbus
Project-URL: Repository, https://github.com/onicarps/agentbus
Project-URL: Documentation, https://github.com/onicarps/agentbus/tree/main/packages/python/agentbus-ops
Author: onicarps
License: MIT
Keywords: agentbus,okf,ops,sre,watchdog
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: System :: Monitoring
Requires-Python: >=3.11
Requires-Dist: click>=8.0
Requires-Dist: okf-agentbus>=0.16.3
Provides-Extra: dev
Requires-Dist: pytest>=8.0; extra == 'dev'
Description-Content-Type: text/markdown

# okf-agentbus-ops

Opinionated **SRE ops** for [AgentBus](https://github.com/onicarps/agentbus): edge-triggered health watchdog as a deterministic Python process (`SREWatchdogAgent`).

| Item | Value |
|------|--------|
| PyPI name | `okf-agentbus-ops` |
| Import | `agentbus_ops` |
| CLI | `agentbus-ops` |
| Core dependency | `okf-agentbus>=0.16.3` |
| Version train | **Independent** of core (`0.1.0` ops vs `0.17.x` core) |

## Why a separate package

Core (`okf-agentbus`) stays pure: routing, metrics, validate-config.  
Opinionated policy (level transitions, cooldown, idempotency, hooks) lives here.

## Install

```bash
pip install okf-agentbus-ops
# or path-install from monorepo during development:
# pip install -e packages/python/agentbus-ops
```

## CLI (parity with bash P2)

```bash
# One-shot edge decision (no publish)
agentbus-ops watchdog --dry-run --json

# Live: publish SRE_STATUS only on healthy↔degraded↔critical edges
agentbus-ops watchdog --json

# Bootstrap seed silent (default); force first publish:
agentbus-ops watchdog --force-bootstrap-publish

# Attach compact metrics line
agentbus-ops watchdog --include-metrics
```

Exit codes match bash:

| Code | Meaning |
|------|---------|
| 0 | silence / successful publish / dry-run decision |
| 1 | usage / config error |
| 2 | publish failed |

Health level is **not** mirrored as process exit (cron stays green on steady degraded).

## Library

```python
from agentbus_ops import SREWatchdogAgent

class MyWatchdog(SREWatchdogAgent):
    def on_critical_alert(self, cur, decision):
        # optional LLM / page — default is no-op
        pass

agent = SREWatchdogAgent(workspace="/path/to/okf")
decision = agent.run_once(dry_run=True)
print(decision.action, decision.level)
```

## Probe (v0.1 MVP)

v0.1 **wraps** the coordination-root bash probe:

`scripts/swarm_health_check.sh --json`

Pure-Python probe port is deferred. Edge policy, state file, and publish path are native Python and share `.agentbus/sre_last_state.json` with the bash strangler so cron can switch without dual state.

## State file

Same contract as [sre-edge-triggered](https://github.com/onicarps/agentbus) runbook:

`.agentbus/sre_last_state.json` under `AGENTBUS_WORKSPACE`.

## Not in scope (v0.1)

- Autonomous restart daemon
- Default-on LLM every tick
- TypeScript package

## License

MIT
