Ideally, Agapanthus are best grown in full sun but they will in fact grow in semishade.
Sometimes gardens do not present with the ideal conditions and if you do not have an area of full sun you can plant Agapanthus in semishade, but not deep shade.
The agapanthus in the image is growing at the base of a tree, ( so in dry soil) and in dappled shade. In this image, they are just coming into flower and put on a good show. Agapanthus may flower a little less in semi shade, but still worth planting.They are leaning towards the sun, which is inevitable. They they look lush under-planting the tree and would combine well Hostas and other perennials.
If you have an area of semi shade, as long as it gets several hours sun so it is definitely only semi shade, plant them out. If you are uncertain, try placing them in a container first and see how they grow and flower.
More about growing agapanthus.