Adding documentation, making repository_key methods more consistent in order, stubbing in Agent run loop