Skip to Content
Recodocs

08 · Bound a model-led workflow

Decide which read can run, what a retry may reuse and when the Facilities Helpdesk should stop.

9 min read
Part 3
Connect tools and inputs
Model
Qwen2.5-1.5B-Instruct
Data
Synthetic facilities helpdesk
Hardware
Tesla T4 and CPU, in Google Colab
Open in Colab

Can the desk still use “its”?

An operator returns to the Facilities Helpdesk and asks for the maximum temperature of the fan from their previous ticket. The desk has a saved F-250 reference. Before opening a manual, it needs to know whether that reference still identifies the current equipment record. A stale reference could put the wrong limit into a work order.

Factory ventilation fan representing F-250

Previous ticket · operator · north-yard

“What is its maximum temperature?”

Saved pointer F-250 · r3

Current manual manual-F-250-r3

Check what the desk should do

Saved r3. Read the authorised manual and return 101 °C with its citation.

Saved r2. Ask which fan the operator means. The recorded fixed workflow clarified without a read. The model proposed a manual read, and the scope check stopped it before it replied.

Synthetic Facilities Helpdesk. Augapfel’s factory fan photograph illustrates F-250 and is cropped here. CC BY 2.0.

Change one fact. Keep the operator, site, question and equipment ID fixed. Change the revision stored with the saved reference.

Saved referenceWhat should the desk do?
F-250 · r3Read the authorised current manual. Return the limit and the source.
F-250 · r2Ask which fan the operator means before reading a manual.

The fixed graph completed more tickets

Strict completions on the same development cases

1
Policy and recoveryStrict completions
Fixed · abort32/36
Fixed · resume36/36
Model · abort6/36
Model · resume6/36
Candidate versus baselineΔ pp95% intervalWin/loss
Fixed · resume vs Fixed · abort+11.1+2.8 to +19.44/0
Model · abort vs Fixed · abort−72.2−88.9 to −50.00/26
Model · resume vs Fixed · resume−83.3−100.0 to −58.30/30
Model · resume vs Model · abort0.00.0 to 0.00/0

The derived paired intervals resample equipment families. Each family’s tickets stay together.

Source: verified Lesson 08 Colab export. The fixed graph runs on CPU and model choices run on a Tesla T4.

Give the model a bounded choice

An agent is allowed to choose its next step among permitted operations. It is not allowed to redefine the task or the person's authority. A bounded workflow can recover and resume without relying on the model to remember completed actions.

The fixed graph maps a known ticket type to the next read. The model-led workflow asks Qwen to choose from a closed menu on each turn. Both receive the same ticket and accumulated observations. The host builds the trusted scope from the signed-in principal and the equipment record. When the model chooses a read, the host still decides whether to execute it. The final value and citations come from completed reads.

Uber’s Cadence introduction shows a fixed workflow coordinating eight steps in an Uber Eats example. A prescribed sequence is a credible baseline when the steps are known. Anthropic’s engineering guide describes the decision split used here and recommends an explicit iteration limit when introducing model-directed choices. Uber engineering’s Cadence overview · Anthropic engineering’s workflow guide.

The executor makes a terminal reply count only if the decision, exact value and full evidence list all agree with the expected ticket outcome. A correct clarification or denial has an empty value and evidence list.

si=1[d^i=di]⋅1[strip⁡(v^i)=vi]⋅1[sort⁡(E^i)=sort⁡(Ei)].\begin{aligned} s_i &= \mathbf{1}[\hat d_i=d_i] \\ &\quad\cdot \mathbf{1}[\operatorname{strip}(\hat v_i)=v_i] \\ &\quad\cdot \mathbf{1}[\operatorname{sort}(\hat E_i)=\operatorname{sort}(E_i)]. \end{aligned}

The paired estimate averages the candidate-minus-baseline strict grades. Its interval resamples whole equipment families so multiple phrasings of one family stay together.

Δ^=1n∑i=1n(si,candidate−si,baseline).\widehat{\Delta} = \frac{1}{n}\sum_{i=1}^{n}(s_{i,\mathrm{candidate}}-s_{i,\mathrm{baseline}}).

All six model-led passes came from the access check

Strict passes by ticket type with resume enabled

2
Ticket typeFixedModel
Manual6/60/6
Inspection6/60/6
Two sources6/60/6
Ambiguity6/60/6
Access boundary6/66/6
Follow-up6/60/6
Source: verified Lesson 08 Colab export. The fixed graph runs on CPU and model choices run on a Tesla T4.

