praval.core.tool_registry๏
Tool Registry for Praval Framework.
This module provides a centralized registry for managing tools and their relationships to agents. Tools can be registered, discovered, and assigned to agents dynamically.
Functions
Get the global tool registry instance. |
|
Reset the global tool registry (primarily for testing). |
Classes
|
Wrapper class for a registered tool function. |
|
Metadata for a registered tool. |
Centralized registry for managing tools and their relationships to agents. |
- class praval.core.tool_registry.ToolMetadata(tool_name, owned_by=None, description='', category='general', shared=False, version='1.0.0', author='', tags=<factory>, parameters=<factory>, return_type='Any')[source]๏
Bases:
objectMetadata for a registered tool.
- Parameters:
- __init__(tool_name, owned_by=None, description='', category='general', shared=False, version='1.0.0', author='', tags=<factory>, parameters=<factory>, return_type='Any')๏
- class praval.core.tool_registry.Tool(func, metadata)[source]๏
Bases:
objectWrapper class for a registered tool function.
Provides metadata, validation, and execution capabilities for functions registered as tools in the Praval framework.
- Parameters:
func (Callable)
metadata (ToolMetadata)
- __init__(func, metadata)[source]๏
Initialize a Tool instance.
- Parameters:
func (
Callable) โ The function to wrap as a toolmetadata (
ToolMetadata) โ Metadata describing the tool
- Raises:
ToolError โ If function validation fails
- class praval.core.tool_registry.ToolRegistry[source]๏
Bases:
objectCentralized registry for managing tools and their relationships to agents.
The registry provides functionality to: - Register and retrieve tools - Associate tools with agents - Manage shared tools - Query tools by category - Handle tool lifecycle
- get_tools_for_agent(agent_name)[source]๏
Get all tools available to a specific agent.
This includes: - Tools owned by the agent - Shared tools - Tools explicitly assigned to the agent
- search_tools(name_pattern=None, category=None, owned_by=None, shared_only=False, tags=None)[source]๏
Search for tools based on multiple criteria.