From 1975 to 1991, Cuba gave support to the socialist MPLA party in the form of soldiers and civil aid workers. From what I have read, the decision to do so was independent of Soviet influence, so it wasn't by proxy (although the Soviet did support the Cubans with logistics and transportation).
The official Cuban statement is that they were protecting Angolan from imperialists and the racists in South AFrica and they were fulfilling some sort of socialist internationalism. This sounds somewhat dubious, but the Cubans were also quite involved with the Angolan healthcare and education after its supremacy was secured, so it could be plausible.
I also have read that the Cuba were interested in the natural resources of Angola, and there was some sort of cooperation between the two. Cuba was affected by the US embargo and it did not want to rely solely on the Soviet Union for help.
Obviously the Cubans did not do it for free, they benefited somehow, but I am wondering if it was genuinely helping Angolan as part of their ideology or mostly helping for profit.
I wrote this answer on the very connected topic of Cuban medical diplomacy with another main focus on Cuban education in Angola.
Gonna add some additional points for your question (less on the military side):
First, medical diplomacy was very cost effective for Cuba in that training doctors and carrying out those specific operations are comparatively not that expensive, but bring many diplomatic advantages as I discuss there.
Second, on Angola: it was central to the failure of the educational exchange in Angola is that it took place during a decades-long civil war. This exceptional situation was certainly more important than possible planning from Cuba. It also makes any thoughts on supposed Cuban purposes border on speculation.
And third, the official position of Cuba was of course that this was mutual support, and support for a (then) communist party that Cuba wanted to further ideological ties with. But assuming that Cuba had merely its own interests here would be too easy: in addition to education and doctors, large numbers of Cuban military troops came to Angola. Among other things, they had a decisive influence on the victory over South Africa in the Battle of Cuito Cuanavale, the largest battle on African soil since the Second World War. So the education initiative should already be seen as part of a larger exchange, from which Cuba also benefited, but for which it also put a lot at risk (including troops).
As I mentioned in my answer, this Cuban commitment is particularly evident after Angola, sometimes without expecting direct economic benefits from it. The medical school used to teach students from all over the world for free is a good example of this - it is also about long-term diplomatic exchange and gain.
Hope this helps!