PXI · UI code mode · Before and after
Ten turns or one
With one tool per UI action, every action costs a full model turn and its result lands in the context window. In code mode PXI writes the loop once, the browser runs it, and one result comes back.
Ten turns or one
Side-by-side sequence diagrams of the same task, comparing three playground models. Left, one tool per action: set model, run, read output, each a separate model turn with its result returned to PXI, repeated ten times. Right, code mode: one execute_browser_action call whose script loops over the three models in the browser and returns a single result. Tallies show ten model turns versus one.
Before · one tool per action EVERY ACTION IS A FULL MODEL TURN
Code mode · one script ONE MODEL TURN · THE SCRIPT DOES THE REST
Same task on both sides: run the playground against three models and compare the outputs.
MODEL TURN 1
set_playground_model
MODEL 1 → CONTEXT
MODEL TURN 2
run_playground
WAITS → CONTEXT
MODEL TURN 3
read_playground_output
OUTPUT 1 → CONTEXT
TURNS 4–10 · SAME THREE CALLS FOR MODELS 2 AND 3
MODEL TURN 1
execute_browser_action({ script })
Loop runs in the browser
for ( const { target } of models ) {
await ui.playground.model.set ( { target } )
await ui.playground.run ( { } )
await ui.playground.run.readOutput ( { } )
}
× 3 MODELS · 10 UI ACTIONS · 0 ROUND TRIPS
ONE RESULT · 3 OUTPUTS → CONTEXT
10 MODEL TURNS
10 RESULTS IN CONTEXT
1 MODEL TURN
1 RESULT IN CONTEXT
10 UI ACTIONS
Each turn re-reads the whole conversation plus every earlier result.
Intermediate outputs never enter the model's context.
AGENT
PXI
one tool per action
BROWSER
Phoenix UI
performs it
AGENT
PXI
writes a script
BROWSER
Phoenix UI
runs the script
LEGEND
Tool call
Result into PXI's context
One model turn
Work that moved into the browser
Previous
Play
Pause
Next
Replay
←/→ step · Space play/pause · R replay · Home/End jump
Step 6 of 6
Animation controls require JavaScript. The complete final diagram is shown above.
The many-tool design was correct but slow and expensive: each of the ten calls re-sent the whole conversation, and each result had to be pasted back for the next step. Code mode keeps the same per-action checks on the browser side while letting the script carry the control flow.