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

# Web search via pieces

> Give agents fetch-based web search with Brave Search or Exa.

Use the Brave Search or Exa piece with a developer-provided key when an agent needs current web results.

## Choose a provider

| Provider | Default action | Best fit |
| - | - | - |
| Brave Search | `searchWeb` | General web search against an independent index |
| Exa | `search` | Semantic search, page content, similarity, and grounded answers |

Brave Search provides `searchWeb` and [`customApiCall`](https://docs.frogbot.ai/pieces/index#custom-api-calls) for other Brave Search API endpoints, with paths relative to `https://api.search.brave.com/res/v1`. Exa provides `search`, `getContents`, `findSimilarPages`, and `generateAnswer`.

## Install the packages

Install the FrogBot piece you need. Each package includes its runtime dependencies.

```bash theme={"theme":"tokyo-night"}
pnpm add @frogbotai/piece-brave-search
```

```bash theme={"theme":"tokyo-night"}
pnpm add @frogbotai/piece-exa
```

## Use a developer key

Pass the provider key when creating the piece, and assign its default tool to the agent.

```ts theme={"theme":"tokyo-night"}
import { createBraveSearch } from '@frogbotai/piece-brave-search'
import { buildConfig } from 'frogbot'

const braveSearch = createBraveSearch({
  auth: { apiKey: process.env.BRAVE_API_KEY! }
})

export default buildConfig({
  agents: [
    {
      slug: 'researcher',
      model: 'fast',
      instructions: 'Search before answering questions about current events.',
      tools: [braveSearch.searchWeb]
    }
  ]
})
```

For Exa, replace the import and factory with `createExa`, and read `EXA_API_KEY`.

`createBraveSearch` and `createExa` accept the same options:

| Option | Type | Default | Description |
| - | - | - | - |
| `slug` | `string` | `'brave-search'` or `'exa'` | Instance slug. It prefixes tool slugs, such as `brave-search_searchWeb`. |
| `auth.apiKey` | `string` | Required with `auth` | The provider API key. Without factory `auth`, each caller needs a `secret: true` [connection](https://docs.frogbot.ai/connections/overview.md). |

Neither piece has an OAuth recipe, so neither factory accepts `oauth`. See [factory options](https://docs.frogbot.ai/pieces/overview.md#factory-options).

## Select opt-in Exa actions

Select only the Exa actions the agent needs.

```ts theme={"theme":"tokyo-night"}
tools: [exa.search, exa.getContents, exa.findSimilarPages]
```

Pass the whole piece, such as `tools: [exa]`, only when the agent should receive all four actions.


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