Common Tools
Overview
Upsonic’s common tools are specialized, domain-specific tools that provide ready-to-use functionality for common AI agent use cases. These tools are designed to handle complex integrations and provide rich, structured data for your agents without requiring extensive setup or configuration.Key Features
- Domain Expertise: Specialized tools for specific domains (finance, search, etc.)
- Rich Data Integration: Access to real-time data from external APIs and services
- Configurable Functionality: Enable/disable specific tools based on your needs
- Error Resilience: Built-in error handling and fallback mechanisms
- Performance Optimized: Efficient data fetching and caching strategies
- Production Ready: Battle-tested tools used in real-world applications
Tool Categories
-
Financial Tools: Comprehensive financial data and analysis
YFinanceTools
: Yahoo Finance integration for stock data, company info, and market analysis
-
Search Tools: Advanced web search capabilities
duckduckgo_search_tool
: DuckDuckGo-powered web searchtavily_search_tool
: Advanced search with Tavily API
-
Utility Tools: General-purpose utilities for common tasks
- Various specialized tools for data processing and analysis
When to Use Common Tools
- Financial Applications: Stock analysis, market research, investment decisions
- Research Tasks: Web search, data gathering, information synthesis
- Business Intelligence: Market analysis, competitive research, trend analysis
- Data-Driven Decisions: Access to real-time data for informed decision making
- Rapid Development: Skip complex API integrations and focus on your core logic
Integration Benefits
- Reduced Development Time: No need to build complex API integrations
- Reliable Data Sources: Access to established, reliable data providers
- Consistent Interface: Unified tool interface across different data sources
- Maintenance-Free: Framework handles API changes and updates
- Scalable: Built to handle production workloads and rate limits
YFinanceTools
TheYFinanceTools
class provides comprehensive financial data access using Yahoo Finance.
Basic Usage
Selective Tool Configuration
You can enable specific tools instead of all tools:Available Financial Tools
When usingenable_all_tools()
, the following tools are available:
- get_current_stock_price: Get current stock price
- get_company_info: Get comprehensive company information
- get_analyst_recommendations: Get analyst recommendations
- get_company_news: Get recent company news
- get_stock_fundamentals: Get key financial fundamentals
- get_income_statements: Get income statement data
- get_key_financial_ratios: Get key financial ratios
- get_historical_stock_prices: Get historical stock price data
- get_technical_indicators: Get technical indicator data
Example: Comprehensive Financial Analysis
Example: Historical Data Analysis
DuckDuckGo Search Tool
Theduckduckgo_search_tool
provides web search capabilities using DuckDuckGo.
Basic Usage
Configuration Options
Search Result Format
DuckDuckGo search returns structured results:Tavily Search Tool
Thetavily_search_tool
provides advanced web search capabilities using the Tavily API.
Basic Usage
Tavily Configuration Options
Getting Tavily API Key
- Sign up at https://app.tavily.com/home
- Get your API key from the dashboard
- Use it in the
tavily_search_tool
function
Combining Common Tools
You can combine multiple common tools in a single task:Custom Wrappers for Common Tools
You can create custom wrappers around common tools:Error Handling
Common tools include built-in error handling:Performance Optimization
Caching Strategies
Rate Limiting
Best Practices
- Use enable_all_tools(): For YFinanceTools, use
enable_all_tools()
to access all financial capabilities - Use instance directly: Pass the YFinanceTools instance directly to tools list, not
functions()
- Handle API keys: Ensure you have proper API keys for services like Tavily
- Cache frequently accessed data: Use caching for financial data and search results
- Error handling: Implement proper error handling for network requests
- Rate limiting: Be mindful of API rate limits, especially for financial data
- Selective tools: Use selective tool configuration when you don’t need all capabilities