Skip to main content
The 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

The WebSearchTool 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

Use WebSearchTool 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 using ExaSearchTool 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

  1. Clear Instructions: Provide clear guidelines on when to use web search
  2. Source Verification: Instruct agents to verify information across multiple sources
  3. Recency Awareness: Use for time-sensitive queries
  4. Fallback Strategy: Combine with other tools for comprehensive capabilities
  5. 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
Source: /home/daytona/workspace/source/src/agentor/tools/__init__.py:1
Last modified on May 5, 2026