Agent programming via planning programs