The Photo Agent process you are seeing within the Activity monitor is the macOS photo sharing agent. It's primary responsibility is to manage and handle the iCloud Photo Library, My Photo Stream, iCloud Photo Sharing and Siri vocabulary sync activity for Photos. It also seems that Photo Agent is used in conjunction with other applications (including third-party applications built within Apple's MacOS development guidelines) that render supported media types.
Due to the nature and versatility of Photo Agent, it's hard to determine or investigate what exactly is causing the CPU utilization to reach a level to where your CPU cores (and most likely, other internal components) to become so hot, that the fans are constantly running. If you imported a batch of photos or videos either manually on your MacBook Pro or via iCloud and see photoanalysisd, photolibraryd, and/or the Image/Video Conversion Service active within Activity Monitor, alongside the Photo Agent process; it's likely that is the reason the agent is in maximum overdrive. Photo Agent has a set of instructions on how and when to run that is controlled by MacOS, you cannot simply kill the process and expect it remain in that state. It should be noted that are are variety of reasons to why Photo Agent may be running and utilizing the majority of your processing power. Photo analysis, lexical analysis, content analysis, search engine indexing, natural language processing, cache processing, database caching and hash functions are just a few things that could be occurring.
I've been researching Photos 3.0 to identify ways to increase processing times of key function. Throughout my research, I have discovered a common issue amongst Photos' users who are unable to achieve and/or maintain the recommended Internet connection bandwidth while the agent's process is in progress. Many of the great features that integrates Photos and iCloud are programmed to make use of an adaptive scheduling algorithm. However, some of the property default values for the agent is where I suspect the problem begins. I have a huge hunch, alongside a bit of data to at least validate that hunch, that at the very least - this is the main contributing factor to Photo Agent's high CPU utilization.
There are quite a few solutions to your specific issue, but I will provide one, that is least likely to be configured incorrectly by accident, simple to revert back the change and has the least amount of impact to the intended functionality of Photos with iCloud capabilities. The solution, is to alter the task priority of the Photo Agent process while it's running. You can achieve this a few ways, but my recommendation would be to use the built-in MacOS maintenance command, renice:
Step 1: Identify Photo Agent's Process Identification Number
Locate the Photo Agent process within the MacOS Utility - Activity Monitor (How to use Activity Monitor on your Mac)
Once located, make note of the Process Identification (PID)
In this example, the Photo Agent's PID is 1679. The PID for Photo Agent on your Mac may be different and usually changes when the process is killed or exited.
Step 2: Review Photo Agent's Current Task Priority Using It's Process Identification Number
Run the process status command in the MacOS Utility - Terminal (Terminal Help) with the options display process information, including nice (NI), with the Photo Agent's PID
ps -fl -C PID
The command "man ps" can be run in terminal for the Process Status manual.
From the output, locate the "NI" column and make a mental note (or write down) the integer within it's column.
If the aspect ration of Terminal's GUI isn't wide enough, the output may be misaligned and a little difficult to match the columns with the column headers. Adjust the window size accordingly or count the columns to the row. Note: The default nice for all MacOS processes is usually 0.
Step 3: Change Photo Agent's Task Priority
Using renice, change the Photo Agent's priority by increasing it with an integer greater than 0
sudo renice -n INCREMENT -p PID
The command "man renice" can be run in terminal for the renice manual.
Caution: Ensure that the nice value provided is a positive integer. Assigning negative nice values (below 0) to processes could potentially crash MacOS if critical system processes lose their priority.
Caution: The usage of sudo in this context will execute the command as root (also known as super user). Although harmless in this particular situation, using it with other commands that you are not familiar with could be potentially dangerous.
Step 4: Verify Photo Agent's New Task Priority (Repeat Step 2)
Verify Photo Agent's new priority by running the process status command in the MacOS Utility - Terminal with the options display process information, including nice (NI), with the Photo Agent's PID
ps -fl -C PID
This solution should take effect immediately. If Photo Agent's CPU utilization was high during the time of deprioritization you should see a drop in it's usage. How significant is dependent on how large the increment value was for prioritization when completing step 3, other processes that are running and other system-level prioritization for all processes.
Pro Tip: This solution can also be applied to the photoanalysisd and photolibraryd processes.
- Johnathan Maravilla
iPhone X - 256GB
AirPods
Apple Watch Series 1 - 42mm
Apple Watch Edition 18k Gold - 42 mm
MacBook Pro TB (15-inch, 2017) - i7 4.1GHz/16GB/Radeon Pro 560
MacBook Pro (15-inch, 2016) - i7 3.8GHz/16GB/Radeon Pro 460
MacBook Pro (15-inch, 2015) - i7 4.0GHz/16GB/Radeon R9 M370X
iMac (Retina 5K, 27-inch, Late 2015) - i7 4.2GHz/32GB/Radeon R9 M395X
Mac Mini (Late 2012) - i7 3.3GHz/32GB/27-inch Thunderbolt Display
Apple TV 4K - 64GB
Apple TV (2015)
High Sierra 10.13.4
iOS 11.3.1
Photos 3.0