In Russia, receiving any funding of any kind from outside Russia (say, a $5 donation to an open source project) makes you a "foreign agent".
However, there is a second pillar: the agent has to " engage in political activities, gather information on military capabilities, or create and disseminate information intended for a broad audience." Which is why eg Gazprom is presumably not a foreign agent.