Ops Agents¶
Register operational agents for autonomous system management with severity-based autonomy gating.
Creating an Ops Agent¶
from agenticapi.ops import OpsAgent, OpsHealthStatus
from agenticapi.types import AutonomyLevel, Severity
class LogAnalyst(OpsAgent):
async def start(self) -> None:
self._running = True
async def stop(self) -> None:
self._running = False
async def check_health(self) -> OpsHealthStatus:
return OpsHealthStatus(healthy=self._running)
agent = LogAnalyst(
name="log-analyst",
autonomy=AutonomyLevel.SUPERVISED,
max_severity=Severity.MEDIUM,
)
app.register_ops_agent(agent)
Lifecycle¶
start()is called when the app startsstop()is called when the app shuts downcheck_health()is called by theGET /healthendpoint — ops agent health is included in the response