All six model-arm passes were denials issued directly by the host before inference. On the current F-250 ticket, the model chose the right read and got the manual. It then emitted the same choice again. The executor stopped at its duplicate-read guard and the strict scorer saw an empty reply. The ReAct experiments include repeated thoughts or actions among the reasoning errors seen on their HotpotQA trajectories. A trace can distinguish repetition from lack of available evidence. ReAct, §3.3.

Keep the next choice small

Three changes are worth testing with a small model on the F-250 ticket:

  • Reveal schemas as needed. Give the model short descriptions of the available reads, then reveal the argument and result schema for the chosen read. On a revision lookup, the manual schema is enough to start. The executor still validates every call against the full contract.
  • Keep large tool results outside the prompt. Store the full manual extract in a scoped file and return a short summary plus its path. Let the model read a relevant section when it needs the exact wording. Keep the original extract available for citations, with the same access checks on the file as on the tool.
  • Check when the workflow can stop. If the manual revision is still missing and another authorised read can supply it, continue within the remaining budget. Stop when the required evidence is present or when an explicit boundary, budget or failure prevents another useful read. Return the stop reason with the result.

The Scaffold Effect paper reports up to a 40-fold difference in tokens per solved task across the coding harnesses it tested. A separate analysis of published SWE-bench submissions found that scaffold ordering could reverse when the model changed. Its observational comparison does not isolate a causal effect. These results motivate comparing the same helpdesk model under each harness change, with task success, cost and stop reasons recorded together. The Scaffold Effect, §4.7 · Coding Agents Have Converged, §4

Resume the one read that timed out

A second ticket asks for F-220’s last inspection date and its supporting system. The fixed workflow completes inventory before attempting the graph read. The experiment injects a timeout immediately before that second read. Take a snapshot of the completed inventory observation, the pending graph action and both counters. Resume from the saved action. The retry uses an additional tool attempt.

# Restore the completed observations and the unfinished action together.
snapshot = json.loads(interrupted["events"][-1]["checkpoint"])
assert snapshot["case_id"] == case["id"]
next_turn, pending = snapshot["turn"], snapshot["pending_action"]
observations = snapshot["observations"]
attempts, decisions = snapshot["tool_attempts"], snapshot["decision_calls"]

Resume kept the inspection result and retried the graph read

F220-01 · recorded fixed workflow

3
  1. Inventory read completedinventory-F-220-r3
  2. Graph read timed outSaved the inventory observation and the pending graph read.
  3. Graph read retriedgraph-F-220-r3
Policy and recoveryPlannedInjectedRecovered
Fixed · abort440
Fixed · resume444
Model · abort420
Model · resume420
Source: verified Lesson 08 Colab export. The fixed graph runs on CPU and model choices run on a Tesla T4.

F220-01 · Please help. For F-220, which system supports it and when was its most recent inspection?

Fixed · abort
Inventory read completed. Graph timed out. Empty reply.
Fixed · resume
2025-05-05 | S-620 · inventory-F-220-r3 and graph-F-220-r3

The saved inventory is reused. The three attempts are one inventory read, one interrupted graph attempt and one graph retry.

Temporal’s durable execution replays event history to restore workflow state, with activity retry governed by configured limits. This lab restores a JSON snapshot within the experiment. It measures the value of retaining completed observations when a read is interrupted. Temporal’s durable execution documentation.

Recheck the remembered fan

A checkpoint preserves evidence gathered in one execution. The F-250 pointer was saved in an earlier ticket. Resolve it against the current equipment record before using it to scope a read. Revision r2 leaves the equipment unresolved. The right terminal outcome is a clarification.

A stale pointer should stop with a question

Controlled F-250 and F-251 follow-up pairs · resume enabled

4
Policy and pointerStrictReadsStale errors
Fixed · current2/220
Fixed · stale2/200
Model · current0/220
Model · stale0/202

Current F-250: the model read the correct manual and then chose the same read again. Stale F-250: the proposed manual read stopped at the scope check and left the operator without a clarification.

Source: verified Lesson 08 Colab export. The fixed graph runs on CPU and model choices run on a Tesla T4.

F250-00 · What is its maximum temperature? · saved F-250 r3

Fixed · resume
Answer 101 °C · manual-F-250-r3
Model · resume
M → read manual-F-250-r3 → M → invalid_or_out_of_scope → {}

The second M requested the same completed manual read. The duplicate guard stopped it before the model submitted the answer.

F250-00-stale · Same request · saved F-250 r2

Fixed · resume
Clarify · zero reads
Model · resume
M → invalid_or_out_of_scope → {} · zero reads

The stale reference left the model with no scoped asset. Refusing the read protected the boundary and left the task incomplete.

Keep permission checks with the executor

