mixle.experimental.typed_runtime.context_scheduler moduleΒΆ

Budgeted value-of-information scheduling for context construction.

class ContextBudget(latency_seconds=inf, materialized_tokens=9223372036854775807, monetary_cost=inf, tool_calls=2147483647, maximum_actions=2147483647)[source]

Bases: object

Hard cumulative context-construction resource limits.

Parameters:
  • latency_seconds (float)

  • materialized_tokens (int)

  • monetary_cost (float)

  • tool_calls (int)

  • maximum_actions (int)

class ContextScheduleDecision(selected, ranked_action_ids, lower_confidence_gains, expected_costs, net_values, inadmissible, stopping_reason)[source]

Bases: object

One selected action or explicit stopping action with ranked evidence.

Parameters:
property stopped: bool

Whether the scheduler selected its explicit STOP action.

as_dict()[source]

Return a JSON-compatible decision receipt.

Return type:

dict[str, Any]

class ContextSchedulerConfig(confidence_z=1.645, latency_cost=1.0, token_cost=1e-05, monetary_cost=1.0, tool_call_cost=0.01, minimum_net_value=0.0)[source]

Bases: object

Confidence and resource exchange rates for value-of-information.

Parameters:
class ValueOfInformationScheduler(budget=None, config=None)[source]

Bases: object

Stateful context-action scheduler debited by actual execution receipts.

Parameters:
  • budget (ContextBudget | None)

  • config (ContextSchedulerConfig | None)

stop_decision(graph, reason)[source]

Create an explicit zero-work scheduling decision for termination.

Parameters:
  • graph (ContextGraph)

  • reason (str)

Return type:

ContextScheduleDecision

choose(actions, graph)[source]

Choose the highest positive net VOI action or stop explicitly.

Parameters:
  • actions (tuple[ContextAction, ...])

  • graph (ContextGraph)

Return type:

ContextScheduleDecision

record(receipt)[source]

Debit actual work once; rejected/rolled-back work still costs resources.

Parameters:

receipt (ContextActionReceipt)

Return type:

None

as_dict()[source]

Return cumulative actual context-construction spend.

Return type:

dict[str, Any]