mixle.task.orchestrate module¶
orchestrate – the minimal controller loop: plan a step, execute it against a world, re-plan on
a failed or atypical step, and stop on low confidence, world completion, or budget exhaustion.
plan_model is any (request, history) -> step | None callable – a Planner
step, a GenerativePlanner decode, or a test double; None (or a step whose
tool is None/"__stop__") means STOP. world is kept behind the World protocol
rather than importing a concrete environment directly. Any object with step/done/score
can plug in.
Every executed (or failed) step is appended to the returned trace as a
TraceStep, so mixle.task.replay.replay() can later re-run the same
episode against the same world.step for a bit-identical-replay check.
- class World(*args, **kwargs)[source]
Bases:
ProtocolThe minimal environment contract
orchestrateneeds.- step(action)[source]
Apply one action and return the environment’s step result.
- property done: bool
Whether the environment has reached a terminal state.
- class OrchestrationResult(answer, trace, stopped_reason)[source]
Bases:
objectFinal answer, execution trace, and stop reason from an orchestration run.
- orchestrate(question, plan_model, world, *, budget, confidence_threshold=None)[source]
Plan one step at a time against
plan_model, execute it onworld, re-plan once on a failed step, and stop on an explicit STOP, low confidence, world completion, or budget exhaustion.