Skip to main content

Module user_simulator

Module user_simulator 

Source
Expand description

UserSimulator trait and shipped simulator implementations (plan §12.3, §12.4).

A simulator stands in for a human user during a [ConversationLoop] run: it produces an initial message from the task, then responds to each assistant turn with either UserAction::Say (send a follow-up) or UserAction::EndConversation (terminate the loop).

Simulators receive a oharness_core::ConversationView — not raw messages — so they can call .user_visible() to strip internal reasoning / tool calls / tool results and respond only to the human-facing thread. Simulators that want stricter or looser views can compose their own.

Structs§

LlmUserSimulator
A simulator that drives a user LLM with a persona + template. Each respond call builds a CompletionRequest whose system prompt is the rendered prompt_template (with {persona} and {task} substituted) and whose user message is the serialized conversation so far.
ScriptedUserSimulator
A simulator that replays a fixed sequence of user utterances. The first entry is returned from UserSimulator::initial_message; each subsequent call to UserSimulator::respond returns the next entry, UserAction::Say-wrapped, until the script is exhausted — at which point the simulator returns UserAction::EndConversation.

Enums§

UserAction
What the simulator wants to do next.
UserError
Simulator-side errors. Any error here is promoted to Termination::Failed { reason: "user_simulator_error" } by the [ConversationLoop] — simulators cannot silently fall back to UserAction::EndConversation since that would hide bugs.

Traits§

UserSimulator