Uh oh!
There was an error while loading. Please reload this page.
feat(api): add client bootstrap and service facade - #655
Merged
Abhijeet Prasad (AbhiPrasad) merged 2 commits intoAug 12, 2026
Conversation
Add the synchronous BraintrustClient facade, AuthAPI organization discovery, and logical app/API/proxy routing. Bootstrap now follows this flow: configured app URL | v POST /api/apikey/login | v select organization + apply URL overrides | v EndpointRouter(APP, API, PROXY) | v BraintrustClient resource services New services share one policy-aware Transport and requests.Session, while unmigrated logger call sites retain isolated HTTPConnection sessions: resource services -> Transport -> shared session legacy app_conn -> HTTPConnection -> app session legacy api_conn -> HTTPConnection -> API session legacy proxy_conn -> HTTPConnection -> proxy session This keeps existing mutable adapter and retry behavior isolated until those endpoints migrate. BraintrustState lazily initializes the facade under a lock, then hydrates and authenticates all legacy connections from the same login. The public entry point is now: client = BraintrustClient(api_key="...", org_name="my-org") url = client.router.resolve(RequestTarget.PROXY, "function/invoke") Transport boundary in this commit: - New Transport: the main SDK bootstrap request, POST /api/apikey/login on the app target, runs through AuthAPI with RetryMode.SAFE_READ. - Service shells: projects, experiments, datasets, prompts, functions, queries, and attachments share the new Transport, but do not issue resource requests yet. Those endpoints migrate in follow-up changes. - Legacy app HTTPConnection: project lookup/registration, experiment lookup/registration and base-experiment lookup, dataset registration, organization patching, and the CLI install login path. - Legacy API HTTPConnection: ping/version discovery, logs3 ingestion and overflow setup, BTQL, v1 prompt/function/experiment/dataset reads, environment resolution, experiment and dataset summaries, attachments, and insert-functions writes. - Legacy proxy HTTPConnection: function invocation, sandbox creation/listing, and code-bundle allocation. - Signed object-storage uploads/downloads remain on separate token-less HTTPConnection instances and never use the routed Braintrust session.
Luca Forstner (lforst)
approved these changes
Aug 12, 2026
Uh oh!
There was an error while loading. Please reload this page.
Abhijeet Prasad (AbhiPrasad)
deleted the
abhi-client-bootstrap-and-facade
branch
August 12, 2026 15:05
This was referenced Aug 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for freeto join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
builds on top of #653 and #641
Add the synchronous BraintrustClient facade, AuthAPI organization discovery, and logical app/API/proxy routing. Bootstrap now follows this flow:
New services share one policy-aware Transport and requests.Session, while unmigrated logger call sites retain isolated HTTPConnection sessions:
This keeps existing mutable adapter and retry behavior isolated until those endpoints migrate. BraintrustState lazily initializes the facade under a lock, then hydrates and authenticates all legacy connections from the same login.
The public entry point is now:
Transport boundary in this commit:
Only
POST /api/apikey/loginwas converted to use the new transport. Everything else will be migrated incrementally.