Initial refactoring to use SQLite backend

Settings and two agent classes now using SQLite backend. Remainder of
agents are next.