AI architecture: design patterns and best practices