An Agent-based Approach for Building Complex Software Systems