langchain-brime
Brime API · Docs · LangChain guide · Python SDK · Issues
LangChain meets the live web. Drop the Brime API into any LangChain agent, chain, or RAG pipeline — as three typed tools and a retriever you can plug in unchanged.
pip install langchain-brime
Python 3.9+. Sync and async. Fully typed (py.typed). SecretStr API keys. Actionable agent errors via handle_tool_error. Passes the official LangChain ToolsUnitTests compliance suite.
What you get
| Class | Type | What it does |
|---|---|---|
BrimeSearch |
BaseTool |
Fast SERP search with snippets + synthesised answer. |
BrimeExtract |
BaseTool |
Any URL → clean markdown (HTML / PDF / DOCX / SPA). |
BrimeResearch |
BaseTool |
Multi-round agent research with citations. |
BrimeRetriever |
BaseRetriever |
Live-web retriever for RAG — returns LangChain Documents. |
One API key powers all four. One set of tuned defaults. No knobs to babysit.
30 seconds
from langchain.agents import create_agent
from langchain_brime import BrimeSearch, BrimeExtract
agent = create_agent(
model="anthropic:claude-3-5-haiku-latest",
tools=[BrimeSearch(), BrimeExtract()],
system_prompt="You are a research assistant.",
)
result = agent.invoke({
"messages": [{"role": "user", "content": "What is BM25 ranking? Cite sources."}],
})
print(result["messages"][-1].content)
RAG without the RAG plumbing
BrimeRetriever returns standard LangChain Documents — drop it into any retrieval chain and you're querying the live web with BM25-ranked chunks:
from langchain_brime import BrimeRetriever
from langchain_core.prompts import ChatPromptTemplate
from langchain_core.runnables import RunnablePassthrough
from langchain.chat_models import init_chat_model
retriever = BrimeRetriever(k=5)
llm = init_chat_model("anthropic:claude-3-5-haiku-latest")
prompt = ChatPromptTemplate.from_template(
"Context:\n{context}\n\nQuestion: {question}\n\nAnswer with citations."
)
chain = ({"context": retriever, "question": RunnablePassthrough()} | prompt | llm)
print(chain.invoke("How does BM25 weight term frequency?").content)
Each Document carries page_content (ranked chunk) and rich metadata: url, title, score, published_date, source="brime".
Async, end-to-end
import asyncio
from langchain_brime import BrimeSearch
async def main():
result = await BrimeSearch().ainvoke({"query": "python async io patterns"})
print(result)
asyncio.run(main())
Every tool has _arun. The retriever has _aget_relevant_documents. No surprises.
Authentication
export BRIME_API_KEY="sk-brime-..."
BrimeSearch() # uses BRIME_API_KEY
BrimeSearch(api_key="sk-brime-...") # explicit
BrimeSearch(base_url="https://...") # staging override (or BRIME_BASE_URL)
Get a key at brime.dev — free tier: 1,000 credits/month, no card.
Tool reference
BrimeSearch
| Field | Default | Notes |
|---|---|---|
query |
(required) | Natural-language query |
topic |
"general" |
general · news · finance (recency hint) |
max_results |
5 | 1–20 |
time_range |
None | day · week · month · year |
Returns a markdown string with a synthesised answer plus a Sources: list.
BrimeExtract
| Field | Default | Notes |
|---|---|---|
urls |
(req.) | List of URLs (1–10) |
include_metadata |
False | Add extra metadata fields per result |
Returns markdown with a ## <url> heading per page, plus a ## Failed URLs block if any failed.
BrimeResearch
| Field | Default | Notes |
|---|---|---|
query |
(required) | Research question |
topic |
"general" |
Recency hint |
max_results |
5 | Sources per round, 1–20 |
Single tuned multi-round flow (~30–90 s) with cited synthesis.
BrimeRetriever
| Field | Default | Notes |
|---|---|---|
k |
5 | Max documents (1–20) |
topic |
"general" |
Recency hint |
time_range |
None | Recency window |
domains |
None | Domain allowlist |
exclude_domains |
None | Domain denylist |
include_answer |
False | Skip the LLM answer when used purely for retrieval |
Why this instead of writing your own wrapper?
- One package, four classes. Search, extract, research, and retriever — all sharing one HTTP client (
brimeSDK). - Idempotency, handled. Auto
Idempotency-Keyforextract(Brime API requirement, easy to miss). - Async parity throughout. No partially-async surface area.
- LangChain-tested. Passes the official
ToolsUnitTestscompliance suite (args schema serialisable, async parity, no override violations).
Compatibility
- Python 3.9+
langchain-core≥ 1.4, < 2.0- Backed by
brimePython SDK ≥ 0.2.0 (retry, request_id, typed error hierarchy)
Links
- Docs — docs.brime.dev
- LangChain integration guide — docs.brime.dev/sdks/langchain
- Status — brime.dev
- Issues — github.com/brime-dev/brime-langchain/issues
License
MIT © Brime
Metadata
Release files for langchain-brime 0.2.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| langchain_brime-0.2.2.tar.gz | 13.2 kB | Without provenance | Details for langchain_brime-0.2.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| langchain_brime-0.2.2-py3-none-any.whl | Python 3 | none | any | Details for langchain_brime-0.2.2-py3-none-any.whl |
Total release size: 29.3 kB
Release files / langchain_brime-0.2.2.tar.gz
| Download URL | langchain_brime-0.2.2.tar.gz |
|---|---|
| Size | 13.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0f73726a3622c36987f23a6567d7d9a18fbaf1bd7929ee58ba98581354f07eae
|
|
BLAKE2b-256 checksum How to use checksums |
9abdd900e0a707c0add5d4efff0f586582f1e47fca98f73ddd9f38fff0ece374
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.11.15 {"installer":{"name":"uv","version":"0.11.15","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / langchain_brime-0.2.2-py3-none-any.whl
| Download URL | langchain_brime-0.2.2-py3-none-any.whl |
|---|---|
| Size | 16.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
026ded1a188bae72b855344aaa65a73b1652ca3a87b531097b39acd6127e6f52
|
|
BLAKE2b-256 checksum How to use checksums |
c188f976566d1cc9acbcc8c100289acdb8e2112453f50b7fc8183f7f5a0e424d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.11.15 {"installer":{"name":"uv","version":"0.11.15","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for langchain-brime 0.2.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.