Used for something that happens after a short passage of time, often in narrative sequence. It sounds a little more written or storytelling-like than very plain すぐ or まもなく.
空が暗くなり、やがて雨が降り出した。
The sky grew dark, and before long it began to rain.
Soon the train pulled into the platform.
Used before an amount of time or quantity to mean that it is approaching that amount. This use is more limited than the basic temporal sense.
It has been nearly ten years since I came to this town.
eventually; finally; in the end
Marks the outcome reached after time, change, effort, or a sequence of events. Compared with ついに, やがて is less emphatic and more about natural progression over time.
He failed many times, but eventually succeeded.
The small shop eventually became a company known throughout the country.
Before long, the cherry blossoms will probably bloom too.
He eventually became able to speak in front of people.
Eventually, the time for parting came.
It's been nearly a year since she was hospitalized.
やがて has a slightly literary, narrative feel and can imply a longer stretch of time than もうじき.
Outdated kanji usage; modern writing normally uses やがて.