Special equipment: One 11 1/2-by-8-inch rectangular tart pan with a removable base. One 2-inch shaped cookie cutter, such as a heart or leaf.
Place an oven rack in the center of the oven and preheat to 425 degrees F. Liberally butter the tart pan.
For the crust: Pulse the all-purpose flour, almond flour and salt in a food processor. Add the butter and pulse until the mixture forms a coarse meal. With the food processor running, gradually add the iced water until the mixture forms a ball. Add extra water 1 teaspoon at a time, if the mixture is too thick. Form the dough into an 8-by-3-inch rectangle and wrap in plastic. Refrigerate for 30 minutes.
Roll the dough into a 14-by-10-inch rectangle on a lightly floured surface. Place the dough in the tart pan and trim any excess dough from the top of the pan. Reserve the excess dough. Prick the dough all over, using the tines of a fork. Bake until the crust is light golden, about 15 minutes. Cool for 10 minutes.
For the filling: Combine the butter, almond paste, eggs, flour, agave and almond extract in a food processor. Blend until smooth. Spread the filling evenly over the cooled crust, using a spatula.
In a medium bowl, toss the raspberries and agave together until coated. Gently press the raspberries into the filling in a single layer.
On a lightly floured work surface, roll out the excess dough into an 8-inch circle, about 1/8-to-1/4-inch thick. Cut out pieces of dough using a cookie cutter and place randomly on top of the raspberries. Brush with the beaten egg. Bake until the filling is slightly puffed and the pastry is golden, about 25 minutes. Cool completely on a wire rack, about 1 hour. Refrigerate for at least 1 hour before serving.
Cut into slices and serve.