feat(arena): add CoreWeave Sandboxes workshop notebook#77
Open
ntnadkarni wants to merge 6 commits into
Open
Conversation
Adds a hands-on Arena notebook that walks through the full Sandboxes lifecycle: author a profile, deploy a managed runner on a CKS cluster, launch a sandbox via the cwsandbox Python SDK, run a parallel reward-evaluation batch (the canonical RL-with-verifiable-rewards pattern), and trace each reward call to W&B via Weave. - Single self-contained file, follows arena-staging guidelines - Verified deps install cleanly in marimo --sandbox mode - Hardware-agnostic (talks to Sandboxes API, no GPU dependency) - Idempotent: re-running Step 1/2 reuses existing profile/runner - Optional W&B token gates Weave tracing without breaking the flow Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Drop the marketing-flavored "canonical pattern that drives this product" lead-in and the extract_xml_answer / TRL-GRPO follow-on paragraph. Reads more neutrally. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
MYanello
reviewed
Jun 2, 2026
…extra fields Move kubernetes imports inside detect_cw_token so callers that don't need kubeconfig parsing can use lib.coreweave (e.g. cw_token_input) without pulling in the kubernetes dep chain. ImportError on the kubernetes import is caught and falls through to the "Not Found" path, so the lib stays usable in environments that don't have kubernetes installed at all. cw_token_input now accepts an optional extra_fields mapping. With no args the rendered form is byte-identical to before. With extra_fields, the form renders all fields together so a notebook can collect the CW token plus auxiliary credentials in a single submit.
…auth - Auto-detect a CoreWeave access token via detect_cw_token() (Arena pod identity → CW_TOKEN env var → kubeconfig). Form falls back when nothing is found, and the W&B field is offered in either path. - Switch sandbox SDK auth from os.environ["CWSANDBOX_API_KEY"] to the SDK's set_auth_mode hook, with the token captured in a lambda closure. The token stays in memory only — never enters the process environment, never inherited by child processes. - Replace free-text cluster zone / name inputs with a dropdown populated from GET /v1beta1/cks/clusters (filtered to STATUS_RUNNING). Invalid combinations are no longer possible. - Prerequisites bullet updated to describe the auto-detect path.
Replace the manual "Poll runner state" button with an auto-poll loop that fires as soon as a runner is submitted. Progress lines stream into the cell output every 3 seconds via mo.output.append() so the user can watch installStatus / connectionStatus evolve in real time. The loop exits cleanly on three outcomes: - READY + CONNECTED — green success callout with elapsed seconds - HTTP error from the runner GET — red callout with the response body - 180-second timeout — yellow warning callout suggesting a re-run
- Expand Step 1's intro with a bullet-list field reference for the profile form (display name, namespace strategy, egress mode, runtime class, CPU/memory limit) linking to the docs. - Mark every remaining chrome cell with hide_code=True so the rendered app view shows no Python source. - Tighten a few inline copy edits.
MYanello
reviewed
Jun 12, 2026
| @@ -0,0 +1,970 @@ | |||
| # /// script | |||
| # requires-python = ">=3.12" | |||
| # dependencies = [ | |||
Contributor
There was a problem hiding this comment.
add new dependencies to the project pyproject.toml
MYanello
reviewed
Jun 12, 2026
|
|
||
| To access the token in your code, use token_form.value.get("cw_token") | ||
| Args: | ||
| extra_fields: Optional mapping of {name: widget} for additional |
Contributor
There was a problem hiding this comment.
I don't think this is appropriate to include in a function called cw_token_input(). You changed a 15 line function into a 50 line one to avoid adding a "wandb_token_input" function. Two options I see to help here:
- Generalize this function to just be "token_input()" and make sure it keeps working in the other 2 existing notebooks.
- Add a new reusable wandb_token_input() function to this library
MYanello
reviewed
Jun 12, 2026
| container image, runtime class, namespace strategy, network policy, and | ||
| pod placement. | ||
|
|
||
| Field reference (full schema in the [Profile reference docs](https://docs.coreweave.com/products/sandboxes/reference/profile)): |
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 free
to 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.
Adds
arena/notebooks/sandboxes-workshop.py— a hands-on Arena notebook that walks through the full lifecycle of a CoreWeave Sandbox: author a profile → deploy a managed runner → launch a sandbox via the Python SDK → run a parallel reward-evaluation batch → trace every reward call to W&B via Weave → clean up.