tooluniverse.agentic_tool moduleΒΆ

class tooluniverse.agentic_tool.AgenticTool(tool_config: Dict[str, Any])[source]ΒΆ

Bases: BaseTool

Generic wrapper around LLM prompting supporting JSON-defined configs with prompts and input arguments.

__init__(tool_config: Dict[str, Any])[source]ΒΆ
_format_prompt(arguments: Dict[str, Any]) str[source]ΒΆ
_get_global_fallback_chain() List[Dict[str, str]][source]ΒΆ

Get the global fallback chain from environment or use default.

_try_api(api_type: str, model_id: str) bool[source]ΒΆ

Try to initialize a specific API and model.

_try_initialize_api()[source]ΒΆ

Try to initialize the primary API, fallback to secondary if configured.

_validate_arguments(arguments: Dict[str, Any])[source]ΒΆ
_validate_model_config()[source]ΒΆ
estimate_token_usage(arguments: Dict[str, Any]) Dict[str, int][source]ΒΆ
get_availability_status() Dict[str, Any][source]ΒΆ

Get detailed availability status of the tool.

get_input_arguments() List[str][source]ΒΆ
get_model_info() Dict[str, Any][source]ΒΆ
get_prompt_preview(arguments: Dict[str, Any]) str[source]ΒΆ
get_prompt_template() str[source]ΒΆ
static has_any_api_keys() bool[source]ΒΆ

Check if any API keys are available across all supported API types.

Returns:

True if at least one API type has all required keys, False otherwise

Return type:

bool

is_available() bool[source]ΒΆ

Check if the tool is available for use.

retry_initialization() bool[source]ΒΆ

Attempt to reinitialize the tool (useful if API keys were updated).

run(arguments: Dict[str, Any]) Dict[str, Any][source]ΒΆ

Execute the tool.

The default BaseTool implementation accepts an optional arguments mapping to align with most concrete tool implementations which expect a dictionary of inputs.

validate_configuration() Dict[str, Any][source]ΒΆ