How long can they be sustained?
Indefinitely.
If it's economic to send billions of tons of food off planet, then they can also import billions of tons of fertilizer then they can ship back billions of tons of natural fertilizer (or a fraction of that if it's desiccated). IIRC Asimov's Tarantor even had that explicitly stated with ships coming to Tarantor laden with food, and leaving fool of fertilizer.
For that matter, asteroid mining for fertilizer would (assuming our system is typical) provide more than 1e15 tons of fertilizer. Even at a billion tons/year that will last for more than 100,000 years before needing to look for other sources.
The problem with Agri-worlds is not that they'd get depleted over time, it's that settings which have them pretty much never have the transport and other economic incentives to justify shipping billions of tons of food to other star systems (for example - StarTrek has the needed transport, but Replicators mean they have no reason to actually transport things like that).
I see Agri-worlds and pretty much any other single-industry world as the sign of a lazy writer. Planets are big and one populated enough to have large scale industry will be largely self-sufficient in terms of basic goods because space travel is neither cheap nor easy.
This, very much this.
There will be some food exported off-world. It'll mostly be part of the regular supply runs to places which don't have sufficient local agriculture (nearby space stations, small outposts, new colonies, &c), expensive luxury items, or disaster relief.
Not really, I'd think mostly it would be luxuries, basically the equivalent of Cavier, Safron(or other spices), cuban cigars, and expensive Champagne or other intoxicants.
It depends on the planetoid.
For example, Jupiter's moon, Titan, receives only 1% of the sunlight the Earth does, so using the surface area of the planet to grow crops would be a waste
Not really. In almost all SF settings the energy to transport food to somewhere like Titan would be less than the energy cost of growing it there (using artificial lighting of course, possibly hydrophonic or vertical farming).
(also the gravity weak enough it can't keep an atmosphere anyway).
Say what? Titan's atmospheric pressure is ~50% higher than earth's.
Agricultural worlds might also make sense if there is interstellar war going on.
Nope. Other way around. They make less sense in war because the last thing you want when you're fighting a war is critical supplies that need to be transported long distances.
Smelting enough steel to produce any given room will in turn release more oxygen than could ever reasonably fill that space.
THis is true on earth because pretty much all iron ore contains oxygen absorbed from the atmosphere. It is not true in most metalic asteroids and I would not assume it's true on [random planetoid]
You also have to look at energy concerns. A major problem with IRL urban farming is how much grow-lights can add to the electric bill, it turns out it's surprisingly hard to compete with sunlight for cost.
THat's when you don't have transport costs. If the urban farming had no, or very low transport costs(i.e if they didn't need to pack things and ship them to the store), and the sunlight based farm had high transport costs (for example if they needed to fly their produce in) the artificial lighting is much more economical.
Now maybe you're thinking "Oh, but they have superpower plants, energy won't be a problem, which is fair, but not the actual issue. It's heat.
That's not an issue on any planetoid or large asteroid, and not much of one on a large station. The amount of energy we're talking about is insignificant.
Human manure needs to be composted for at least a year, to kill off the harmful bacteria inside, same for manure of other omnivores like pigs and chicken.
Or it can be sterilized and processed much faster.