Skip to content

brave-api-python

Adaptive animated brave-api-python banner

brave-api-python is an asynchronous, typed Python client for Brave Search and Brave Ask. It also provides an MCP server so AI applications can call Brave search as tools.

Features

  • Complete (ask) or incremental (ask_stream) AI answers
  • Multi-turn conversations and image input
  • Structured web, image, news, video, and Brave Goggles results
  • Typed Pydantic models that are immutable after creation
  • Automatic retries, proxy rotation, timeouts, and consistent exceptions
  • MCP over stdio or HTTP

Quick install

uv add brave-api-python

The following example is enough to try both APIs:

import asyncio

from brave_api import BraveClient


async def main() -> None:
    async with BraveClient() as client:
        answer = await client.ask("What is quantum computing?")
        print(answer.text)

        result = await client.search("Python asyncio tutorial")
        for item in result.web[:3]:
            print(item.title, item.url)


asyncio.run(main())

All network operations are asynchronous. Use async with so the HTTP session is opened and closed safely.

Learning path