Skip to content

Scheduler

The scheduler manages wake-up timing and pattern interpretation for AI agents.

WakeUpScheduler

proactiveagent.scheduler.WakeUpScheduler

Python
WakeUpScheduler(provider: BaseProvider, config: Dict[str, Any], get_sleep_time_callbacks_func: callable = None, sleep_time_calculator: Optional[SleepTimeCalculator] = None)

Manages wake-up timing and pattern interpretation for AI agents

Initialize scheduler

Parameters:

Name Type Description Default
provider BaseProvider

AI provider instance

required
config Dict[str, Any]

Configuration dictionary

required
get_sleep_time_callbacks_func callable

Function that returns current sleep time callbacks

None
sleep_time_calculator Optional[SleepTimeCalculator]

Custom sleep time calculator (defaults to AIBasedCalculator)

None

start async

Python
start(wake_up_callback: Callable[[Dict[str, Any]], None], context_provider: Callable[[], Dict[str, Any]]) -> None

Start the wake-up scheduler

Parameters:

Name Type Description Default
wake_up_callback Callable[[Dict[str, Any]], None]

Function to call when waking up

required
context_provider Callable[[], Dict[str, Any]]

Function that returns current context

required

stop

Python
stop() -> None

Stop the wake-up scheduler

update_config

Python
update_config(new_config: Dict[str, Any]) -> None

Update scheduler configuration

Parameters:

Name Type Description Default
new_config Dict[str, Any]

Dictionary containing configuration updates

required

set_sleep_time_calculator

Python
set_sleep_time_calculator(calculator: SleepTimeCalculator) -> None

Update the sleep time calculator

Parameters:

Name Type Description Default
calculator SleepTimeCalculator

New sleep time calculator to use

required

interrupt_sleep

Python
interrupt_sleep() -> None

Interrupt the current sleep to trigger immediate recalculation