The spy has prepared their operation for a long time. The improvisation is always necessary as each mission depends on the on-going proceeding, but it is definitely well prepared beforehand. Each plot might be adjusted suddenly, but it is a process of the long-term goal, which is not a result of the idea on the spot.
The operation is intrinsically difficult, as it is meant to run a mission or manipulation normally unlikely, which is why it requires a time to prepare. Moreover, the operation can be easily revealed if not planned, as the spy fabricates it not to be uncovered.
On the other hand, the Japanese police intelligence run some of their operation easily spotted in Japan. That was actually true to the Chinese intelligence that they also run an apparent operation. They should have been confident to cover them up, as they also have kept the policing authority to oppress many people with ease.
The CIA has conducted their operation covertly in Japan, as it might create a social issue if revealed. This reality holds true to other countries that they have not directly controlled the authority of other countries, hence they prefer to run an operation without notice if possible. This even holds true to their home country, the United States, that they have no judicial power easily to cover up their operation. That was one of the reasons why they have not conducted their operation from the idea on the spot.
Their behavior is also linked to their legal immunity. If they run their operation out of the protocol, they might be prosecuted in the Japanese judicial system. They need to run their operation outside of this legal sanction, hence they behave more cautiously than normally assumed.
As a result, they should spend more time to run an operation without revealing a real identity or should prepare well enough even for an operation for the certain timeframe.
For example, one of the spies I met in the Southeast Asia said to me that he spent half a year to become an instructor from the scratch. This level of effort and preparation is sometimes required to have an access to their target as a cover. They can also prepare someone who is familiar with a diving in this case, though they should limit a choice of their operatives for that purpose.
On the other hand, assets of intelligence organization should conduct an operation which is more likely revealed, as they are a lack of the knowledge and well planning. They often try more improbable plot, resulting in their conduct out of control.