Metadata-Version: 2.5
Name: render-lab-tasks-braintrust
Version: 0.1.0
Summary: braintrust tasks for Render Workflows
Project-URL: Repository, https://github.com/render-lab/render-tasks-python
License-Expression: MIT
License-File: LICENSE
Requires-Python: >=3.12
Requires-Dist: httpx<0.29,>=0.28
Requires-Dist: render-lab-tasks-core<0.2,>=0.1.1
Requires-Dist: render==1.0.1
Description-Content-Type: text/markdown

# render-lab-tasks-braintrust

Unreleased Python port: **12 registered tasks** from
[render-lab/render-tasks](https://github.com/render-lab/render-tasks/tree/45f9c2d44bd28e01ae9813e0d2ff56ee6c533816/packages/tasks-braintrust).
Python 3.12+, Render SDK 1.0.1. Requires core 0.1.1 or later.

From the repository root:

```sh
uv sync --all-packages --locked
```

Import `render_lab_tasks_braintrust.tasks` to register tasks. The package root is inert.
Compose the exported `app` with `Workflows.from_workflows`; call tasks through
`ctx.run`. Every operation also exports `*_impl(ctx, input, *, deps=None)` for
injection. `Client(http, env)` accepts a caller-owned HTTPX client, and
`Deps(braintrust=client)` injects it. Default dependencies open and close the HTTP
client per invocation; credentials are read lazily at use. No HTTP retries or
background vendor polling occur; `retry.py` owns the durable retry policies.

## Task surface

| Registered task | Python export |
| --- | --- |
| `braintrust.addFeedback` | `add_feedback` |
| `braintrust.awaitReview` | `await_review` |
| `braintrust.deleteDatasetRows` | `delete_dataset_rows` |
| `braintrust.ensureDataset` | `ensure_dataset` |
| `braintrust.ensureExperiment` | `ensure_experiment` |
| `braintrust.gateExperiment` | `gate_experiment` |
| `braintrust.getReviewProgress` | `get_review_progress` |
| `braintrust.listDatasetRows` | `list_dataset_rows` |
| `braintrust.logExperimentResults` | `log_experiment_results` |
| `braintrust.runEval` | `run_eval` |
| `braintrust.summarizeExperiment` | `summarize_experiment` |
| `braintrust.upsertDatasetRows` | `upsert_dataset_rows` |

Typed JSON inputs and results are in `types.py`. Task names and JSON field names
match the pinned source; Python function names use snake_case.

## Environment

| Variable | Requirement |
| --- | --- |
| `BRAINTRUST_API_KEY` | Required at first API call. |
| `BRAINTRUST_API_URL` | Optional; https://api.braintrust.dev by default. |

## Behavior and limits

Stable row IDs are required for upserts and experiment logs. Eval starts and release gates have no retries. Review polling counts rows carrying a score against root-row totals, matching the source; confirm review semantics with nested spans. Dataset pages and experiment summaries reject serialized results at or above 4 MiB. Gate errors contain the violated thresholds. Review polling and result counts remain unverified against a real project.

## Verification

All registered tasks have hermetic contract fixtures executed independently against
the pinned TS implementation. SDK-backed tasks also have explicit HTTP request
fixtures. See `tests/test_batch3_contracts.py` and `tests/test_batch3_edges.py`.
These are not live vendor results.

Vendor webhooks subpaths and other registration-free TS exports are outside this
batch unless explicitly listed above. Full registered-task coverage does not
imply all supporting exports are ported.

Pending scopes, test resources, replay, and hosted checks are in the
[live-testing backlog](https://github.com/render-lab/render-tasks-python/issues/1)
and [verification tracker](../../docs/verification-tracker.md).

## Installation

```sh
pip install render-lab-tasks-braintrust==0.1.0
```
