Home / Several agents and adversarial checking
Deterministic workflows: schemas, checkpoints, resumption
A workflow is a script that orchestrates subagents deterministically, with output structured by a JSON schema and a checkpoint after every step, but the model applied to a relaunched agent follows a four tier priority order, and when the first three tiers are left empty, that agent falls back, as a last resort, on the model of the session running it, not the one that wrote the script.
A workflow, in the sense used in this module, is a script that chains several agent calls deterministically: the same sequence of steps and the same output schema on every run, unlike a conversation where the agent decides on its own the order of its actions. The official Claude Code workflows documentation shows an example that passes a schema object directly to the function calling an agent, which removes any room for interpretation about the shape of the expected result.
The schema that replaces a free-text report
When an agent has to pass its result on to the next step, a JSON schema imposes named fields and precise types, rather than a paragraph the next agent would have to read and interpret. Two agents exchanging through a shared schema do not misunderstand each other on shape, which moves the vigilance to where it actually matters, the content.
The checkpoint that avoids redoing everything
Every completed step writes a checkpoint. When resuming an interrupted workflow, a step marked complete returns its saved result directly without relaunching the agent that produced it. A step whose prompt has changed since the last run gets relaunched, and any step placed after it in the sequence is relaunched too, even if its own prompt has not moved.
étape : rédaction_synthèse
statut : terminé
prompt identique à la dernière exécution : oui
modèle posé dans le script pour cette étape : aucun
This last field, no model set in the script for this step, is the easiest point to miss when rereading a script written several months earlier.
The model a relaunched agent actually inherits
Since version 2.1.251, the model applied to a relaunched agent follows a four tier priority order: the parameter set directly in that agent's call, the model field of the subagent itself, an environment variable specific to the subagent, then, as a last resort, the model of the session running the script at the moment it relaunches it. Before this version, the order differed on a point that changes everything for an old script: the environment variable came first and won out over both the call parameter and the frontmatter's model field, including over the value model: inherit. When none of the priority tiers is set, an agent written under a given model on a given date silently switches to the model of the session relaunching it months later, with no on screen message flagging it. This point connects with the architecture choice laid out in fan-out, pipeline, barrier: a saved pipeline remains a pipeline, and each of its steps keeps its own risk of silent model inheritance.
Reopening a script written several months earlier and checking line by line which model will actually apply to each agent takes a few minutes, provided you also check the version of the orchestration tool at the time the script was written against the one installed today. Skipping this produces a result rendered by a model nobody chose for that specific step, with no alert warning of the change.
A workflow script, from writing to relaunch
In August, someone opens a workflow script written in January, on a Claude Code installation that stayed on the same version, later than 2.1.251, for that whole period, with a per-subagent model environment variable left at its empty default value. The script chains four agent calls, the first with a model field set to sonnet and the following three with this field left empty. This person relaunches the script from a session whose default model changed to haiku between January and August.
Write in one sentence what this situation establishes, and in one sentence what it does not establish.
What this establishes: It establishes that the first agent will keep running with the sonnet model on this relaunch, since its model field is set explicitly in the script and an explicit field takes priority over the relaunching session's default model.
What this does not establish: It does not establish which model the other three agents will use on this relaunch, since their empty model field makes them depend on priority tiers not described in this situation, including the session's model as a last resort.
The three most common miscalibrations
- Too broad The whole script will keep running with the sonnet model on this relaunch, since that is the value carried by its first agent.
- Too narrow This situation allows nothing to be said about the model that will be used on relaunch, since the session's default model changed between January and August.
- Beside the point This situation mainly shows that a session's default model changes over time independently of the scripts running in it, a fact about the working environment rather than about the relaunched script's behaviour.
- Output structured by a JSON schema removes the ambiguity between two agents reading each other, an imposed structure replaces text that needs interpreting.
- A checkpoint records the result of every completed step, which means only the step whose prompt has changed, and the ones following it in the sequence, need to be relaunched.
- The model applied to a relaunched agent depends, since version 2.1.251, on a four tier priority order, the call parameter, the subagent's model field, an environment variable, then the session's model as a last resort; before this version, the environment variable came first and took priority over everything else.
- An agent with none of the first three tiers set switches silently, at relaunch, to the model of the session running the script that day.
- Resuming an old workflow script means re-auditing every model field before assuming the result will come out the same way it did the first time.
Open the last workflow script you saved, list every agent call it contains, and note next to each one whether its model field carries an explicit value or is left empty, before relaunching it.
These points depend on an interface or a rule that may have changed since this was written. Check them on your own screen before relying on them.
- Check whether your orchestration tool defines a per-subagent model environment variable on your machine, it takes priority over the session's model if it is set, and also check whether your installation predates or postdates version 2.1.251, which reversed the priority order between this variable and the call parameter.
Every datable claim in this lesson links here to the public text behind it. A source that does not open proves nothing.
- Anthropic, Claude Code workflows documentation consultée le 2026-09-02
- Anthropic, Claude Code subagents documentation, model resolution order consultée le 2026-09-02