In a large bowl, cream together butter and sugar Gradually add the vanilla and eggs while mixing. Sift together the flour and baking powder; stir into the egg mixture. For plain biscotti, do not add anything else (see Cook's Note). Stir in the anise extract and anise seed. Add walnuts if desired.
Wet or grease your hands and shape dough out into 4 logs as long as your baking sheet will allow. Pat each one to about 3/4 inch in height, and 3 inches wide. Brush with beaten egg yolks.
Bake in the preheated oven for 15 minutes, until golden brown. Slice logs at an angle, cutting pieces into 1/2 to 3/4-inch wide cookies. Place slices back onto the cookie sheet, standing upright, if possible; leave a gap between the slices. Return to the oven and bake until cookies are dry and lightly toasted, about 10 minutes more.