Existing massively multi-agent systems are aimed at handling tens of thousands of agents on a single server or a computer cluster. To this end, the agents are implemented as a data structure on the server to run at high speed. However, in future IoS/IoT environments, it will be necessary to deploy agents to distributed servers. Therefore, we propose a two-layered architecture consisting of macro-agents and micro-agents: the former controls the distributed environment and the latter solves the problem cooperatively. The macro-agents pre-installed on servers form a self-organized network by communicating with neighbor macro-agents. On the other hand, micro-agents are implemented as data structures on the server and solve problems under control of the macro-agents. An example scenario is presented to illustrate how to apply the proposed architecture to driving assistance with environment-embedded sensors.