Semantic web services represent an important and actual research area in computer science. A very popular topic in this area is the composition of semantic web services, which can be used for obtaining new semantic web services from existing ones. Based on a representation method for the semantic descriptions of semantic web services, that we had previously proposed, we propose a multi-agent system for the composition of semantic web services based on complexity functions and learning algorithms. Our system starts as a semi-automatic composition system, but after it gathers (using learning algorithms) sufficient information about the knowledge domain in which it is used, the system is able to perform compositions of semantic web services automatically. Based on the previously proposed representation method, this paper describes the structure and the main algorithms of the proposed system. The paper also presents an example of using the proposed system and some experimental results.