Guzzle settings (base_url, user agent)
There is no need to create your own Client or ClientFactory service.

Because ClientFactory::fromOptions() has

$config = NestedArray::mergeDeep($default_config, Settings::get('http_client_config', []), $config);


You can specify default options to Guzzle for all clients created by Drupal via your settings.php.  Core only provides an example of proxy settings, but you could alter the user agent via

$settings['http_client_config']['headers']['User-Agent'] = 'Foobar 1.0';




To create a single client with different options, (which will override settings from both ClientFactory::fromOptions() and settings.php), you can use the factory service directly:

\Drupal::service('http_client_factory')-&gt;fromOptions([
  'headers' =&gt; ['User-Agent' =&gt; 'Foobar 1.0'],
]);