An Agent Architecture for Planning in a Dynamic Environment