Tool API

Setting Up Tool Layer

def add_tool_layer(self, config: ToolLayer) -> 'Cerebrum':
    """Set up the tool manager component."""
    result = self._post("/core/tool/setup", asdict(config))
    self._components_initialized.add("tool")
    self.results['tool'] = result
    return self

The /core/tool/setup endpoint processes tool configurations in the kernel, the ToolLayer object is structured as below.

@dataclass
class ToolLayer:
    allowed_tools: Optional[List[str]] = None     # List of permitted tools
    custom_tools: Optional[Dict[str, Any]] = None # Custom tool definitions

Tool Queries

class ToolQuery(BaseModel):
    tool_calls: List[Dict[str, Union[str, Any]]]  # Tool execution requests

    class Config:
        arbitrary_types_allowed = True  # Enables complex type usage

Last updated