> ## Documentation Index
> Fetch the complete documentation index at: https://praison.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Web Search

> Get real-time information using native web search capabilities

The `--web-search` flag enables native web search capabilities for supported LLM providers.

## Quick Start

```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
praisonai "What are the latest AI news today?" --web-search --llm openai/gpt-4o-search-preview
```

![Web Search Finds Current Information](https://mintcdn.com/praisonai/pFBcVNzCyPC2mUmz/cli/web-search-web-search-finds-current-infor.gif?s=e4634e51e6d328351ccb984128047b8b)

## Usage

### Basic Web Search

```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
praisonai "What are the latest AI news today?" --web-search --llm openai/gpt-4o-search-preview
```

**Expected Output:**

```
🌐 Web Search enabled

╭─ Agent Info ─────────────────────────────────────────────────────────────────╮
│  👤 Agent: DirectAgent                                                       │
│  Role: Assistant                                                             │
│  Model: openai/gpt-4o-search-preview                                        │
│  Web Search: Enabled                                                         │
╰──────────────────────────────────────────────────────────────────────────────╯

╭────────────────────────────────── Response ──────────────────────────────────╮
│ Based on today's news (December 2024):                                      │
│                                                                              │
│ 1. **OpenAI announces GPT-5 preview** - New capabilities include...         │
│ 2. **Google releases Gemini 2.0** - Enhanced multimodal features...         │
│ 3. **Anthropic updates Claude** - Improved reasoning and...                 │
│                                                                              │
│ Sources: [1] techcrunch.com [2] theverge.com [3] wired.com                  │
╰──────────────────────────────────────────────────────────────────────────────╯
```

### Combine with Other Flags

```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
# Web search with metrics
praisonai "Latest stock market news" --web-search --metrics --llm openai/gpt-4o-search-preview

# Web search with save
praisonai "Current weather in Tokyo" --web-search --save --llm openai/gpt-4o-search-preview
```

## Supported Providers

| Provider | Models | Notes |
| - | - | - |
| OpenAI | `gpt-4o-search-preview` | Native search integration |
| Gemini | `gemini-pro`, `gemini-ultra` | Google Search integration |
| Anthropic | `claude-sonnet-4-20250514`, `claude-3-opus` | Web search tool |
| xAI | `grok-2` | Real-time web access |
| Perplexity | `pplx-7b-online`, `pplx-70b-online` | Built-in search |

## YAML Equivalent

Use `web: true` on an agent with a web-search enabled model:

```yaml theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
agents:
  searcher:
    role: Web Search Agent
    instructions: "Find current information from the web"
    web: true
    llm: openai/gpt-4o-search-preview
```

## How It Works

1. **Enable**: The `--web-search` flag activates provider's native search
2. **Query**: Your prompt is sent with web search capability
3. **Search**: Provider searches the web for relevant information
4. **Synthesize**: Results are synthesized into a coherent response
5. **Cite**: Sources are included when available

```mermaid theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
flowchart LR
    A[User Query] --> B[LLM with Web Search]
    B --> C[Web Search]
    C --> D[Search Results]
    D --> E[Synthesize]
    E --> F[Response + Sources]
```

## Examples

### News Query

```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
praisonai "What happened in tech news this week?" \
  --web-search --llm openai/gpt-4o-search-preview
```

### Research Query

```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
praisonai "Latest research on quantum computing" \
  --web-search --llm openai/gpt-4o-search-preview
```

### Real-time Data

```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
praisonai "Current Bitcoin price and market analysis" \
  --web-search --llm openai/gpt-4o-search-preview
```

## Programmatic Usage

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
from praisonaiagents import Agent

agent = Agent(
    instructions="You are a research assistant",
    llm="openai/gpt-4o-search-preview",
    web=True
)

result = agent.start("What are the latest AI news today?")
print(result)
```

## Comparison with Other Options

| Feature | `--web-search` | Deep Research | Tools |
| - | - | - | - |
| Speed | Fast | Slow | Medium |
| Depth | Surface | Deep | Configurable |
| Sources | Few | Many | Depends |
| Provider | Limited | OpenAI/Gemini | Any |

## Best Practices

> [!TIP]
>
> Use `--web-search` for quick, real-time information. For in-depth research, use `praisonai research` instead.

> [!WARNING]
>
> Web search availability depends on the provider and model. Not all models support native web search.

| Do | Don't |
| - | - |
| Use for current events | Use for historical analysis |
| Use for quick lookups | Use for deep research |
| Specify time context | Assume recency |
| Check provider support | Assume all models work |

## Related

* [Web Fetch CLI](https://praison.ai/docs/cli/web-fetch.md)
* [Deep Research CLI](https://praison.ai/docs/cli/deep-research.md)
* [Model Capabilities](https://praison.ai/docs/features/model-capabilities.md)


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