# OpenAI Web Search

**Action ID:** `openai_search`

## Description

Searches the web using OpenAI's capabilities. This node performs real-time web searches integrated with OpenAI models, allowing you to get current information and search results directly within your workflows. Supports batch searching with multiple queries simultaneously.

## Provider

**OpenAI**

## Connection

| Name              | Description                                  | Required | Category |
| ----------------- | -------------------------------------------- | :------: | -------- |
| OpenAI Connection | The OpenAI connection to use for the search. |     ✓    | openai   |

## Input Parameters

| Name            | Type     | Required | Default                          | Description                                                                                                          |
| --------------- | -------- | :------: | -------------------------------- | -------------------------------------------------------------------------------------------------------------------- |
| search\_queries | array    |     ✓    | -                                | List of search queries to process using OpenAI's web search capability. Accepts 1-10 queries.                        |
| model           | dropdown |     -    | gpt-4o-search-preview-2025-03-11 | The OpenAI model to use for search. Options: gpt-4o-search-preview-2025-03-11, gpt-4o-mini-search-preview-2025-03-11 |

<details>

<summary>View JSON Schema</summary>

```json
{
  "description": "OpenAI Search node input.",
  "properties": {
    "search_queries": {
      "description": "List of search queries to process using OpenAI's web search capability",
      "items": {
        "type": "string"
      },
      "maxLength": 10,
      "minLength": 1,
      "title": "Search Queries",
      "type": "array"
    },
    "model": {
      "default": "gpt-4o-search-preview-2025-03-11",
      "description": "The OpenAI model to use for search",
      "enum": [
        "gpt-4o-search-preview-2025-03-11",
        "gpt-4o-mini-search-preview-2025-03-11"
      ],
      "title": "Model Name",
      "type": "string"
    }
  },
  "required": [
    "search_queries"
  ],
  "title": "OpenAISearchInput",
  "type": "object"
}
```

</details>

## Output Parameters

| Name            | Type | Description                     |
| --------------- | ---- | ------------------------------- |
| search\_results | any  | The search results from OpenAI. |

<details>

<summary>View JSON Schema</summary>

```json
{
  "description": "OpenAI Search node output.",
  "properties": {
    "search_results": {
      "title": "Search Results",
      "description": "The search results from OpenAI"
    }
  },
  "title": "OpenAISearchOutput",
  "type": "object"
}
```

</details>

## How It Works

This node integrates OpenAI's web search capabilities directly into your workflows. You provide one or more search queries, and the node performs real-time web searches and returns comprehensive results. The search models (gpt-4o-search-preview or gpt-4o-mini-search-preview) combine language understanding with web search to deliver relevant, up-to-date information. You can search for multiple queries in a single node execution (up to 10 queries), making it efficient for batch processing or comprehensive research tasks.

## Usage Examples

### Example 1: Single Query Search

**Input:**

```
search_queries: ["latest artificial intelligence breakthroughs 2024"]
model: "gpt-4o-search-preview-2025-03-11"
```

**Output:**

```
search_results: {
  "results": [
    {
      "title": "OpenAI Announces GPT-4.1...",
      "url": "https://openai.com/...",
      "snippet": "OpenAI announced GPT-4.1 with improved reasoning capabilities..."
    },
    {
      "title": "Google Releases Gemini 2.0...",
      "url": "https://google.com/...",
      "snippet": "Google's new Gemini 2.0 model demonstrates advanced multimodal capabilities..."
    }
  ]
}
```

### Example 2: Multiple Query Search

**Input:**

```
search_queries: [
  "Python web scraping libraries",
  "FastAPI best practices",
  "Redis caching strategies"
]
model: "gpt-4o-search-preview-2025-03-11"
```

**Output:**

```
search_results: {
  "results_per_query": {
    "Python web scraping libraries": [...],
    "FastAPI best practices": [...],
    "Redis caching strategies": [...]
  }
}
```

### Example 3: Current News Search

**Input:**

```
search_queries: ["cryptocurrency market news today"]
model: "gpt-4o-mini-search-preview-2025-03-11"
```

**Output:**

```
search_results: {
  "results": [
    {
      "title": "Bitcoin reaches new highs...",
      "url": "https://news.example.com/...",
      "snippet": "Bitcoin trading at record levels as market sentiment turns positive...",
      "published": "2024-11-26"
    }
  ]
}
```

## Common Use Cases

* **Real-time Research**: Get current information on any topic for your workflows
* **News Monitoring**: Track breaking news and latest developments
* **Competitor Analysis**: Search competitor information and market positioning
* **Fact-Checking**: Verify claims against current web information
* **Content Research**: Gather research materials for content generation
* **Market Analysis**: Search for current market trends and data
* **Price Comparison**: Find current prices and product information
* **Event Information**: Get details about upcoming events and announcements

## Error Handling

| Error Type           | Cause                               | Solution                                                                      |
| -------------------- | ----------------------------------- | ----------------------------------------------------------------------------- |
| No Search Queries    | search\_queries is empty or missing | Provide at least one search query                                             |
| Too Many Queries     | More than 10 queries provided       | Reduce to 10 or fewer queries per request                                     |
| Invalid Model        | Model name doesn't exist            | Use gpt-4o-search-preview-2025-03-11 or gpt-4o-mini-search-preview-2025-03-11 |
| Authentication Error | Invalid or missing OpenAI API key   | Verify OpenAI connection is properly configured                               |
| Search Failed        | Web search encountered an error     | Try with simpler queries or check internet connectivity                       |
| Rate Limit Exceeded  | Too many requests in a short time   | Implement delays between requests                                             |
| Empty Results        | No search results found for query   | Refine query terms or try broader searches                                    |
| Timeout Error        | Request took too long to complete   | Try with fewer queries or simpler search terms                                |

## Notes

* **Query Limits**: You can submit 1-10 queries per request. Batch processing multiple queries is more efficient than sequential requests.
* **Model Selection**: Use gpt-4o-search-preview-2025-03-11 for complex queries requiring deep reasoning. Use gpt-4o-mini-search-preview-2025-03-11 for simpler queries to reduce costs.
* **Results Format**: Results may include titles, URLs, snippets, and metadata depending on the search type and model.
* **Current Information**: This node provides real-time web search results, making it ideal for current events and breaking news.
* **Search Quality**: Craft clear, specific search queries for best results. Use quotes for exact phrases and boolean operators if supported.
* **Cost Optimization**: The mini model is significantly cheaper. Use it when full reasoning power isn't needed.
* **Rate Limiting**: OpenAI may rate-limit high volumes of searches. Implement backoff strategies for production use.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.agenticflow.ai/reference/nodes/openai_search.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
