Skip to main content

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 byterover 0.1.x? Version 0.2 is a new SDK with a different API. To keep the old client, pin byterover<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 key is never printed in full: logs, errors and repr show 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.

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)

Upload a folder

result = client.documents.upload_directory(drive_id, "handbook", prefix="/handbook")
print(len(result.succeeded), len(result.failed), len(result.skipped))

Hidden files, empty files and symbolic links are skipped.

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 a 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.

License

MIT

Metadata

Release files for byterover 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for byterover 0.2.1
File Size Uploaded Provenance Actions
byterover-0.2.1.tar.gz 50.0 kB Without provenance Details for byterover-0.2.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for byterover 0.2.1
File Interpreter ABI Platform Actions
byterover-0.2.1-py3-none-any.whl Python 3 none any Details for byterover-0.2.1-py3-none-any.whl

Total release size: 115.7 kB

Release files / byterover-0.2.1.tar.gz

Download URL byterover-0.2.1.tar.gz
Size 50.0 kB
Tags Source
SHA-256 checksum
How to use checksums
859a779f8296d7366b33a3d6671bec159dec6aafa2929bab0cffb13a8c197163
BLAKE2b-256 checksum
How to use checksums
3b8161e56a78991d86806a85ba5979a32e2574690fcd14ffedc2c34350b935bc
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.1-py3-none-any.whl

Download URL byterover-0.2.1-py3-none-any.whl
Size 65.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b65cc698da0fa637c0f17752a9e162355e3d885cee06d29627e29bf53da9eee7
BLAKE2b-256 checksum
How to use checksums
dfee27af46e4dce08b33fb4853fbb6c94fe6dce6e6e9625c4cf52986db5a1964
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.1

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page