WebSearchTool provides web search functionality through OpenAI’s agents library. It’s a built-in tool that doesn’t require additional API keys.
Class Signature
Overview
TheWebSearchTool is imported from the agents package (part of openai-agents SDK) and provides web search capabilities to Agentor agents. It integrates seamlessly with OpenAI’s agent framework.
Usage Example
Advanced Example
Features
- No API Key Required: Uses OpenAI’s built-in search capability
- Real-time Information: Access to current web content
- Automatic Integration: Works seamlessly with OpenAI’s agent framework
- Source Attribution: Results typically include source information
When to Use
UseWebSearchTool when you need:
- Current news and events
- Recent updates on specific topics
- Real-time data (stock prices, weather, etc.)
- Information not in the model’s training data
- Verification of facts and claims
Alternative: ExaSearchTool
For more control over web search, consider usingExaSearchTool which provides:
- Custom search parameters
- Number of results control
- Direct API access to Exa search engine
Exa tool docs are not yet published in this docs set.
Requirements
Environment Setup
Integration with Multiple Tools
Best Practices
- Clear Instructions: Provide clear guidelines on when to use web search
- Source Verification: Instruct agents to verify information across multiple sources
- Recency Awareness: Use for time-sensitive queries
- Fallback Strategy: Combine with other tools for comprehensive capabilities
- Rate Limiting: Be mindful of search frequency in production environments
Limitations
- Requires active internet connection
- Search results depend on OpenAI’s search backend
- May have rate limits based on your OpenAI plan
- Search scope and freshness depend on the underlying service
/home/daytona/workspace/source/src/agentor/tools/__init__.py:1