Ai architecture

#250