Quickstart
-
Install an SDK, and set a sandbox key. Any key that starts
pk_test_reaches the sandbox. Afterpk_test_, use letters, digits and underscores, up to 64 of them. Make one up, and you get a workspace of your own with four sample models and their experiments.Terminal window npm install @pensievelab/sdkexport PENSIEVE_API_KEY=pk_test_yournameTerminal window pip install pensievelabexport PENSIEVE_API_KEY=pk_test_yournameTerminal window export PENSIEVE_API_KEY=pk_test_yournameThe packages aren’t on npm and PyPI yet. Until they are, the HTTP tab works as it is.
-
See what the agents kept.
grade-auditchecks whether a coding task’s grade holds. List the experiments that won:import Pensieve from "@pensievelab/sdk";const pensieve = new Pensieve(); // reads PENSIEVE_API_KEYfor await (const e of pensieve.experiments.list("grade-audit", { status: "kept" })) {console.log(e.id, e.method, e.lead_points, e.idea);}from pensievelab import Pensieveclient = Pensieve() # reads PENSIEVE_API_KEYfor e in client.experiments.list("grade-audit", status="kept"):print(e.id, e.method, e.lead_points, e.idea)Terminal window curl "https://api.pensievelabs.co/v1/models/grade-audit/experiments?status=kept" \-H "Authorization: Bearer $PENSIEVE_API_KEY"exp_0418 fine-tuning 1.3 Weight overturned grades 4×exp_0416 preference-tuning 0.9 Preference-tune on right and wrong gradesexp_0414 distillation 0.4 Distil from a 70B open teacher first -
Read how one was judged. Each experiment trained the current recipe (A) and the change (B) on three seeds, then checked B on cases neither had seen:
for await (const run of pensieve.experiments.runs.list("exp_0418")) {console.log(run.label, run.arm, run.seed, run.score ?? run.lead_points);}for run in client.experiments.runs.list("exp_0418"):print(run.label, run.arm, run.seed, run.score or run.lead_points)Terminal window curl https://api.pensievelabs.co/v1/experiments/exp_0418/runs \-H "Authorization: Bearer $PENSIEVE_API_KEY" -
Read the recipe they add up to. The live version, v7, is made of the three kept changes:
const v7 = await pensieve.models.versions.retrieve("grade-audit", "v7");for (const step of v7.recipe?.steps ?? []) console.log(step.method, step.description);v7 = client.models.versions.retrieve("grade-audit", "v7")for step in v7.recipe.steps:print(step.method, step.description)Terminal window curl https://api.pensievelabs.co/v1/models/grade-audit/versions/v7 \-H "Authorization: Bearer $PENSIEVE_API_KEY" -
Call the model. The answer is always one of its fixed values, so your code can act on it:
const decision = await pensieve.models.decide("grade-audit", {input: { task: "rust-2291", grade: "pass", log: "Test change: expected page size 20 → 21" },key: "rust-2291",});console.log(decision.answer, decision.confidence, decision.version); // false_pass 0.94 v7decision = client.models.decide("grade-audit",input={"task": "rust-2291", "grade": "pass", "log": "Test change: expected page size 20 → 21"},key="rust-2291",)print(decision.answer, decision.confidence, decision.version) # false_pass 0.94 v7Terminal window curl https://api.pensievelabs.co/v1/models/grade-audit/decide \-H "Authorization: Bearer $PENSIEVE_API_KEY" \-H "Content-Type: application/json" \-d '{"input": {"task": "rust-2291", "grade": "pass", "log": "Test change: expected page size 20 → 21"}, "key": "rust-2291"}' -
Send back what happened. When the lab rejects the task, say so. Outcomes check every version against reality, and become rewards and training data for the next experiments.
await pensieve.outcomes.send(decision.id, { outcome: "lab_rejected" });client.outcomes.send(decision.id, outcome="lab_rejected")Terminal window # Call the model and keep the call's idCALL_ID=$(curl -s https://api.pensievelabs.co/v1/models/grade-audit/decide \-H "Authorization: Bearer $PENSIEVE_API_KEY" \-H "Content-Type: application/json" \-d '{"input": {"task": "rust-2291", "grade": "pass", "log": "Test change: expected page size 20 → 21"}, "key": "rust-2291"}' | jq -r .id)curl https://api.pensievelabs.co/v1/calls/$CALL_ID/outcome \-H "Authorization: Bearer $PENSIEVE_API_KEY" \-H "Content-Type: application/json" \-d '{"outcome": "lab_rejected"}'
Paste this into your coding agent, in the project that makes the decision today:
Read https://docs.pensievelabs.co/agents.md, then wire Pensieve into this project with a sandbox key.The agent finds the function that makes the decision, wraps it so every call is recorded as data for experiments, and tests it against the sandbox. It never needs a live key: you set PENSIEVE_API_KEY yourself. See Use Pensieve from a coding agent.
- Experiments: how an experiment is set up, run and judged.
- Start from a data source: what Pensieve needs to start experimenting on your data.