Tool
Abstract base class for RAI-powered tools that can be used by Cortex agents.
A Tool provides semantic data exploration capabilities through a consistent interface:
- Discovery: What models and concepts are available?
- Verbalization: Detailed model structure and relationships
- Explanation: Business rules and semantics for specific concepts
- Querying: Execute structured queries against the data model
Implement this interface to create custom tools, or use DefaultTool for
standard RAI model-based tools.
Methods
Section titled “Methods”.description()
Section titled “.description()”Tool.description() -> strReturn a human-readable description of this tool’s purpose.
Returns:
str- A description of the tool.
.concepts()
Section titled “.concepts()”Tool.concepts() -> List[str]Return list of key concept names available in this tool’s domain.
Returns:
list of str- Concept names available in this tool.
.verbalize()
Section titled “.verbalize()”Tool.verbalize() -> strReturn detailed structure and relationships for the entire model.
Returns:
str- A natural language description of the model structure.
.explain()
Section titled “.explain()”Tool.explain(concept: str) -> strReturn detailed explanation of business rules for a specific concept.
Parameters:
(conceptstr) - The name of the concept to explain.
Returns:
str- A natural language explanation of the concept.
.queries()
Section titled “.queries()”Tool.queries() -> dictReturn available pre-defined queries.
If queries capability is not configured, returns a message explaining that no queries are available.
Returns:
dict- Dict with"queries"and"query_instructions"if configured, or a dict with"message"explaining queries are not available.
.query()
Section titled “.query()”Tool.query(params: dict) -> Union[rai.Fragment, pandas.DataFrame]Execute a query against this tool’s model and return results.
Parameters:
(paramsdict) - Query parameters including"id"(query identifier) and"args"(query arguments).
Returns:
relationalai.semantics.Fragment or pandas.DataFrame- Query results.
Raises:
ValueError- If queries capability is not configured.KeyError- If query ID is not found.
Inheritance Hierarchy
Section titled “Inheritance Hierarchy”Subclassed By
Section titled “Subclassed By”agent > cortex > tool └── DefaultTool
Used By
Section titled “Used By”agent > cortex > tool └── ToolRegistry └── add