> ## 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.

# 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-5.6-luna"),
    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

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

**1. Install dependencies**

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

**2. Export your OpenAI API key**

```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"
```

**3. Run the example**

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

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

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


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