Building AI Agent Systems: Principles and Practice