The MediaWiki account a bot is using at a wiki is its identity at this wiki.
Typically, the bot establishes its identity by going through a login process. After exchanging some info, the bot gets a set of cookies that tell the wiki at every exchange who is speaking. If the bot preserves these cookies between sessions, it may skip the login process.
Whether skipping the login is a good idea depends on the bot task. For a spell checking task whose session will go over many thousands of pages, the login traffic is negligible part of the total. For interwiki maintenance, where often one session consists of only one page edit, login traffic might be a significant part of the traffic, and avoiding it might be a good idea.
The Identity module allows handling the bot identity in the desirable way. It is able to cache and store the bot identity info (ie. cookies), and provides login and logout functions that will choose identification method according to its settings.
$always_login- whether to always login explicitly (overrides the standard settings). Default -
$login_attempts- number of attempts to make while logging in. Default - 5.
login ( $account, $wiki )- establish identity, by full login or cookies load only
logout()- withdraw identity