langgoap.MaxCostPolicy

langgoap.MaxCostPolicy#

class MaxCostPolicy(usd, name='MaxCostPolicy')[source]#

Terminate when world_state['total_cost_usd'] exceeds usd.

Users supply the bookkeeping — typically by emitting total_cost_usd from their action’s execute / aexecute return value, or by wiring a LangChain BaseCallbackHandler that accumulates per-call cost into the world state.

Parameters:
  • usd (float)

  • name (str)

__init__(usd, name='MaxCostPolicy')#
Parameters:
  • usd (float)

  • name (str)

Return type:

None

Methods

__init__(usd[, name])

should_terminate(state)

Attributes

usd

name