Replay a run from any step, with edits
A playground replay re-runs a recorded run from step N: steps 0 to N−1 are kept exactly as the model saw them, and step N onwards runs fresh in your process. It runs on the scripted engine, which answers each step with the recorded model output and costs nothing, or live, which calls the model. Before it runs you can edit what it keeps: the turn’s prompt, a reply, a tool result or a call’s arguments, or a message inserted between steps. Studio checks the target agent and previews the exact request before Run.
The smallest replay is one command naming the source run, the step and the agent. Against the example program from How does the playground work?, keep step 0 (the lookup_order call and its result) and re-run step 1 under a new system prompt:
curl -s -X POST http://127.0.0.1:8080/studio/api/playground/runs -d '{ "command_id": "cmd_docs_1", "runtime": "rt_6ea843dccc7741ff", "agent": "acme-support", "source": {"run_id": "dd66354adfaac2b44848f0c1ed75516f", "from_step": 1}, "overrides": {"instructions": "You are Acme'"'"'s support agent. Always include the tracking link.", "options": {"temperature": 0.2}}, "engine": "live", "side_effects": "substitute", "thread": "ephemeral", "experiment_id": "tracking-link"}'{"command_id":"cmd_docs_1","state":"queued"}runtime is an id from GET /api/runtimes (See your runtimes). The command’s row then names the replay, a pg_ run:
{"command_id":"cmd_docs_1","state":"finished","run_id":"pg_01M5780D5BYHQNGQDWRXR84HAZ","status":"succeeded","error":null,"created":"2026-10-18T12:13:07.369713696+02:00","updated":"2026-10-18T12:13:07.376531416+02:00"}The replay’s run row carries "forked_from":"dd66354adfaac2b44848f0c1ed75516f#1", "playground":true and "experiment_id":"tracking-link", and its meta carries "weft.playground.command":"cmd_docs_1" and "weft.replay.view":"transcript"; the weft.playground attribute is what the row’s playground reads. Its run header reads “replay of <source> · step 1” and its runs-table row ”↻ replay of <source> · step 1”, both linking the source step. The same command, as the experiments page’s variant b, files it under tracking-link.
How it works
Section titled “How it works”The command’s source is {run_id, from_step}, and from_step counts the source run’s own steps (the step ordinal Studio shows). The input the turn was given is context, not a step. The replay’s input is what step from_step’s model call carried, its request record’s messages (ADR 0029 decision 1):
from_stepN > 0 keeps steps 0 to N−1 and runs from N. When that request carried aPrepareStepcompaction view, the replay is fed the view, the model’s exact input there, on every source path (the local sink, Studio, thread storage); the scripted engine keys its recorded turns over the compacted prefix too.from_step0 re-runs the whole turn from what it was fed: its step-0PrepareStepruns again over the original input, and nothing is kept. With noinputthe replay reuses the source’s user message;inputreplaces it, and the conversation before the turn stays. That needs the source transcript: when the runtime cannot resolve it, the replay runs on theinputalone (gotcha).from_stepequal to the step count is accepted when the source’s last step ended in answered tool calls, as a run that failed or hit its budget does: the replay’s first model call answers those results. After a call-free reply it is refused.
GET /api/runs/{id}/transcript?step=N serves that prefix: step, messages (what step N’s model call carried) and compacted_at, the view it carried or null. For the example’s source, ?step=1 is the prompt, the call and its result:
curl -s 'http://127.0.0.1:8080/studio/api/runs/dd66354adfaac2b44848f0c1ed75516f/transcript?step=1' | jq '{step, messages, compacted_at}'{ "step": 1, "messages": [ {"role": "user", "content": [{"type": "text", "text": "Where is my order #4411?"}]}, {"role": "assistant", "content": [{"type": "tool_call", "id": "c1", "name": "lookup_order", "args": {"order_id": "4411"}}]}, {"role": "tool", "content": [{"type": "tool_result", "call_id": "c1", "name": "lookup_order", "content": "{\"order_id\":\"4411\",\"status\":\"shipped\"}", "is_error": false}]} ], "compacted_at": null}A step past the run’s last is 404; records that do not rebuild the step are 409 with their hole (gap, stripped). The runtime splits every source the same way, into the turn’s input and the run’s own steps, whether it reads thread storage, the local sink or Studio. A thread-stored source whose records cannot rebuild the step (content off) replays on the thread’s messages with a warning; a turn that ran over a summarized context is refused on the thread path, and the runtime then reads the source from the local sink, else from Studio. The scripted engine replays reasoning and tool-call signatures as recorded. A run derived from stock OTel spans has no transcript to replay, and the run and preview routes refuse it 400 with the derived badge.
The replay carries weft.forked_from = "<source run>#<from_step>" and, from step N > 0, weft.replay.view: how its prefix knew what the model saw.
weft.replay.view | Means |
|---|---|
transcript | step N’s request record placed the plain transcript |
compacted:<index> | it named the run-scope compaction view at that record index, spliced in |
derived | no request record placed N’s messages: the from_step cut rule applied |
unknown | the records could not be read (a thread source with Studio unreachable or content off, a Studio older than ?step=) |
The last two are the replay’s derived hole on its run page, its reason naming the mark and the source step, so a fallback is never silent. The replay’s header says the mark in words beside that badge: “fed the compacted view #7” for compacted:7, “prefix derived” for derived and “prefix view unknown” for unknown; transcript adds nothing. A replay is ephemeral by default: it never carries weft.session.id. To continue a conversation instead, send "thread": "fork" with an input and from_step 0 (Engines and threads).
A subagent’s child run is its own source. Send the child’s id (<parent>/<step>/<call>) as source.run_id and the child’s agent, registered on the runtime by that name, as agent. The child replays as its own run, with weft.forked_from = "<child id>#<from_step>" and no parent linkage. A replay of the parent from the step that called the child substitutes or parks that Subagent call like any never-class call; the child is not re-run.
The limit: your agent’s own PrepareStep runs over the replay’s prefix. The model’s input is exact when that PrepareStep is idempotent over its own output. One keyed on a count or an index re-shapes the replay’s input.
A replay continues the turn
Section titled “A replay continues the turn”A replay from step N > 0 is the same turn, not a new one. The runtime runs it with weft.KeptSteps(N), on the live engine and the scripted one alike, so the kept steps count toward the agent’s guards as if the replay had made them:
MaxStepsbudgets the whole turn. The replay makes at mostMaxSteps− N model calls, and none when N reaches it.DetectLoops’ streak starts from the kept steps’ tool calls.- The usage limit,
MaxModelRetriesandStopWhensee the replay’s own spend and steps. The kept steps’ usage is not in its input.
An unchanged replay of a turn that a guard stopped therefore stops the same way at the same step, with the same max_steps or loop_detected end, and the compare reads its rows kept · same. A decision on a parked replay resumes with a fresh budget, as any resume does.
The replay’s own record numbers its steps from 0. A command’s error names the step in the source’s ordinals and says so. For a replay from step 2 that fails at its own step 1:
weft: run failed at step 3 (the source's step ordinal; this run's step 1): …Replay from the run page
Section titled “Replay from the run page”You rarely type the command. On Studio’s run page, the verbs open the replay drawer pre-filled. Each step card carries “replay from this step (step N)”, “edit the prompt and replay (step N)”, “re-run the whole turn” and, on a session’s top-level turn, “continue here with a new message”. The run tree’s drawer has its own shorter labels for the selected row:
| Drawer verb | The replay drawer’s title | What it pre-fills |
|---|---|---|
| replay from here ▸ | Replay from this step | from_step N |
| edit result… | Edit this result and replay | from_step N+1, an empty edit field for the call’s result with the recording beside it |
| edit… | Edit the prompt and replay | the step’s own system prompt from its request record |
| replay the child ▸ | Re-run | the child run as its own source, under its own agent |


