# `WardrikBrave.WebSearch`

The `web_search` tool.

Results become part of the turn that asked for them, so they're kept small: 10 results and about
4,096 tokens unless the agent asks for more.

# `body`

```elixir
@spec body(map(), String.t() | nil) :: map()
```

Returns the API parameters for the tool's arguments and date window.

# `run`

```elixir
@spec run(atom() | map(), map(), WardrikCore.Context.t()) ::
  {:ok, map()} | {:error, String.t()}
```

Runs one search.

Uses the agent's `BRAVE_API_KEY` if its keys hold one, and the settings in `brave` otherwise.
Returns `{:error, message}` if both `:freshness` and `:published_between` are given, or if
`:published_between` isn't `"YYYY-MM-DDtoYYYY-MM-DD"`.

# `tool`

```elixir
@spec tool(atom() | map()) :: WardrikCore.Tool.t()
```

Returns the tool. `brave` is a started name or inline settings. See `WardrikBrave.settings/1`.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
