Moved agent code into the agent dir.