yasmin.cb_state module

class yasmin.cb_state.CbState(outcomes: Set[str], cb: Callable)

Bases: State

CbState is a subclass of State that encapsulates a callback function which can be executed in response to a specific state.

Attributes:
_cb (Callable): A callback function that defines the action to take

when the state is executed.

Parameters:

outcomes (Set[str]): A set of possible outcomes for this state. cb (Callable): A callable that will be invoked when the state is executed.

execute(blackboard: Blackboard) str

Executes the callback function with the provided blackboard context.

Args:
blackboard: The context in which the callback will be executed.

This is typically an object that holds the necessary state or data for the callback.

Returns:

str: The result of the callback function execution.

Raises:

Exception: Propagates any exceptions raised by the callback function.