I found the solution after little digging of source. It can be get in following way. It seams this should be added to the RedBean document.
R::setup('mysql:host=localhost;dbname=t2odemo','root','');
$toolbox = R::$toolbox;
$redbean = $toolbox->getRedBean();