Skip to main content

TokenLimitTerminator

Terminate agent if number of tokens reached to token limit threshold. Parameters:
  • token_limit (int): Token limit threshold.

init

_validate

is_terminated

Whether terminate the agent by checking number of used tokens reached to token limit. Parameters:
  • num_tokens (int): Number of tokens.
Returns: tuple: A tuple containing whether the agent should be terminated and a string of termination reason.

reset

Reset the terminator.