AI control in state machine