Implement get method for AgentIndexAPI

This one should be a bit better than the last one: No tabs in indentations and the database query is simpler and faster.