Skip to main content
The mock world that answers tool calls and fails on schedule. 2 public names. import whileai.simulations as wai, then wai.name.

MockEnvironment

In-memory tool world. User-named refs exist exists_share of the time; issued ids must be created. options steers every generator.

WorldOptions

Everything the mock world can be steered by. Defaults in defaults.py. Pass one to MockEnvironment(options=), or the same fields as a dict through simulate(advanced={"world": {...}}) and export_environment(world={...}); unknown keys raise so a typo is not a silent default. The instance is frozen and its mapping fields are read-only views: to add a fault mode or a payload builder, build a new WorldOptions with the wider table. Attributes: fault_modes: mode name -> builder; FAULT_MODES plus whatever a caller adds. A read-only mapping. condition_modes: coverage-grid tool_condition value -> the fault mode a situation with that condition carries (WORLD_CONDITION_MODES). A condition that is itself a fault_modes key needs no entry; every value here must be a fault_modes key. A read-only mapping. default_fault_mode: the mode a fault plan gets when it names none. default_fault_rate: the fire probability a plan gets when it names none. stale_as_of: the age stamped on a stale read. malformed_payload: what a malformed fault returns. exists_share: share of user-named references that exist when no world state says otherwise. search_hits: records a search returns, inclusive bounds. template_hits: records a model-written list template expands to, inclusive bounds. id_range: generated record ids, [lo, hi). date_years: (first year, span) generated dates fall in. jitter_divisor: a template number moves by up to 1/this of itself. shell_flavors: one shell call in this many takes each failing flavor; the rest pass. ci_fail_one_in: one CI listing in this many carries a failed check. result_kinds: the routing table, (kind, rule) in order. payloads: kind -> payload builder. A read-only mapping. people, adjectives, topics, statuses, code_verbs, code_nouns, check_names, file_stems: the content pools generated records draw from.

WorldOptions.fault_mode_for

The fault mode a coverage-grid tool_condition carries: condition_modes[condition], else the condition itself when it is a fault_modes key, else None (a clean call).

WorldOptions.summary

The options as plain data for a run record: every non-callable field as it is, and the callable tables (fault_modes, payloads, result_kinds) as the sorted names they carry.