File size: 914 Bytes
9419f40
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
from abc import ABC, abstractmethod
from typing import List, Dict, Any

class BaseTool(ABC):
    """
    The universal contract for any capability.
    Enforces structure so the Agent Loader can handle any tool automatically.
    """

    @property
    @abstractmethod
    def name(self) -> str:
        """Unique identifier (e.g., 'get_stock_price')."""
        pass

    @property
    @abstractmethod
    def description(self) -> str:
        """Natural language instruction for the LLM."""
        pass

    @property
    @abstractmethod
    def categories(self) -> List[str]:
        """Tags for the Registry (e.g., ['finance', 'public_api'])."""
        pass

    @abstractmethod
    def get_schema(self) -> Dict[str, Any]:
        """Returns the JSON schema for LLM function calling."""
        pass

    @abstractmethod
    def run(self, **kwargs) -> Any:
        """Executes the tool logic."""
        pass