Pod the white beans, trim the green beans, peel the potatoes, carrots and onions. Cut all of the vegetables into small cubes, place them in a pot, cover them with twice their volume of water, bring to the boil and cook gently for 1 hour.
Add the spaghetti, broken up beforehand in a cloth, cook for a further 15 minutes, season and serve with the pistou.