Tool Registry and Management¶
For comprehensive documentation on the Tool Registry system, including architecture, usage patterns, and advanced features, see the Tools API Reference.
This page provides a summary of key concepts and links to detailed documentation.
Key Concepts¶
Tool Registry Architecture¶
- Centralized Management: Single registry for all tool operations
- Dynamic Discovery: Runtime tool registration and discovery
- Type Safety: Strong typing with Pydantic validation
- Performance Monitoring: Execution metrics and optimization
Tool Categories¶
DeepCritical organizes tools into logical categories for better organization and discovery:
- Knowledge Query: Information retrieval and search (API Reference)
- Sequence Analysis: Bioinformatics sequence processing (API Reference)
- Structure Prediction: Protein structure modeling (API Reference)
- Molecular Docking: Drug-target interaction analysis (API Reference)
- De Novo Design: Novel molecule generation (API Reference)
- Function Prediction: Biological function annotation (API Reference)
- RAG: Retrieval-augmented generation (API Reference)
- Search: Web and document search (API Reference)
- Analytics: Data analysis and visualization (API Reference)
- Code Execution: Code execution and sandboxing (API Reference)
Getting Started¶
Basic Usage¶
from deepresearch.src.utils.tool_registry import ToolRegistry
# Get the global registry
registry = ToolRegistry.get_instance()
# List available tools
tools = registry.list_tools()
print(f"Available tools: {list(tools.keys())}")
Tool Execution¶
# Execute a tool
result = registry.execute_tool("web_search", {
"query": "machine learning",
"num_results": 5
})
if result.success:
print(f"Results: {result.data}")
Advanced Features¶
Tool Registration¶
from deepresearch.tools import ToolRunner, ToolSpec, ToolCategory
class MyTool(ToolRunner):
def __init__(self):
super().__init__(ToolSpec(
name="my_tool",
description="Custom analysis tool",
category=ToolCategory.ANALYTICS,
inputs={"data": "dict"},
outputs={"result": "dict"}
))
# Register the tool
registry.register_tool(MyTool().get_spec(), MyTool())
Performance Monitoring¶
# Get tool performance metrics
metrics = registry.get_tool_metrics("web_search")
print(f"Average execution time: {metrics.avg_execution_time}s")
print(f"Success rate: {metrics.success_rate}")
Integration¶
With Agents¶
Tools are automatically available to agents through the registry system. See the Agents API for details on agent-tool integration.
With Workflows¶
Tools integrate seamlessly with the workflow system for complex multi-step operations. See the Code Execution Flow for workflow integration examples.
Best Practices¶
- Use Appropriate Categories: Choose the correct tool category for proper organization
- Handle Errors: Implement proper error handling in custom tools
- Performance Monitoring: Monitor tool performance and optimize as needed
- Documentation: Provide clear tool specifications and usage examples
- Testing: Thoroughly test tools before deployment
Related Documentation¶
- Tools API Reference: Complete API documentation
- Tool Development Guide: Creating custom tools
- Agents API: Agent integration patterns
- Code Execution Flow: Workflow integration