Like... the Castle Heterodyne talks to people? And plots their death if it doesn't like them? Sometimes there's a bit of an accident and Mechanicsburg runs itself for a generation or two until some lost Heterodyne heir shows up to take over the place again, and when they do, it's the Castle Heterodyne that recognizes them.
Van Rijn, the self-proclaimed "greatest Spark of all time", gave the Eight Muses as a gift to Andronicus Valois the Storm King, the self-proclaimed "greatest king of all time", and since then those sentient clanks have been advisors and historians to the Valois dynasties for centuries.
...or on a much smaller scale of Sparkdom, there's, like, building a big battle-clank and making it smart enough to keep fighting or possibly just run away if the pilot gets killed.