Limits#

class scikitplot.agent.Limits(max_steps=16, max_tool_calls=None, max_cost=None, max_tokens=None, max_seconds=None)[source]#

Stopping conditions: when a run stops, whatever the planner proposes.

Parameters:
max_stepsint, default=16

Planner decisions. Required and finite: it is what makes every run end (invariant I1).

max_tool_callsint or None, default=None

Tool calls; an action beyond them is denied at the Budget gate.

max_costfloat or None, default=None

Budget units: tool costs plus the cost the planner reports. An action whose tool would pass it is denied; at or past it, no further decision is asked for.

max_tokensint or None, default=None

Model tokens the planner reports. Every decision must then report its Usage (invariant I7).

max_secondsfloat or None, default=None

Running time, summed over the run’s sessions (time waiting for an approval does not count). Checked before each decision and each tool call; a call already running is not interrupted.

Raises:
TypeError, ValueError

If a limit is not a positive finite number of the right kind.

Parameters:
  • max_steps (int)

  • max_tool_calls (int | None)

  • max_cost (float | None)

  • max_tokens (int | None)

  • max_seconds (float | None)

Examples

>>> from scikitplot.agent import Limits
>>> Limits(max_steps=8, max_cost=10.0).max_cost
10.0
max_cost: float | None = None#
max_seconds: float | None = None#
max_steps: int = 16#
max_tokens: int | None = None#
max_tool_calls: int | None = None#
to_dict()[source]#

Return a JSON-compatible mapping.

Return type:

dict[str, Any]