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

# Websearch Builtin Tool

> Use OpenAI's built-in web_search_preview tool with FileTools to save search results through the OpenAI Responses API.

## Code

```python websearch_builtin_tool.py theme={null}
from agno.agent import Agent
from agno.models.openai import OpenAIResponses
from agno.tools.file import FileTools

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?")

```

## Usage

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

**1. Set your API key**

```bash theme={null}
export OPENAI_API_KEY=xxx
```

**2. Install dependencies**

```bash theme={null}
uv pip install -U openai agno
```

**3. Run Agent**

Save the code above as `websearch_builtin_tool.py`, then run:

```bash theme={null}
python websearch_builtin_tool.py
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.