Spaces:
Sleeping

agent-iot / harness /tool_base.py
ASown's picture
Consolidate project history under ASown
f368481
Raw History Blame Contribute Delete
740 Bytes
"""Contract every tool implements so the harness/agent can use it uniformly."""
from __future__ import annotations
from dataclasses import dataclass, field
@dataclass
class ToolResult:
ok: bool
summary: str # short human-readable line for the chat UI
data: dict = field(default_factory=dict)
class Tool:
"""A capability/machine plugged into the system.
Subclasses set `name`, `description` (what it does + WHEN to use it — the
router reads this), and implement `run(task)`.
"""
name: str = "tool"
description: str = ""
def run(self, task: str, **ctx) -> ToolResult:
raise NotImplementedError
def __repr__(self) -> str:
return f"<Tool {self.name}>"