In the direct P-210 probe, a same-site operator could read inventory. A guest and an operator from the other site could not. A separate unregistered-action probe stopped before attempting a read. Those observations show how this local executor handled specific inputs.

# Reject unregistered and repeated reads and require a scoped asset.
if action not in READS or action in observations or scope.asset is None:
    terminal = "invalid_or_out_of_scope"
    break
if attempts >= CALL_LIMIT:
    terminal = "call_budget"
    break

Trusted scope determined whether a read could run

F210-00 · direct checks of the same inspection read

5
PrincipalInspection read
Same-tenant operatorAllowed
Same-tenant guestDenied
Other-tenant operatorDenied
Unregistered action probe0 attempts

The checks exercise the local executor on one asset. The boundary cohort in Figure 2 measures outcomes on the development tickets separately.

Source: verified Lesson 08 Colab export. The fixed graph runs on CPU and model choices run on a Tesla T4.

Account for each choice

The wall clock includes the choice policy and local executor. The timeout is injected without artificial waiting. The two resume medians include the elapsed abort prefix where a retry actually occurred. Fixed decisions are branches on CPU. Model decisions add generation time on the T4.

Model choices dominated median workflow time

Per development ticket · cold model load excluded

6
Policy and recoveryMedian msMean decisionsMean reads attempted
Fixed · abort0.0141.560.83
Fixed · resume0.0141.670.94
Model · abort134.51.440.67
Model · resume135.11.500.72

Model setup took 19.1 s. Fixed decisions are CPU branches. A model decision includes a generation call.

Source: verified Lesson 08 Colab export. The fixed graph runs on CPU and model choices run on a Tesla T4.

What to keep

ChoiceDevelopment evidenceRecorded failure
Fixed graph · abort32/36 strict passesFour injected timeouts stopped the workflow.
Fixed graph · resume36/36 strict passesNo strict misses on this cohort.
Model-led · abort6/36 strict passesTwo reached an injected timeout.
Model-led · resume6/36 strict passesThe two retried cases still missed, and F-250 repeated its manual read.
  • Start with a fixed route when the ticket type determines the required sources.
  • Retry the pending read within the existing budget and carry forward completed observations.
  • Authorise at the tool boundary and grade the final response as a separate outcome.
  • Clarify a stale reference before opening any source.

Next to try, not tested here

  • Inject a second interruption on the pending graph read. Predict whether the call budget will stop another retry.
  • Ask the model to choose only among actions still possible in the current state. Predict which stop reasons change.
  • Change the stale follow-up to an explicit F-250 ID while preserving the principal. Predict whether the current manual becomes available.

How it was built

ItemSetting
Development data36 cases across 12 equipment families. Variants 0, 1 and 2. Two current–stale follow-up pairs are analysed separately.
Development SHA-25651dbc208b6b20a620237dd76ce0a2db4f10aa75f4f8fc404121e301b8d79a0cf
ModelQwen/Qwen2.5-1.5B-Instruct at 989aa7980e4cf806f80c7fef2b1adb7bc71aa306. Greedy decoding, at most four new tokens per choice.
ExecutionFive turns and five tool attempts at most. Local manual, inventory and graph reads, with a host-owned scope. One injected timeout before the eligible read.
ScoringExact decision and value, with all expected evidence IDs. Paired percentile intervals resample equipment families.
RuntimeTesla T4 with CPU, Python 3.13.16, Torch 2.14.1+cu130, Transformers 4.51.3.
EvidenceSummary, per-ticket traces, runtime receipt.

Time and cost. The notebook completed in 45.1 s in the T4 queue. Loading the model took 19.1 s. The benchmark used Colab compute and local model inference.

Run it yourself

Download the executed notebook. The measured notebook took about 45 seconds in the attached Colab queue. A fresh environment can take longer to install packages or fetch weights.

Find this in the notebookRead it alongside
What changes when the saved fan reference becomes stale?Can the desk still use “its”? and Recheck the remembered fan
Can a timeout be replayed without duplicating completed reads?Resume the one read that timed out
Does bounded recovery improve completion?Account for each choice and What to keep

Change one condition and predict the trace before executing.

  1. Replace only the saved revision in the F-250 case with r2. Predict the next action and how many reads occur. Check the two event lists.
  2. Replay F220-01 without resume. Predict which evidence remains available when the graph read stops. Compare both responses and the timeout checkpoint.
  3. Reduce the tool-attempt cap to two. Predict whether the inventory observation still remains and whether the graph retry is allowed. Read the terminal reason and response together.

Lesson 09, Handle spoken intake, asks whether transcription preserves the equipment identifiers this workflow needs. Back to the course outline.

How is this page?

Last updated on