home / skills / michalvavra / agents / brave-search
This skill retrieves web results using Brave Search to enhance lookup accuracy and speed for AI agents.
npx playbooks add skill michalvavra/agents --skill brave-searchReview the files below or copy the command above to add this skill to your agents.
---
name: brave-search
description: Web search via the Brave Search API. Use to retrieve search results from Brave when web lookups are needed.
compatibility: Requires BRAVE_SEARCH_API_KEY and uv with Python 3.12+ for scripts/brave-search.py.
---
# Brave Search
## Quick start
```bash
export BRAVE_SEARCH_API_KEY="your-token"
{baseDir}/scripts/brave-search.py "pi coding agent" --search-lang en --country US
```
## Usage
```bash
{baseDir}/scripts/brave-search.py "QUERY" [OPTIONS]
uv run --script {baseDir}/scripts/brave-search.py "QUERY" [OPTIONS]
```
## Options
- `--count <N>`: Maximum results to return (default: 5)
- `--offset <N>`: Offset into the result set (default: 0)
- `--country <CODE>`: Two letter country code
- `--search-lang <CODE>`: Search language code
- `--safesearch <off|moderate|strict>`: Safe search mode
- `--freshness <day|week|month>`: Filter by recency
- `--json`: Output normalized JSON
- `--raw`: Output raw API response
- `--help`: Show help
## Environment variables
```bash
BRAVE_SEARCH_API_KEY="your-token"
```
## Examples
```bash
{baseDir}/scripts/brave-search.py "observability tools" --count 3
```
This skill provides web search via the Brave Search API to retrieve up-to-date search results when web lookups are needed. It wraps the API in a simple CLI with options for count, country, language, safesearch, and freshness. Use it to fetch normalized JSON or raw API responses for downstream processing. The skill requires a Brave Search API key in the environment.
The skill calls the Brave Search API using an API key read from the BRAVE_SEARCH_API_KEY environment variable. It supports query parameters like count, offset, country, search language, safesearch level, and freshness to shape results. Output can be normalized JSON for programmatic use or raw API responses for debugging. The CLI can be invoked directly or through simple script runners.
How do I provide the API key?
Export BRAVE_SEARCH_API_KEY in your shell before running the CLI, e.g. export BRAVE_SEARCH_API_KEY="your-token". The script reads this environment variable at runtime.
What output formats are available?
Use --json to get normalized JSON suitable for parsing, or --raw to receive the full raw API response for debugging. Default CLI output is a human-friendly summarized form when neither flag is used.