Skip to content

Implement Comprehensive Tooling System #17

@stephen-cox

Description

@stephen-cox

Overview

Implement a comprehensive tooling system that enables Nova to interact with external tools and APIs, extending its capabilities beyond text generation to include file operations, command execution, and custom integrations.

Key Features

Core Architecture

  • Provider Agnostic: Support both OpenAI function calling and Anthropic tool use APIs
  • Plugin-Style Architecture: Modular design using Nova's existing structure
  • Configuration-Driven: YAML config for enabling/disabling tools
  • Safety First: Configurable execution with validation and confirmation

Built-in Tools

  • File Operations: read_file, write_file, list_directory, create_directory
  • System Operations: run_command, get_environment, network_request
  • Text Processing: search_files, extract_text

Configuration Example

tools:
  enabled: true
  enabled_tools:
    - "read_file"
    - "write_file"
    - "run_command"
  auto_execute: false
  max_tool_calls_per_turn: 3
  sandbox_mode: true

Implementation Phases

Phase 1: Core Infrastructure

  • Create tool models and base classes (nova/models/tools.py)
  • Implement tool registry and manager (nova/core/tools.py)
  • Add configuration support (nova/models/config.py)
  • Basic tool validation and execution framework

Phase 2: Built-in Tools

  • File operation tools (nova/tools/file_tools.py)
  • System command execution tool (nova/tools/system_tools.py)
  • Network request tool (nova/tools/network_tools.py)
  • Text search and processing tools (nova/tools/text_tools.py)

Phase 3: AI Integration

  • Extend OpenAI client for function calling
  • Extend Anthropic client for tool use
  • Implement tool calling workflow in chat manager
  • Add tool execution feedback to chat interface

Phase 4: Advanced Features

  • Tool chaining and orchestration
  • Custom tool plugin system
  • Sandbox mode for safe execution
  • Tool result caching and optimization

Phase 5: Documentation and Testing

  • Comprehensive tool documentation
  • Usage examples and tutorials
  • Security guidelines
  • Performance testing and optimization

Technical Details

Tool Interface

class BaseTool(ABC):
    @property
    @abstractmethod
    def definition(self) -> ToolDefinition:
        pass
    
    @abstractmethod
    async def execute(self, **kwargs) -> ToolResult:
        pass

AI Client Integration

async def generate_response_with_tools(
    self, 
    messages: List[dict], 
    tools: List[dict] = None,
    **kwargs
) -> tuple[str, List[dict]]:
    # Provider-specific implementation

Benefits

  • Extensible: Easy to add custom tools via registry
  • Safe: Configurable tool enabling with validation
  • Standards Compliant: Follows OpenAI/Anthropic specifications
  • Integrated: Seamless fit into Nova's architecture
  • Future-Proof: Designed for emerging standards like MCP

Security Considerations

  • Sandboxing for restricted execution environments
  • Granular permission system for tool capabilities
  • Input validation before execution
  • Audit logging for security review
  • Optional user confirmation for sensitive operations

Documentation

See detailed implementation plan: docs/tooling_implementation_plan.md

Acceptance Criteria

  • Tool system works with all supported AI providers (OpenAI, Anthropic, Ollama)
  • Built-in tools cover common use cases (file ops, commands, network)
  • Configuration system allows granular control
  • Security features prevent unauthorized access
  • Comprehensive tests and documentation
  • Performance meets Nova's standards

Related Issues

  • Relates to Nova's modular architecture goals
  • Extends AI capabilities beyond text generation
  • Supports future plugin ecosystem development

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions