The 'tools' property value can be an array or a jQuery object. You can create this 'tools' object programatically.
$('#pp').panel({
width:500,
height:150,
title:'My Panel',
tools: function(){
var t = $('<div></div>');
$.map([{
iconCls:'icon-add',
text: 'add tooltip',
handler:function(){alert('new')}
},{
iconCls:'icon-save',
text: 'save tooltip',
handler:function(){alert('save')}
}], function(tool){
var a = $('<a href="javascript:;"></a>').appendTo(t);
a.addClass(tool.iconCls).tooltip({
content:tool.text
}).bind('click', tool.handler);
});
return t;
}()
});