I mean to quote Moses Mama for his post.
Kaji was trained the same way he was trained to do tricks, or potty in the right place. A small correction when he went too far, and praise when he stayed within the boundary. It's easier in doors because you don't have to leash them. Outside a leash is necessary. You can try a retractable leash outside. Keep play light and really, the job is mostly yours to know what can trigger your pup. You know he likes to say hi to the neighbors, or what can spook him. You have to be vigilant and be one step ahead of the pup.
Example, when Kaji is out playing in my friends yard, the owners are vigilant. We all watch our pups and watch our surroundings. As soon as we see a trigger, we get our dogs. We either pick them up, put them on their leashes, or put them all in a sit stay. It's really up tothe owner to create a safe environment inside or out. You really can't just sit down, kick back, and put that responsibility on your dog.