> ## Documentation Index
> Fetch the complete documentation index at: https://agno-v2-codex-docs-audit-20260719-0149.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# OpenAI WebSearch Builtin Tool

> Combine the built-in web_search_preview tool with FileTools to search and save results to disk.

```python websearch_builtin_tool.py theme={null}
"""
Openai Websearch Builtin Tool
=============================

Cookbook example for `openai/responses/websearch_builtin_tool.py`.
"""

from agno.agent import Agent
from agno.models.openai import OpenAIResponses
from agno.tools.file import FileTools

# ---------------------------------------------------------------------------
# Create Agent
# ---------------------------------------------------------------------------

agent = Agent(
    model=OpenAIResponses(id="gpt-4o"),
    tools=[{"type": "web_search_preview"}, FileTools()],
    instructions="Save the results to a file with a relevant name.",
    markdown=True,
)
agent.print_response("Whats happening in France?")

# ---------------------------------------------------------------------------
# Run Agent
# ---------------------------------------------------------------------------

if __name__ == "__main__":
    pass
```

## Run the Example

<Steps>
  <Snippet file="create-venv-step.mdx" />

  <Step title="Install dependencies">
    ```bash theme={null}
    uv pip install -U agno openai
    ```
  </Step>

  <Step title="Export your OpenAI API key">
    <CodeGroup>
      ```bash Mac/Linux theme={null}
      export OPENAI_API_KEY="your_openai_api_key_here"
      ```

      ```bash Windows theme={null}
      $Env:OPENAI_API_KEY="your_openai_api_key_here"
      ```
    </CodeGroup>
  </Step>

  <Step title="Run the example">
    Save the code above as `websearch_builtin_tool.py`, then run:

    ```bash theme={null}
    python websearch_builtin_tool.py
    ```
  </Step>
</Steps>

Full source: [cookbook/90\_models/openai/responses/websearch\_builtin\_tool.py](https://github.com/agno-agi/agno/blob/v2.7.4/cookbook/90_models/openai/responses/websearch_builtin_tool.py)