The step cards’ “re-run the whole turn” and “continue here with a new message” open the drawer as Re-run and Continue here with a new message (a fork). In the devtools panel, a turn’s ✎ Replay… button opens it with no verb, titled Replay. With the drawer open, the story rings the step it replays from (“replaying from here”) and draws the steps before it faint, marked “kept”. The replay’s result head in the devtools panel reads “Replay 1 of t3 · scripted · finished” (its number among the turn’s replays, the engine and the run’s status word), and its chip “replay of t3 · step 0”. A run that is still running reads “replay after the run ends”; a read token reads “a read token cannot replay: it needs the dev token or a playground panel token”.
The replay drawer
Section titled “The replay drawer”The drawer reads top to bottom in the order a command is decided, the same in Studio and in the devtools panel:
- source and target: the run and step it replays, and the agent it replays them on (The target check).
- engine: scripted or live, with what each costs (Choose the engine).
- 1 what changes, 2 will be sent (Preview) and 3 tools during the replay.
- advanced: side effects · where it writes · options, folded: the side-effect mode, Write to (“nowhere (ephemeral)” or “a new session (fork)”) and the option lab.
- Run, in a footer that stays in view, naming its engine.
Under “tools during the replay” the drawer lists each tool of the step’s catalog and what its calls would do:
| The drawer says | When |
|---|---|
| replay safe · runs | the tool is weft.Replay(weft.ReplaySafe) |
| replay never (unannotated) · substituted from the recorded result when the call repeats, else parked | an unannotated tool under substitute |
| … · parks (side effects: park) | a never-class tool under park |
| … · not registered on the runtime · … | a tool in the step’s catalog that the runtime’s registration of the agent lacks |
| opted in by AllowSideEffects · runs for real | an opted-in tool under allow |
| … · not opted in by AllowSideEffects: side effects allow is refused while it is on | allow with a tool that would refuse the command |
| breakpoint · parks | a runtime-wide breakpoint on the tool |
| requires approval · substituted from the recorded result when the call repeats, else parked | a weft.RequireApproval tool under substitute |
| requires approval · parks at the approval boundary | a weft.RequireApproval tool under park or allow |
| structured output · runs | an Output agent’s submit_output |
| off | the command turns the tool off |
A weft.RequireApproval tool also reads “needs approval” beside its ⚠: its side-effect class never is the replay class, not “no side effects”. The drawer names the kept prefix too: “nothing kept · the whole turn runs again”, “step 0 kept”, “steps 0–2 kept”, or “steps 0–2 kept · the compacted prefix (what the model saw at step 3)”. Run is held while any refusal shows: the target check, a scripted pick that cannot answer, allow that would be refused, an option-lab refusal, a preview that is pending or refused, an edit inside a compacted range or with invalid args, edits on a fork, or a fork with no input. Breakpoints are not a per-replay setting: the drawer points to Runtimes, where they apply to every run of the runtime.
Choose the engine
Section titled “Choose the engine”Studio’s replay drawer, its playground and the panel’s drawer choose the engine per command. They open on scripted when it can answer, and on live otherwise. Scripted can answer when all of these hold:
- the command has a source run;
- nothing changes the request the recording answered: no transcript edit, no system prompt or model override, no new input at step 0, no fork, and no change to the tools, the thinking level or the tool choice;
- parallelism is not 1, which asks for sequential tool calls;
from_stepis a step the source answered;- the preview’s
scripted_key_matchis not a miss (Preview).
An override equal to the agent’s own setting is no change and is not sent: a model equal to the source’s own, a tool choice or thinking level equal to the agent’s default, an input equal to the source’s, an edit equal to the recording.
The engine is two radios, each with one line:
| Radio | Its line |
|---|---|
| scripted | scripted · 0 tokens · replays the recorded answers, or why it cannot answer, such as “a changed prompt: the recording answered the original” or “the source never answered step 3” |
| live | live · calls <model> · ~1.2k tokens ≈ $0.0004 for steps 1–2: the source’s recorded usage from from_step to its last step at the price table’s rate |
The live estimate reads at most 20 steps. When some are not read it adds ”· later steps also run live”, and Run’s figure becomes ”≥”. When the usage or the price is unknown it reads cost unknown: <why> (for example “step 2 recorded no usage”, or “the steps were priced on <model>” under a model override), never $0. A model the source never ran on reads ”· live call” in the model choice. When the registered agent’s model is a wefttest script (its model_provider in GET /api/runtimes reads wefttest, The runtimes API), the drawer adds “live calls this agent’s wefttest script, which runs out: scripted replays the recording”, and a run that exhausted the script reads “the wefttest script ran out”.
Run names the engine: Run on scripted · 0 tokens, or Run live on <model> · ≈ $0.0004. On the playground it names the variant too: Run A on scripted · 0 tokens.
The engine is never switched behind you. A scripted pick that cannot answer holds Run with scripted is refused: <why> — pick live. A saved experiment keeps the engine it was saved with, live included, and a matrix saved before 0.19.0, which saved no engine, keeps the engine its runs ran on.
Over the API, engine is "scripted" or "live", and a body without it runs live. Studio’s clients always send the engine they show.
The target check
Section titled “The target check”A command names the agent it replays the source on, and Studio never picks one for you. A body with no agent is refused, naming the source’s:
{"error":{"code":"bad_request","message":"a run needs an agent: source run dd66354adfaac2b44848f0c1ed75516f is agent acme-support (send agent: \"acme-support\" to replay it on that agent)"}}A source recorded by another agent than the target is refused too, because a replay is the target’s prompt and tools over the source’s transcript:
{"error":{"code":"bad_request","message":"source run r_orders is agent orders; this command targets agent acme-support: send agent \"orders\" to replay it as recorded, or cross_agent: true to replay it as acme-support anyway"}}"cross_agent": true in the body opts in. Studio checks it; it never reaches the runtime. A source that recorded no agent name runs on the agent the command names. The preview still assembles a cross-agent replay, with its agent warning.
In the drawers the same check runs before Run, from the source run’s row, the registrations in GET /api/runtimes and the preview (capability target_check):
| The drawer says | What holds Run | How to go on |
|---|---|---|
| the source run names no agent: pick one | the source recorded no agent name | pick an agent; the picker lists the agents whose tools match the recorded ones first |
| the source run is agent orders; no runtime registers it: pick one, or start its app | no connected runtime registers the source’s agent | pick another agent, or start the app that registers it |
| the source run is agent orders; this replays it as acme-support | you picked another agent | replay as acme-support anyway sends cross_agent: true |
| recorded by researcher@9b5997a3 · registered now researcher@a59ce89e · tools differ: search_docs → web_search · scripted will miss at step 2 | the source was recorded by another build of the agent and its tools differ | replay on today’s build anyway |
The build line compares the source run’s manifest_hash with the registration’s (The manifest hash). When only the hash differs, the line is shown and Run is not held. An escape holds only for what it was taken for: a new source run or step, another target, another runtime or a new build of the target asks again. The drawer’s Runs in line names the runtime the command goes to (Runs in).
A command’s transcript_edits is one list of edits to the kept prefix, applied before the replay runs. Each edit’s kind picks what it changes, and each kind takes its own fields, no others:
kind | Fields | Changes |
|---|---|---|
tool_result | step, call_id, tool_result | a kept call’s result |
reply | step, content | a kept step’s call-free assistant reply |
user | step, content, index | a kept step’s user message: step 0’s is the turn’s prompt, a later one a delivered steer; index (0 by default) picks among a step’s several |
tool_args | step, call_id, args | a kept call’s arguments, a JSON object checked against the tool’s schema (below) |
insert | step, content | a user message added at the boundary before step step’s model call, 0..from_step: where a steer delivered after the previous step’s tool batch would land |
An edit without kind reads as before the kinds existed: tool_result when it carries tool_result, reply when it carries content. Patch a result with from_step past it, in the example’s source:
curl -s -X POST http://127.0.0.1:8080/studio/api/playground/runs -d '{ "command_id": "cmd_docs_2", "runtime": "rt_6ea843dccc7741ff", "agent": "acme-support", "source": {"run_id": "dd66354adfaac2b44848f0c1ed75516f", "from_step": 1}, "transcript_edits": [ {"kind": "tool_result", "step": 0, "call_id": "c1", "tool_result": "{\"order_id\":\"4411\",\"status\":\"lost in transit\"}"} ]}'{"command_id":"cmd_docs_2","state":"queued"}The replay’s model sees the counterfactual result, and its run row’s meta carries the edit:
"meta":{"weft.edits":"0:c1:result","weft.playground.actor":"local","weft.playground.command":"cmd_docs_2","weft.replay.view":"transcript"}weft.edits names every edit, one token each in the command’s order: <step>:<call_id>:args (the “args edited” mark), <step>:<call_id>:result, <step>:reply, <step>:user (<step>:user:<index> past the first) and <step>:insert. The tokens are in the source’s coordinates, its step ordinals and call ids. A child run the replay starts inherits the value with the rest of the run’s metadata, so it names the parent’s edits.
The rules, checked by Studio (400) and again by the runtime before the ack, in one wording:
-
An edit needs a kept prefix.
from_step0 keeps nothing:{"error":{"code":"bad_request","message":"transcript_edits need from_step > 0 (0 re-runs the whole turn, nothing is kept)"}} -
An edit names something in the kept prefix: an edit of step N needs
from_stepN+1 or more, an insert at boundary N needsfrom_stepN or more. A tool-result patch names a kept call, and a rewrite cannot drop a step’s calls. -
The prefix ends at a step boundary with every kept call answered, so the loop never has to invent a result.
-
inputbesidefrom_step> 0 is refused. Edit step 0’s user message instead:{"error":{"code":"bad_request","message":"input replaces the turn's user message only when from_step is 0: with from_step > 0, edit step 0's user message instead (a transcript edit of kind \"user\")"}} -
The scripted engine takes no edits. Its recorded answers answered the original request (When scripted cannot answer).
-
An edit inside a compacted range is refused. When
from_step’s request carried a compaction view, a message that view replaced is one the model never saw there:call "c_1" of step 0 was compacted away before step 3's request (messages [1, 3) replaced by 1): the model never saw it there; edit from an earlier from_step. An insert strictly inside the range is refused the same way. Edits outside it apply, then the view is spliced in. -
A fork never carries edits.
Substitution keys on the edited pairs. Under substitute, a kept call the model re-issues is answered from what the model saw answered. A call re-issued with its edited arguments gets the kept (or patched) result; one re-issued with its original arguments no longer matches and parks, or runs if it is replay-safe.
Edit tool arguments
Section titled “Edit tool arguments”A tool_args edit rewrites a kept call’s args, which must be a JSON object. It is checked against the tool’s input schema with obsdb.CheckToolArgs, and refused in the loop’s own INVALID_INPUT words. Writing the example’s order_id as a number:
curl -s -X POST http://127.0.0.1:8080/studio/api/playground/runs -d '{ "runtime": "rt_6ea843dccc7741ff", "agent": "acme-support", "source": {"run_id": "dd66354adfaac2b44848f0c1ed75516f", "from_step": 1}, "transcript_edits": [{"kind": "tool_args", "step": 0, "call_id": "c1", "args": {"order_id": 4411}}]}'{"error":{"code":"bad_request","message":"INVALID_INPUT: tool \"lookup_order\": field \"order_id\": expected string, got number"}}The check covers type (one or a list), properties, required, additionalProperties, items and enum; a null field reads as absent, and an integer must be written as one (3.0 is refused, as the loop refuses it). ExampleCheckToolArgs shows both answers.
The call keeps its id, name and signature, and its result stays unless a tool_result edit rewrites it too. args empty or null is absent. The runtime checks against its agent’s current tool. Studio checks against the registered agent’s manifest when a runtime holds it, else against the catalog the edited step recorded (the run’s latest for a step without one). Without a registration the two can differ when the schema changed since the recording, and the runtime, the authority, decides before the ack. A read-scoped panel token’s preview checks the object shape only, so no refusal names a hidden schema.
Transcript editor
Section titled “Transcript editor”On the run page’s story, and the devtools panel’s Story tab, a run that is over is editable in place. Step 0’s prompt, a steer, a call’s args, a tool result and a call-free reply turn into a textarea when you click them, or press Enter on the pencil, with revert and a red “edited” chip. Every step boundary up to the highest from_step the run accepts takes an inserted message (“insert a message before step N”).
The first edit opens the replay drawer as “Edit the transcript and replay”. The drawer lists the edits by kind, each droppable, keeps from_step at what they imply, and opens on live, with the scripted radio saying why it cannot answer. An edit field starts empty with the recording beside it, and a value typed back to the recording is no edit: it is never sent and never a reason for live. An args edit is checked in the editor against the tool’s schema with CheckToolArgs’ rules; a refusal is said on the field in the INVALID_INPUT words and holds Run. On the playground page, the kept steps’ Transcript edits fields show the recorded value as a muted “recorded: …” line, with start from recorded and reset to recorded.
A replay whose row carries weft.edits opens its story with “kept prefix edited”: one chip per token, “args edited”, “result edited”, “edited” (a user message or a reply) or “inserted”, at its source coordinates. A child run inherits the mark and draws none.
Preview
Section titled “Preview”POST /api/playground/preview takes the same body Run would post and answers the replay’s first request beside the request step from_step recorded, with their diff. It is assembly in Studio from the records: no model, no tool and no runtime is needed. The capability is preview. For the tool-result edit above:
curl -s -X POST http://127.0.0.1:8080/studio/api/playground/preview -d '{ "runtime": "rt_6ea843dccc7741ff", "agent": "acme-support", "source": {"run_id": "dd66354adfaac2b44848f0c1ed75516f", "from_step": 1}, "transcript_edits": [{"kind": "tool_result", "step": 0, "call_id": "c1", "tool_result": "{\"order_id\":\"4411\",\"status\":\"lost in transit\"}"}]}' | jq '{diff, warnings, unchecked}'{ "diff": { "system": "same", "messages": [ {"op": "same", "was": 0, "will": 0}, {"op": "same", "was": 1, "will": 1}, {"op": "changed", "was": 2, "will": 2} ], "tools": {"added": [], "removed": []}, "model": "same", "params": "same", "thinking": "same", "tool_choice": "same" }, "warnings": [], "unchecked": []}The answer’s keys are source, agent, engine, runtime, will_send, was_sent, diff, compacted_at, warnings, unchecked, scripted_hit and scripted_key_match. will_send is the request: system, messages, tools, model, params, thinking and tool_choice, with system_source, tools_source and params_source saying where each came from (here recorded, agent and agent). Messages are aligned same, changed, added or removed.
The warnings name what the preview cannot promise: prepare_step when a request record of the source names what a PrepareStep changed, or none was recorded; catalog when the registered tools differ from the recorded step’s; agent when the replay’s agent is not the source run’s; and compacted, derived, scripted and instructions. The scripted engine’s refusals are warnings here, in the run route’s words. unchecked lists the overrides only a registration could check, when no runtime holds the agent. A read-scoped panel token gets the system prompt and the catalog hidden.
The scripted check. Whatever the engine, the preview says whether the scripted engine holds a recorded answer for each step the replay would ask, before any model is called:
scripted_hitis one entry per step fromfrom_stepthrough the first miss,{step, hit, because}.becauselists the key components that differ:tools,thinking,tool_choice,sequential,messages, orunansweredfor a step the source never answered.scripted_key_matchsums it up as{ok, because, step, message}:okwhen every step the replay reaches hits, else the first miss and its sentence, the one the run would fail with (When scripted cannot answer).
The check keys each step as the scripted engine does. A narrowed tool list, a thinking level, a tool choice, sequential tool calls or other messages miss at the step they change. A recorded call to a tool the registered agent lacks misses at the next step. A source that ended on a tool call (a failure, a cancel) asks the step it never answered, unanswered. When a step’s request record names a PrepareStep change, that step is keyed from its record. Only component names are returned, never content.
The replay drawer draws the preview as “2 will be sent · step N’s request”, re-read 300 ms after the form rests: the system’s state, one row per message with its op (a changed row shows was struck through above will, and each run of unchanged messages folds as “N same”), tools added and removed, the changed knobs and every badge. Its 400 is the command’s own sentence, shown verbatim, and holds Run. A fork gets no preview.
When scripted cannot answer
Section titled “When scripted cannot answer”The scripted engine answers only what the source recorded. Studio refuses a scripted command it knows cannot answer, before any runtime sees it, with a 400 that says what differs and the two ways on:
| The command | The refusal |
|---|---|
| a system prompt override | scripted cannot try a changed system prompt: the recorded answers ignore the prompt, so it would replay the old answer — run on live, or drop the prompt change |
| a model override | scripted cannot try another model: it replays the answers the source's own model recorded — run on live, or drop the model override |
| no source run | scripted replays a recorded run's answers: pick a source run, or run on live |
| a transcript edit | your edit changes step 1's request, and scripted holds only the recorded answer to the original — run on live, or drop the edit |
from_step at the step count | scripted has no recorded answer for step 3: the source never answered it — run on live, or replay from an earlier step |
The preview returns the same sentences as warnings instead of refusing, except the missing source run, which it refuses as the run route does.
Anything else that changes the request misses when the runtime asks for the step. The run fails, and the runtime’s error names the source step whose recorded turn was nearest, the components that differ and the remedy:
weft/runtime: no recorded turn for step 2 (scripted engine, key …): the tool list differs from the recording [tools]; the scripted engine answers only what the source recorded: run on live| Component | Means |
|---|---|
tools | the offered tool list is not the recorded one, or a recorded call names a tool the agent no longer has |
thinking | the request sets a thinking level the recording does not hold |
tool_choice | the request sets a tool choice the recording does not hold |
sequential | the request asks for sequential tool calls (parallelism 1) |
messages | the messages differ from the recording (a changed input or tool result) |
unanswered | the source never answered the step |
exhausted | the recording answered this request fewer times than the replay asks |
GET /api/playground/commands/{id} reads that failure into reason, beside error, which stays the runtime’s text:
"reason": {"kind": "scripted_miss", "step": 2, "components": ["tools"], "message": "scripted has no recorded answer for step 2: the tool list differs from the recording — run on live"}The message ends ”, or replay from an earlier step” when the source never answered the step. When the source recorded no turn at all, step is −1 and the sentence reads scripted has no recorded answer for this request: ….
The runtime sends the miss typed on its finished ack, reason {kind: "scripted_miss", step, components} beside the error text (which it cuts at 4 KiB), its components kept to the closed list above, and reason is built from it. Only for a runtime older than that field is the error text read instead. The preview, the refusal and the run agree on the step, the components and the sentence. ReasonOf and ScriptedMissReason in studio/runtime are the mapping.
After a miss, the result shows that sentence with the ways on: run again on live, which puts the form on live with its estimate and posts nothing; replay from step 0 with the recorded agent; and, in Studio, save the recording as a test.
Save a replay as a test
Section titled “Save a replay as a test”POST /api/playground/fixtures turns a run’s records into wefttest replay fixtures, and the result card’s save as test downloads the run as a replay test. For a replay from step N > 0 the test keeps the source’s steps 0 to N−1 and replays the turn from its start. Both are on Turn Studio runs into tests.
Complete example
Section titled “Complete example”Start the example program from How does the playground work?, then replay its source run with the commands above:
go run ./playgroundplayground: http://127.0.0.1:8080/studio/playgroundsource run: dd66354adfaac2b44848f0c1ed75516fRead the runtime id from GET /api/runtimes and the source run id from the output. The test TestReplayFromStep in main_test.go sends the first command offline and checks the replay’s forked_from, playground, experiment_id, weft.replay.view and empty session_id, then the 409 on a reused command id.
Best practices & gotchas
Section titled “Best practices & gotchas”- Count
from_stepin the source’s own steps. The turn’s input is context, not step 0’s prefix, and a compaction changes no step count. (Source: ADR 0029 decision 1) - Re-check an unchanged change on scripted first. It costs nothing and replays the recorded answers, so a step that differs points at your change, not at the model. (Source:
lib/engine.ts,runtime/scripted.go) - Send
engineandagentin your own clients. A body withoutengineruns live, a real model call, and one withoutagentis refused. (Source:studio/playground.gocheckCommandWarn,checkTargetNamed) - Expect a replay to stop where the source stopped. It is the same turn: with
MaxSteps(10)a replay from step 6 makes at most 4 model calls, and a loop streak carries over. (Source:core/run.goKeptSteps,runtime/executor.gokeptSteps) - Edit step 0’s user message instead of sending
inputpast step 0.inputreplaces the turn’s message only whenfrom_stepis 0. (Source:studio/playground.gocheckSource) - Check that a step-0 replay with
inputkept the conversation. When the runtime cannot resolve the source transcript, because the source was recorded with content off, Studio is unreachable or the source run was swept, an ephemeralfrom_step0 command withinputruns on the input alone. The earlier turns are dropped and the command still finishessucceeded. The only signal is a WARN in the app’s log:weft/runtime: source transcript unresolved; running on the input alone. Every other shape is refused instead:from_stepabove 0, edits, the scripted engine, or noinput. (Source:runtime/executor.goprepareSource,runPrefix) - Edit from a step whose request the edited message reached. Inside a compaction view the edit is refused: the model never saw that message there. (Source: ADR 0029 decision 4)
- Make
PrepareStepidempotent if you replay mid-run. A count- or index-keyed one re-shapes the replay’s input. (Source: ADR 0029 decision 1,TestReplayRerunsTheAgentsPrepareStep) - Re-issued calls with edited arguments are substituted from the kept result. The original arguments no longer match and park. (Source: ADR 0029 decision 8)
See also
Section titled “See also”- See your runtimes and where a command runs
- Run experiments with the option lab
- Compare runs step by step
- Turn Studio runs into tests
- How does the playground work?
Symbols used: weft.KeptSteps · obsdb.CheckToolArgs · runtime.ReasonOf · runtime.ScriptedMissReason · weft.Replay · weft.ReplaySafe · weft.RequireApproval · weft.Subagent · weft.PrepareStep