An integrated agent model for attention and functional state