Agent service discovery

—
> This code ... prints out "bar"

Yep. That's a completely standard idiom, used throughout the stdlib and lots of 3rd party code.