Is it possible to get a yaml-based pipeline to select a build agent based on it's availability? I know it's possible to use parameters to select from a set of choices, but I would like to use a self-hosted pool if available, otherwise use the Microsoft-hosted ones to reduce costs. I cannot guarantee my pool will be up 24/7 but while i'm working it would be great if it choose my self-hosted pool by default.
No this is not possible. There is a feature request on developer community - Allow agent pools to contain Microsoft hosted and self-hosted agents, but this is not implemented yet.