Overview
Tools are the mechanism through which OrbitAI agents interact with the external world and perform specialized operations. They enable agents to go beyond language processing to take concrete actions, access external resources, and manipulate data.Extensible
Built-in tools and custom tool creation support
Type-Safe
JSON Schema validation ensures correct usage
Async-Ready
Fully asynchronous execution with Swift Concurrency
Traceable
Comprehensive metrics and execution tracking
Intelligent
LLM-driven automatic tool selection
Composable
Combine tools for complex workflows
Key Capabilities
Automatic Tool Selection
Automatic Tool Selection
Agents automatically determine which tools to use based on task requirements, available tools, and context. The LLM reasons about tool usage and orchestrates multi-tool workflows.
Schema Validation
Schema Validation
Every tool defines its input parameters using JSON Schema, ensuring type safety and preventing invalid tool usage before execution.
Execution Tracking
Execution Tracking
Tool execution is monitored with detailed metrics including execution time, success status, input/output sizes, and error information.
Error Handling
Error Handling
Built-in error handling mechanisms ensure graceful failures with detailed error messages and recovery strategies.
Tool Architecture
Built-in Tools
OrbitAI includes a comprehensive suite of built-in tools for common operations:File & Data Operations
file_reader
Description: Read and process file contents
Parameters:
path (string), encoding (optional)
Returns: File contents as string or datafile_writer
Description: Write or update file contents
Parameters:
path (string), content (string), mode (append/overwrite)
Returns: Success status and file pathdirectory_list
Description: List directory contents with filtering
Parameters:
path (string), recursive (boolean), filter (regex)
Returns: Array of file/directory informationcsv_processor
Description: Parse and manipulate CSV data
Parameters:
file_path (string), operation (read/write/transform)
Returns: Structured data or success statusdata_analyzer
Description: Analyze datasets with statistical operations
Parameters:
data (array), operations (mean/median/std/etc)
Returns: Statistical analysis resultsWeb & Network Tools
web_search
Description: Search the internet for current information
Parameters:
query (string), num_results (integer, 1-10)
Returns: Array of search results with URLs and snippetsweb_scraping
Description: Extract content from web pages
Parameters:
url (string), selectors (CSS/XPath)
Returns: Extracted content and metadataapi_caller
Description: Make HTTP requests to external APIs
Parameters:
url, method, headers, body, auth
Returns: Response data and statusgeocoding
Description: Convert addresses to coordinates and vice versa
Parameters:
query (string), type (forward/reverse)
Returns: Location data with coordinatesApple Platform Integration
apple_calendar
Description: Interact with Apple Calendar (EventKit)
Parameters:
operation (read/create/update/delete), event_data
Returns: Calendar events or success statusapple_reminders
Description: Manage Apple Reminders
Parameters:
operation, reminder_data, list_name
Returns: Reminders or success statuslocal_notifications
Description: Schedule and manage local notifications
Parameters:
title, body, trigger, identifier
Returns: Notification identifier and delivery statuscore_location
Description: Access device location services
Parameters:
accuracy (best/kilometer/etc), continuous (boolean)
Returns: Location coordinates and metadataweather_kit
Description: Retrieve weather information using WeatherKit
Parameters:
location (coordinates/place), forecast_type
Returns: Weather data and forecastsComputation Tools
calculator
Description: Perform mathematical calculations
Parameters:
expression (string), precision (integer)
Returns: Calculation resultcode_executor
Description: Execute code in sandboxed environment
Parameters:
code (string), language (python/swift/js)
Returns: Execution output and statuschart_generator
Description: Create data visualizations
Parameters:
data, chart_type, styling
Returns: Chart image or data URLBuilt-in tools are automatically registered with
ToolsHandler when OrbitAI initializes. No manual registration is required.Tool Assignment
Tools can be assigned at both the agent and task levels, providing flexibility in tool availability and usage.Agent-Level Tools
Assign tools to an agent to define its general capabilities across all tasks:Task-Level Tools
Assign tools to specific tasks for fine-grained control:Agent Tools vs Task Tools
- Tool Resolution
- Best Practices
- Examples
When both agent and task define tools, OrbitAI uses the following resolution logic:Key Rules:
- If task has tools defined → Use only task tools
- If task has no tools → Use agent tools
- Task tools override agent tools (not merge)
- Empty tool list
[]means no tools available
Creating Custom Tools
Custom tools enable integration with proprietary systems, external APIs, and domain-specific functionality.Basic Custom Tool
Create a custom tool by extendingBaseTool:
1
Define Tool Class
2
Define Parameters Schema
3
Implement Execute Method
4
Register Tool
Advanced Custom Tool Example
Here’s a more sophisticated tool with error handling, validation, and metrics:Tool Integration
With LLM Function Calling
OrbitAI integrates tools with LLM function calling for intelligent tool usage:Multi-Tool Workflows
Agents automatically orchestrate multi-tool workflows:Tool Chaining
Tools can use outputs from previous tools:Tool Execution
Execution Lifecycle
Execution Model
All tool execution in OrbitAI is asynchronous using Swift Concurrency:Timeout Handling
Implement timeouts for long-running tools:Advanced Tool Setup
Tool Registry & Management
TheToolsHandler singleton manages all tools:
Enabling/Disabling Tools
Control tool availability dynamically:Tool Introspection
Tools can be introspected for debugging and documentation:Tool Versioning
Support multiple versions of the same tool:Usage and Metrics
Tool Usage Tracking
OrbitAI automatically tracks tool usage with detailed metrics:Accessing Tool Metrics
Performance Monitoring
Create custom monitoring for tool performance:Cost Tracking for External APIs
Track costs for tools that call paid APIs:Error Handling
Common Tool Errors
Invalid Parameters
Invalid Parameters
Cause: Parameters don’t match the schema or fail validation.Solution:
Tool Not Registered
Tool Not Registered
Cause: Agent references a tool that hasn’t been registered with
ToolsHandler.Solution:Execution Timeout
Execution Timeout
Cause: Tool operation takes too long to complete.Solution:
External API Failures
External API Failures
Cause: External service is unavailable or returns an error.Solution:
Permission Denied
Permission Denied
Cause: Tool lacks necessary permissions (file access, location, etc.).Solution:
Error Handling Patterns
Best Practices
Tool Design
Clear Naming
Use descriptive, action-oriented namesGood:
send_email, analyze_sentiment, fetch_stock_price
Bad: tool1, helper, processDetailed Descriptions
Write comprehensive descriptions that guide LLM usage
Schema Validation
Define strict schemas with constraints
Single Responsibility
Each tool should do one thing wellGood: Separate
read_file and write_file tools
Bad: One file_operations tool that does everythingIdempotency
Design tools to be safely re-executable
Error Messages
Return actionable error messagesGood: “File not found at ‘/path/to/file.txt’. Check the path and try again.”
Bad: “Error 404”
Performance Optimization
- Caching
- Batching
- Parallel Execution
- Streaming
Cache frequently accessed data:
Security Considerations
Troubleshooting
Common Issues
Tool Not Found
Tool Not Found
Symptom: Agent reports tool is unavailable or not found.Diagnosis:Solutions:
- Register the tool before creating the orbit
- Check for typos in tool name (names are case-sensitive)
- Verify tool is imported and compiled
- For built-in tools, ensure OrbitAI version is up to date
Parameter Validation Failures
Parameter Validation Failures
Symptom: Tool execution fails with parameter errors.Diagnosis:Solutions:
- Ensure parameter names match schema exactly
- Check parameter types (string vs int vs array)
- Verify required parameters are provided
- Add default values for optional parameters
- Improve error messages in tool description
Slow Tool Execution
Slow Tool Execution
Symptom: Tools take too long to execute.Diagnosis:Solutions:
- Implement caching for repeated queries
- Use parallel execution for independent operations
- Add timeouts to prevent hanging
- Optimize database queries or API calls
- Consider batch processing
Tool Returns Incorrect Data
Tool Returns Incorrect Data
Symptom: Tool executes successfully but returns wrong results.Diagnosis:Solutions:
- Verify parameter parsing logic
- Check data transformations
- Validate external API responses
- Add unit tests for tool logic
- Review LLM’s parameter generation
Agent Doesn't Use Expected Tool
Agent Doesn't Use Expected Tool
Symptom: Agent doesn’t select the tool you expect for a task.Diagnosis:Solutions:
- Improve tool description to clarify when to use it
- Verify tool is in agent’s or task’s tool list
- Add examples in tool description
- Adjust task description to hint at tool usage
- Check if multiple tools overlap in functionality
Debugging Tools
Create a debugging wrapper for tools:Next Steps
Explore Built-in Tools
Learn about specific built-in tools and their capabilities
Agent Configuration
Understand how to configure agents with tools
Task Orchestration
Learn how tasks leverage tools for execution
LLM Integration
Understand how LLMs interact with tools