ToolRegistry
relationalai.agent.cortex.tool
ToolRegistry(tools=None)Registry for RAI tools accessible to a Cortex agent.
Provides a unified interface for tool discovery, verbalization, explanation, and querying over a RAI model.
Examples
Section titled “Examples”>>> registry = ToolRegistry()>>> registry.add(model=model, description="Jaffle shop data")Methods
Section titled “Methods”.add()
Section titled “.add()”ToolRegistry.add( model: Optional[rai.Model] = None, description: Optional[str] = None, verbalizer: Optional[Verbalizer] = None, queries: Optional[Queries] = None, tool: Optional[Tool] = None,) -> ToolRegistryAdd a tool to the registry.
This method supports two calling patterns:
- Provide a
Toolinstance directly via thetoolparameter. - Provide
model+description(createsDefaultToolinternally with optionalverbalizerandqueries).
Parameters:
(modelModel, default:None) - RAI Model instance (required iftoolisNone).
(descriptionstr, default:None) - Human-readable tool description (required iftoolisNone).
(verbalizerVerbalizer, default:None) - Custom verbalizer (only used iftoolisNone).
(queriesQueries, default:None) - Queries provider (only used iftoolisNone).
(toolTool, default:None) - Pre-constructedToolinstance. If provided, other parameters are ignored.
Returns:
ToolRegistry- Self.
Examples:
>>> registry = ToolRegistry()>>> registry.add(model=model, description="Jaffle shop").has_tools()
Section titled “.has_tools()”ToolRegistry.has_tools() -> boolCheck if at least one tool is registered.
Returns:
bool-Trueif one or more tools are registered.
.has_capability()
Section titled “.has_capability()”ToolRegistry.has_capability(capability: Capability) -> boolCheck if any tool in the registry has the specified capability.
Parameters:
(capabilityCapability) - The capability to check for.
Returns:
bool-Trueif any registered tool has the capability.
.tool_has_capability()
Section titled “.tool_has_capability()”ToolRegistry.tool_has_capability(tool_id: int, capability: Capability) -> boolCheck if a specific tool has the specified capability.
Parameters:
(tool_idint) - The numeric tool index to check.
(capabilityCapability) - The capability to check for.
Returns:
bool-Trueif the tool exists and has the capability.
.discover()
Section titled “.discover()”ToolRegistry.discover() -> dictDiscover all registered tools and their metadata.
Returns:
dict- Dictionary with"models"key containing a list of tool metadata including model_id, description, key_concepts, and query info.
.verbalize()
Section titled “.verbalize()”ToolRegistry.verbalize(model_id: int) -> strGet detailed model structure for a specific tool.
Parameters:
(model_idint) - The numeric tool index to verbalize.
Returns:
str- Natural language description of the model structure.
.explain()
Section titled “.explain()”ToolRegistry.explain(model_id: int, concept: str) -> strGet detailed explanation of a concept within a specific tool.
Parameters:
(model_idint) - The numeric tool index containing the concept.
(conceptstr) - The concept name to explain.
Returns:
str- Natural language explanation of the concept.
.query()
Section titled “.query()”ToolRegistry.query(model_id: int, query_dict: dict, limit: int = 1000) -> AnyExecute a query against a specific tool.
Parameters:
(model_idint) - The numeric tool index to query.
(query_dictdict) - Query parameters with"id"and"args"keys.
(limitint, default:1000) - Maximum number of rows to return. Default: 1000.
Returns:
Any- Query results, typically as a pandas DataFrame.
Returned By
Section titled “Returned By”agent > cortex > tool └── ToolRegistry └── add