An abstract method defines an obligation for subclasses: they must provide an implementation before instances can be created. In a tool interface, this enforces a consistent contract for tool metadata and execution. section 2.1.2
Listing 2.3 Defining BaseTool
# llm_agents_from_scratch/base/tool.py #A
from abc import ABC, abstractmethod
from llm_agents_from_scratch.data_structures.tool import (
ToolCall, #B
ToolCallResult, #B
)
class BaseTool(ABC):
"""Base Tool Class."""
@property #C
@abstractmethod
def name(self) -> str:
"""Name of tool."""
@property
@abstractmethod #D
def description(self) -> str:
"""Description of what this tool does."""
@property
@abstractmethod
def parameters_json_schema(self) -> dict[str, Any]:
"""JSON Schema for tool parameters."""
@abstractmethod
def __call__(
self,
tool_call: ToolCall,
*args: Any,
**kwargs: Any,
) -> ToolCallResult:
"""Execute the tool call.""" #EThe BaseTool definition marks three properties and __call__() as abstract, making the required interface explicit. section 2.1.2
A Hailstone tool
Hailstone subclasses BaseTool and implements its name, description, parameter schema, and __call__() method to perform a sequence step. section 2.1.2


