Agapanthus like a rich soil and a warm sunny position during the growing season. I had the same problem with lack of flowers last year but have since followed RHS advice which seems to work:
- keep container grown plants in a cool, light position over winter, avoiding excessively wet or excessively dry conditions;
- warmth in winter may lead to early flowering but it will be of poor quality;
- in the growing season, water well and give container plants a liquid feed (e.g. seaweed solution) fortnightly until the flowers have developed;
- too much shade can lead to lush foliage at the expense of flowers: aim for good light for at least half the day and avoid dense shade under trees;
- divide every 4 to 6 years or when flowering appears to deteriorate, but be aware that dividing plants may lead to reduced flowering.
Setting seed does not appear to reduce flowering.
Hope this helps.