This document describes the built-in tool modules, their capabilities, and usage patterns.
- Tool Architecture
- Core Capabilities
- Data Management Tools
- Business-Oriented Tools
- Security Analysis Tools
- Experimental Tools
- Tool Registration
Tools in FlexiAI Toolsmith follow a consistent pattern:
- Tool Registry (
tools_registry.py) - Maps tool names to callable functions - Tools Manager (
tools_manager.py) - Implements core tool operations - Infrastructure Modules - Specialized tool implementations (CSV, spreadsheets, security)
Assistant Tool Call Request
↓
ToolCallExecutor
↓
ToolsRegistry (name → function mapping)
↓
ToolsManager or Infrastructure Module
↓
Structured Result
↓
Back to Assistant
Tools:
save_processed_content- Save processed context for retrievalload_processed_content- Load previously saved context
Purpose: Enables retrieval-augmented generation (RAG) by persisting processed content across sessions.
Use Cases:
- Storing analysis results for later reference
- Maintaining conversation context
- Building knowledge bases from interactions
Tools:
initialize_agent- Initialize a new assistant agentcommunicate_with_assistant- Send messages between assistants
Purpose: Enables multi-agent coordination where assistants can delegate tasks and share context.
Status: Experimental - not fully integrated into main workflows.
Tools:
search_youtube- Search YouTube videossearch_on_youtube- Alternative YouTube search interface
Purpose: External lookup helpers for retrieving information from YouTube.
Requirements: YOUTUBE_API_KEY environment variable.
Tool: csv_operations
Capabilities:
- File Operations - Create, read, update, delete CSV files
- Data Entry - Add single rows or bulk data
- Data Retrieval - Query and filter CSV data
- Data Validation - Validate data types and constraints
- Data Transformation - Transform and reshape data
- Query Operations - Filter, sort, and aggregate data
Infrastructure:
- Entry point:
csv_entrypoint.py - Manager:
csv_manager.py - Operations: Modular operation handlers
- Utilities: Error handling, validation helpers
Example Operations:
create- Create new CSV fileread- Read CSV dataadd_row- Add single rowadd_rows- Add multiple rowsfilter- Filter rows by conditionupdate- Update specific cellsvalidate- Validate data integrity
Example Usage:
# Create CSV file
csv_entrypoint(
operation="create",
path="data",
file_name="users.csv",
rows=[{"name": "Alice", "email": "alice@example.com"}]
)
# Read CSV data
csv_entrypoint(
operation="read",
path="data",
file_name="users.csv"
)
# Filter rows
csv_entrypoint(
operation="filter_rows",
path="data",
file_name="users.csv",
condition_type="equals",
column="name",
condition_value="Alice"
)
# Add row (append_row operation)
csv_entrypoint(
operation="append_row",
path="data",
file_name="users.csv",
row={"name": "Bob", "email": "bob@example.com"}
)Note: Tools are called via the tool registry, which routes to csv_entrypoint() function.
Rate Limits & Timeouts:
- File operations: No timeout (immediate)
- Large files (>10MB): Consider chunking for better performance
- Default timeout: None (operations complete synchronously)
Tool: Multiple specialized tools for Excel/OpenPyXL operations
Tools:
file_operations- File and workbook managementsheet_operations- Sheet creation, deletion, managementdata_entry_operations- Cell and range data entrydata_retrieval_operations- Read data from sheetsdata_analysis_operations- Statistical analysisformula_operations- Excel formula executionformatting_operations- Cell and range formattingdata_validation_operations- Data validation rulesdata_transformation_operations- Data reshapingchart_operations- Chart creation and management
Infrastructure:
- Entry point:
spreadsheet_entrypoint.py - Manager:
spreadsheet_manager.py - Operations: Specialized operation modules
- Utilities: Mixed helpers, error handling
Capabilities:
- File Management - Create, open, save Excel files
- Sheet Management - Create, delete, rename sheets
- Data Entry - Write data to cells and ranges
- Data Retrieval - Read data with filtering and sorting
- Analysis - Statistical functions and aggregations
- Formulas - Excel formula support
- Formatting - Cell styles, colors, fonts
- Validation - Data validation rules
- Transformation - Pivot tables, data reshaping
- Charts - Create and modify charts
Tools:
identify_subscriber- Identify subscriber from dataretrieve_billing_details- Get billing informationmanage_services- Manage subscriber services
Purpose: Customer service automation workflows for subscription management.
Data Sources: CSV files in flexiai/toolsmith/data/csv/
Use Cases:
- Customer identification and validation
- Billing inquiry handling
- Service activation/deactivation
- Subscription workflow automation
Tool: security_audit
Purpose: Structured security analysis and system inspection through controlled workflows.
⚠️ SECURITY WARNING: Some operations in this tool can modify system state, require elevated privileges, or trigger security alerts. See SECURITY.md for safe usage practices and opt-in requirements.
Safe Operations (Read-Only):
reconnaissance– Lists network connections and ARP neighborsdetect_processes– Lists running processes
Potentially Dangerous Operations:
port_scan/network_scan– May trigger IDS/IPS alertsdefense_actions– Can modify firewall rules, kill processes, block ports (requires root/admin)update_system– Can trigger system updates (requires root/admin)
Configuration:
⚠️ Note: Currently, there is no automatic gating for dangerous operations. They will execute if called by an assistant.- Recommended: Implement
ENABLE_DANGEROUS_TOOLSenvironment variable check (default:false) before production use. - All
defense_actionsare logged with operator identity and timestamp tologs/security_audit.log - Use only in controlled environments with appropriate permissions
Operations:
- Operation:
reconnaissance - Args: None
- Result:
{ "connections": [ {"proto": "tcp", "local": "...", "remote": "...", "state": "..."} ], "neighbors": [ {"ip": "...", "mac": "...", "state": "REACHABLE"} ] } - Description: Lists active network connections and ARP neighbors
- Operation:
detect_processes - Args: None
- Result:
{ "processes": [ {"pid": 1234, "user": "user", "name": "process_name"} ] } - Description: Lists running processes
- Operation:
port_scan - Args:
target(str) - Hostname or IP to scanstart_port(int, optional) - Default: 1end_port(int, optional) - Default: 1024
- Result:
{ "target": "192.168.1.1", "range": [1, 1024], "open_ports": [22, 80, 443], "total_open": 3 } - Description: Scans TCP ports on target host
- Operation:
network_scan - Args:
network(str, required) - Network CIDR (e.g., "192.168.1.0/24")
- Result:
{ "network": "192.168.1.0/24", "alive_hosts": ["192.168.1.1", "192.168.1.100"], "total_alive": 2 } - Description: Ping-sweep to identify active hosts
- Operation:
defense_actions - Args:
bad_ips(List[str], optional) - IPs to blockbad_pids(List[int], optional) - Process IDs to killbad_ports(List[int], optional) - Ports to block
- Result:
{ "blocked_ips": ["1.2.3.4"], "killed_pids": [1234], "blocked_ports": [8080], "errors": [] } - Description: Block IPs, kill processes, or block ports
- Operation:
update_system - Args: None
- Result:
{ "ran_as": "root" | "non-root" | "windows", "skipped": false, "commands": ["apt update", "apt upgrade"] } - Description: Triggers operating system updates
Infrastructure:
- Implementation:
security_audit.py - Dispatcher:
security_audit_dispatcher() - Class:
SecurityAudit
Example Usage:
# Safe operation (read-only)
# Called via ToolsManager.security_audit() which dispatches to security_audit_dispatcher()
result = security_audit(operation="reconnaissance")
# Returns: {"status": True, "message": "...", "result": {"connections": [...], "neighbors": [...]}}
# Port scan (may trigger alerts)
result = security_audit(operation="port_scan", target="192.168.1.1", start_port=1, end_port=1024)
# Returns: {"status": True, "message": "...", "result": {"target": "...", "open_ports": [22, 80, 443], ...}}
# Defense action (requires root/admin, no gating currently)
result = security_audit(operation="defense_actions", bad_ips=["1.2.3.4"], bad_pids=[1234])
# Returns: {"status": True, "message": "Defense complete", "result": {"blocked_ips": [...], "killed_pids": [...], ...}}
# ⚠️ WARNING: This will execute immediately if called. Implement opt-in flag before production.Note: Tools are called via the tool registry, which routes to ToolsManager.security_audit() method. The method signature is security_audit(operation: str, **kwargs: Any) -> Dict[str, Any].
Rate Limits & Timeouts:
- Port scans: Default timeout 1 second per port
- Network scans: Default timeout 1 second per host
- Defense actions: No timeout (executes immediately)
- All operations: Logged to
logs/app.log
Security Note:
- Defense actions and system updates require appropriate permissions and should be used with caution
- See SECURITY.md for complete security guidelines
⚠️ Current Status: No automatic gating exists. Consider implementingENABLE_DANGEROUS_TOOLSopt-in flag before production use.
Status: Experimental
Purpose: Generate interactive forms inside the web chat UI; submissions are persisted as structured data.
Features:
- Dynamic form generation from assistant instructions
- Form submission handling
- Data persistence to CSV
- Web UI integration
Location: Handled in app.py via /submit_user_info endpoint
Status: Experimental - not yet integrated
Purpose: Optical Character Recognition helpers for image processing.
Infrastructure:
- Module:
_recycle/ocr_utils.py - Dependencies:
pytesseract,Pillow - Requirements: Tesseract OCR binary installed
Note: This functionality is experimental and not currently integrated into the main tool registry.
-
ToolsRegistry (
tools_registry.py)- Maps tool names to callable functions
- Initialized with
ToolsManagerinstance - Provides
get_tool(name)method
-
ToolsManager (
tools_manager.py)- Implements core tool functions
- Dispatches to infrastructure modules
- Manages tool state and resources
-
Infrastructure Modules
- Specialized implementations (CSV, spreadsheets, security)
- Entry points route operations to managers
- Managers perform actual operations
To add a custom tool:
- Implement tool function in
ToolsManageror create infrastructure module - Register in
ToolsRegistry.map_core_tools()ormap_custom_tools() - Tool becomes available to assistants via tool calls
All tools return structured dictionaries:
{
"status": bool, # Success/failure
"message": str, # Human-readable summary
"result": dict | None # Structured data (operation-specific)
}Tool outputs are automatically truncated if they exceed token limits via context_utils.return_context().
- ARCHITECTURE.md – System architecture including tool infrastructure
- WORKFLOW.md – Tool execution workflows
- FILE_MAPPING.md – Internal file reference