Files

48 lines
1.1 KiB
Python

from dataclasses import dataclass
from typing import Awaitable, Callable, Protocol, Sequence
from ..checkmk import Downtime, ServiceState
class CheckmkReader(Protocol):
async def service_status(self, host: str, service: str) -> ServiceState | None: ...
async def host_services(self, host: str) -> list[ServiceState]: ...
async def downtimes(self, host: str | None = None) -> list[Downtime]: ...
async def problems(self) -> list[ServiceState]: ...
class StateChangeLike(Protocol):
ts: int
state: int
StateLog = Callable[[str, str], Sequence[StateChangeLike] | Awaitable[Sequence[StateChangeLike]]]
class ChatModel(Protocol):
async def chat(self, model: str, messages: list[dict], tools: list[dict] | None = None,
options: dict | None = None) -> dict: ...
@dataclass(frozen=True)
class AgentStep:
number: int
tool: str
arguments: dict
result: str
duration: float
error: str | None = None
@dataclass(frozen=True)
class AgentResult:
text: str
steps: tuple[AgentStep, ...] = ()
abort_reason: str | None = None
Recorder = Callable[[AgentStep], object]