Why did Italy join the Allies in WWI and what agreement was made?
Italy joined the Allies in WWI (even though it had previously had a treaty with the Central Powers) for one reason—it wanted territory. By the time Italy entered the war in May of 1915, it had decided that joining the Allies was the best way for it to get the territory it wanted.
Before Italy became a unified country in 1870, various parts of what is now Italy belonged to other countries. Most importantly for this discussion, Austria-Hungary controlled parts of Italy. After Italy unified, Austria-Hungary continued to control some areas that Italy thought should belong to it. Italy wanted those territories.
Italy initially sided (before the war) with the Central Powers because it was angry with France. It felt that an alliance with Germany and Austria would help it achieve its ambitions of gaining an empire in Africa. However, many Italians did not like being allied with Austria since that empire held what they felt was Italian territory.
When the war broke out, Italy did not join. It negotiated with the Allies until it made a deal it found acceptable. This deal was the Treaty of London (or London Pact), which promised that Italy would get the Austrian territory it wanted if it participated in the war.