set_history
set_history
Control what the model still sees when this step is entered. The mode applies when the step’s instructions are injected, before the next request to the model, and governs everything that came before. It doesn’t affect this step’s own turns, which accumulate fresh. Nothing is deleted: the call log keeps every message.
Overrides the context-level default set with
Context.set_history().
Parameters
history
One of five modes.
"keep"— clear nothing. Every prior step’s instructions and dialogue stay visible to the model."default"— hide the prior step instructions, keep the user and assistant dialogue. This is the behavior when unset."spoken"— keep the conversation, drop the work. The prior step instructions are cleared, and every earlier tool call, tool result and turn-scoped system note (tool prompts, injected messages, a gather’s preamble) leaves the model’s context for the rest of the call. Every spoken turn stays: the caller’s, the agent’s replies, andsayactions. An agent turn that spoke and also called a tool keeps its words."hide"— hide the prior instructions and pull the prior dialogue out of the model’s context for the rest of the call. Pair it with a${step_history.*}reference in this step’s text to choose exactly what comes back."isolate"— like"hide", but only while the agent is in this step. When the agent leaves it, the earlier dialogue comes back and this step’s own turns stay. The earlier instructions stay cleared, and anything an earlier"hide"step hid stays hidden. Entering the step again isolates it again.
A platform release that doesn’t support "spoken" or "isolate" treats it as
"default".
"hide", "isolate" and "spoken" keep the exchange that entered the step as
the step’s start: the tool call whose action changed the step, its result, its
notes and its say, plus any caller words stored before the step was injected.
How the step was entered changes what that exchange is:
- A change from a
post_processresult runs after the model’s reply, so the step keeps that call and everything stored from it on, the reply included. - A change made with
next_stepkeeps nothing. - An end step, or a step with a reset, takes no history pass.
A consolidation summary stays under "hide" and "spoken". "isolate" hides
it while the step lasts. Semantic gates judge the same turns the model sees.
Returns
Step — Self for method chaining.
Raises
ValueError if history is not one of the five modes.
Examples
Confirm step that sees only its own turns
Use "isolate" on a confirm step, so the read-back is all the model has.
Stage boundary that keeps the conversation
Use "spoken" where the caller’s earlier requests must stay but the finished
stage’s tool results shouldn’t.