ByteRover Python SDK
The official Python SDK for the ByteRover API: search your team's drives and manage their documents.
pip install byterover
Python 3.11 or later · sync and thread-safe · typed
Upgrading from
byterover0.1.x? Version 0.2 is a new SDK with a different API. To keep the old client, pinbyterover<0.2.
Quick start
Create an API key in ByteRover (Team → API keys → Create key) and set it as BYTEROVER_API_KEY.
See Authentication.
from byterover import ByteRover
client = ByteRover() # reads BYTEROVER_API_KEY
found = client.search(
query="How long do refunds take in the EU?",
drive_ids=["drv_…"],
effort="medium",
)
for result in found.results:
print(result.text)
Use the client in a with block, or call client.close() when you're done.
Configuration
client = ByteRover(timeout=30.0, max_retries=2) # api_key= overrides BYTEROVER_API_KEY
| Option | Default |
|---|---|
api_key |
BYTEROVER_API_KEY (required) |
base_url |
BYTEROVER_BASE_URL, then https://byterover.ai/api |
timeout |
60 s per network step; 105 s for a medium search, 135 s for high |
max_retries |
2 |
http_client |
a new httpx.Client |
logger |
none |
The SDK's error messages and logs never include the key, and the httpx errors it chains hold their request without
it. repr(client) shows only brv_ and four characters.
Usage
| Resource | Methods |
|---|---|
client.search |
search one or more drives |
client.key |
retrieve |
client.drives |
list, retrieve |
client.folders |
list, create, move, delete |
client.documents |
list, retrieve, list_revisions, read, content, put_text, update, copy, delete, upload, upload_directory |
client.uploads |
create, list_parts, put_part, complete, resume |
client.operations |
retrieve, wait |
client.request |
any other /v1/ endpoint |
Field names match the API (drive_ids, next_cursor). Responses are pydantic models.
To rename a document or move it within its drive, use documents.update(document_id, path=...);
documents.copy(..., move=True) moves it into another drive.
Pagination
for document in client.documents.list(drive_id, folder="/policies"):
print(document.path)
Raw responses
answered = client.with_raw_response.documents.retrieve(document_id)
print(answered.status, answered.trace_id)
Uploads
Upload a file
result = client.documents.upload(drive_id, "/reports/q3.pdf", "q3.pdf", wait="searchable")
print(result.document.id)
The SDK hashes the file, sends it in parts, retries failed parts and completes the upload. The source can be a file
path, bytes, a binary file opened with open(path, "rb"), or an object with size and read(start, end).
Resume after a crash
from byterover import UploadIncompleteError
try:
client.documents.upload(drive_id, path, file, on_upload_created=lambda saved: store.put(path, saved))
except UploadIncompleteError:
client.uploads.resume(store.get(path), file)
If the upload already completed, resume answers UPLOAD_CLOSED: look for the path with documents.list.
Upload a folder
result = client.documents.upload_directory(drive_id, "handbook", prefix="/handbook")
print(len(result.succeeded), len(result.uploaded_not_ready), len(result.failed), len(result.skipped))
Hidden files, empty files and symbolic links are skipped. Links inside the folder are never followed, and a
subfolder or file swapped for a link while the folder is read is refused (in failed). The folder you pass is read
even when it is itself a link. The checks go by path, so a program that keeps swapping a folder for a link while the
upload runs could still, with exact timing, get a file from outside read: don't upload a folder that other programs
are changing. uploaded_not_ready files were uploaded but their wait failed: don't upload them again. Send the
failed ones again.
Wait for processing
result = client.documents.upload(drive_id, "/reports/q3.pdf", "q3.pdf")
client.operations.wait(result.operation.id)
More: Uploads guide.
Errors
Every error extends ByteRoverError. API errors extend APIStatusError and carry status, code, message and
trace_id.
from byterover import NotFoundError, RateLimitError
try:
client.documents.retrieve(document_id)
except NotFoundError:
print("not found")
except RateLimitError:
print("slow down")
| Status | Error |
|---|---|
| 400 | BadRequestError |
| 401 | AuthenticationError |
| 402 | InsufficientBalanceError |
| 403 | PermissionDeniedError |
| 404 | NotFoundError |
| 409 | ConflictError |
| 429 | RateLimitError |
| 500 | InternalServerError |
| 503, 504 | ServiceUnavailableError |
| no response | APIConnectionError, APITimeoutError |
Quote the trace_id when you contact support.
Retries
Reads are retried on connection errors, timeouts, 429 and 5xx. Writes and searches are retried only when they are known not to have run (the connection failed before sending, or the API's own 429), so nothing runs twice.
After a write's outcome is unknown, check the state first, then send it again with the same idempotency_key. The API
answers a repeated key with the first result for 24 hours:
client.documents.put_text(drive_id, path="/notes/today.txt", text=text, idempotency_key="notes-2026-11-15")
Requirements
| Supported | |
|---|---|
| Python | 3.11, 3.12, 3.13 |
| Dependencies | httpx (BSD-3-Clause), pydantic (MIT) |
Versioning
This SDK is at 0.x: a minor version (0.2 → 0.3) may include breaking changes; a patch version doesn't. Pin a minor
version, such as byterover>=0.2,<0.3. See Versioning and support and
the changelog.
Links
License
MIT
Metadata
Release files for byterover 0.2.3
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 |
|---|---|---|---|---|
| byterover-0.2.3.tar.gz | 54.9 kB | Without provenance | Details for byterover-0.2.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| byterover-0.2.3-py3-none-any.whl | Python 3 | none | any | Details for byterover-0.2.3-py3-none-any.whl |
Total release size: 124.7 kB
Release files / byterover-0.2.3.tar.gz
| Download URL | byterover-0.2.3.tar.gz |
|---|---|
| Size | 54.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ddca1ba715e90d06cdc6670bfc4029b6405d4714ebe67f85e2703626f7788f17
|
|
BLAKE2b-256 checksum How to use checksums |
0bf7bfca5a97c4bf067245e44e6d7019f3bae2c77832e7d12e77c1b931e3f48a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / byterover-0.2.3-py3-none-any.whl
| Download URL | byterover-0.2.3-py3-none-any.whl |
|---|---|
| Size | 69.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5683aa4f181b0cb0dcdc74787f544ffe640276133ad7ab923abf12e43b8e24ab
|
|
BLAKE2b-256 checksum How to use checksums |
3719ce080fbc68b574aad236ed5942369e7348f9a0c7d316187036624a2801df
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for byterover 0.2.3
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.