Python SDK for BrowseAI Dev — reliable research infrastructure for AI agents
Project description
browseai
Reliable research infrastructure for AI agents. Python SDK for BrowseAI Dev — the research layer for LangChain, CrewAI, and custom agent pipelines.
Install
pip install browseai
Quick Start
from browseai import BrowseAI
client = BrowseAI(api_key="bai_xxx")
# Research with citations
result = client.ask("What is quantum computing?")
print(result.answer)
print(f"Confidence: {result.confidence:.0%}")
for source in result.sources:
print(f" - {source.title}: {source.url}")
# Thorough mode — auto-retries if confidence < 60%
deep = client.ask("What is quantum computing?", depth="thorough")
# Web search
results = client.search("latest AI news", limit=5)
# Page extraction
page = client.open("https://example.com")
# Structured extraction from a URL
extract = client.extract("https://example.com", query="pricing info")
# Compare raw LLM vs evidence-backed
compare = client.compare("Is Python faster than Rust?")
Async
from browseai import AsyncBrowseAI
async with AsyncBrowseAI(api_key="bai_xxx") as client:
result = await client.ask("What is quantum computing?")
# Thorough mode works with async too
deep = await client.ask("What is quantum computing?", depth="thorough")
Streaming (REST API)
For real-time progress events, use the streaming endpoint directly:
import httpx
with httpx.stream("POST", "https://browseai.dev/api/browse/answer/stream",
json={"query": "What is quantum computing?"},
headers={"X-Tavily-Key": "tvly-xxx", "X-OpenRouter-Key": "sk-or-xxx"}
) as response:
for line in response.iter_lines():
if line.startswith("data: "):
print(line[6:])
Events: trace (progress), sources (discovered early), result (final answer), done.
Research Memory (Sessions)
Persistent research sessions that accumulate knowledge across multiple queries. Later queries recall prior knowledge — faster, cheaper, more coherent.
from browseai import BrowseAI
client = BrowseAI(api_key="bai_xxx")
# Create a session
session = client.session("wasm-research")
# Each query builds on previous knowledge
r1 = session.ask("What is WebAssembly?")
r2 = session.ask("How does WASM compare to JavaScript performance?")
# ^ r2 recalls WASM knowledge from r1, only searches for JS perf
# Query accumulated knowledge without new searches
recalled = session.recall("WASM")
for entry in recalled.entries:
print(f" {entry.claim} (from: {entry.origin_query})")
# Export all knowledge
knowledge = session.knowledge()
Async sessions work the same way:
async with AsyncBrowseAI(api_key="bai_xxx") as client:
session = await client.session("my-project")
r1 = await session.ask("What is WASM?")
r2 = await session.ask("WASM vs JS?")
BYOK (Bring Your Own Keys)
client = BrowseAI(tavily_key="tvly-xxx", openrouter_key="sk-or-xxx")
LangChain
pip install browseai[langchain]
from browseai.integrations.langchain import BrowseAIAskTool
tools = [BrowseAIAskTool(api_key="bai_xxx")]
CrewAI
pip install browseai[crewai]
from browseai.integrations.crewai import BrowseAITool
researcher = Agent(tools=[BrowseAITool(api_key="bai_xxx")])
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file browseai-0.1.3.tar.gz.
File metadata
- Download URL: browseai-0.1.3.tar.gz
- Upload date:
- Size: 8.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d9159b165f64a360a00778506e920937206f35e2c62589f6cf0bdf4759c31734
|
|
| MD5 |
e2fa898444802e1b67e7079a69702383
|
|
| BLAKE2b-256 |
f05a1d106b93d8936890b17a6a8170a455c4c61afc615cc918a404e632984b01
|
File details
Details for the file browseai-0.1.3-py3-none-any.whl.
File metadata
- Download URL: browseai-0.1.3-py3-none-any.whl
- Upload date:
- Size: 11.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
81181619717505b13745c9374f296fab700be76004fcdf4d515864ba04cb7d6d
|
|
| MD5 |
e89dbd069d4b3e8c105b638d895b44cb
|
|
| BLAKE2b-256 |
446fa834d30d8b684bc1b4ba1eb350923f58458c29e7e6088cea62db2d4ac0a2
|