A Juju agent is software that runs on every Juju machine. There is a machine agent that operates at the machine level and a unit agent that works at the application unit level. Thus there are typically at least two agents running on each regular (non-controller) machine: one for the machine and one for a deployed application/charm. The controller normally has a single machine agent running.
A machine agent manages its respective unit agents as well as any containers that may be requested on that machine. In particular, it is the machine agent that creates the unit agent. The unit agents are responsible for all charm related tasks.
In general, all agents track state changes, respond to those changes, and pass updated information back to the controller. A model’s status (
status command) is built up from the communication between a controller and all the agents running in that model. Agents are also responsible for all logging that goes on in Juju (see Model logs for details).
The agent’s software version is generally consistent across a controller (and its models) and is thus determined at controller-creation time. By default the agent uses the same version as that of the local Juju client but this can be tweaked if desired. See Agent versions and streams for how to do this.
An agent is managed manually by accessing the machine it’s running on and referring to its systemd service. For example, to restart the machine agent on machine ‘2’:
juju ssh 2 sudo service jujud-machine-2 restart