PXI · UI code mode · Script walkthrough

One tool call, ten UI actions

The script owns the control flow. A for loop over three models becomes ten UI actions inside a single execute_browser_action call, with no round trip to the model in between.

One tool call, ten UI actions Walkthrough of a nine-line script: it lists the playground models, then loops over the three results, setting each model, running the playground, and reading the output. The dispatch log beside the code fills with ten UI actions, and the script returns all three results to PXI in one tool output. THE SCRIPT · ONE execute_browser_action CALL UI ACTIONS DISPATCHED TO THE PAGE EACH AWAIT #01playground.model.list→ 3 models #02playground.model.setmodel 1 of 3 #03playground.runwaits for the run #04playground.run.readOutput→ output #05playground.model.setmodel 2 of 3 #06playground.runwaits for the run #07playground.run.readOutput→ output #08playground.model.setmodel 3 of 3 #09playground.runwaits for the run #10playground.run.readOutput→ output RESULT Returned to PXI as one tool output results · 3 entries · plus logs and per-call telemetry 1 TOOL CALL 10 of 50 UI ACTIONS 1 MODEL TURN 1 const { output } = await ui.playground.model.list({}); 2 const results = []; 3 for (const { target } of output.builtinModels) { 4 await ui.playground.model.set({ target }); 5 await ui.playground.run({}); 6 const run = await ui.playground.run.readOutput({}); 7 results.push({ model: target.modelName, run: run.output }); 8 } 9 return results; WITHOUT CODE MODE · 10 MODEL TURNS, EACH PASTING THE LAST RESULT BACK IN WITH CODE MODE · 1 MODEL TURN one execute_browser_action call · 10 UI actions The loop runs in the browser; PXI never sees the middle. Ten intermediate results stay out of the model's context window. The script can also branch, filter, and reshape before returning. LEGEND Line being executed (animation only) #07 One dispatched UI action, in order Crosses from worker to main thread
←/→ step · Space play/pause · R replay · Home/End jump

Every await ui.* is one action request from the worker to the page. The script can branch, loop, batch, and reshape results before returning, so PXI spends one turn instead of ten. The main thread still checks every action and enforces the budgets: 50 actions and 30 s of execution per script.