A first agent device for message routing with content passing and reference passing for a distributed system with a plurality of interacting agent devices (100, 201, 202, 203, 300) wherein the interaction between the interacting agent devices occurs through exchange of messages, an exchanged message including a content portion and a reference identifier associated with a particular agent device, the reference identifier enabling any other agent device to establish a communication with the particular agent device, the content portion having a type which is either a content sub-type or a message-set sub-type wherein the message-set sub-type allows to include a set of messages or aggregate message sets in the content portion of the message, the first agent device comprising: a first interface component configured to load a first agent class specification defining a first finite state machine which is configured to control the function of the first agent device when executed by a process execution engine; a second interface component configured to retrieve at least a subset of a plurality of messages (M2_1, M2_2, M2_3) from a message buffer, the plurality of buffered messages (M2_1, M2_2, M2_3) originating from a plurality of multi-agent devices (201, 202, 203) linked to a second agent class specification defining a second finite state machine wherein the first finite state machine and the second finite state machine enable the interaction of the first agent device with the plurality of multi-agent devices (201, 202, 203); at least one processor component configured to run the process execution engine and, in accordance with the first finite state machine, to process retrieved buffered messages (M2_1, M2_2, M2_3), to generate an aggregate message including at least a subset of the buffered messages (M2_1, M2_2, M2_3) in the aggregate message content portion having the message-set sub-type, and to provide, in accordance with the first state machine, the aggregate message for further processing to a further agent device, or to another agent operating the first agent device. a first interface component configured to load a first agent class specification defining a first finite state machine which is configured to control the function of the first agent device when executed by a process execution engine; a second interface component configured to retrieve at least a subset of a plurality of messages (M2_1, M2_2, M2_3) from a message buffer, the plurality of buffered messages (M2_1, M2_2, M2_3) originating from a plurality of multi-agent devices (201, 202, 203) linked to a second agent class specification defining a second finite state machine wherein the first finite state machine and the second finite state machine enable the interaction of the first agent device with the plurality of multi-agent devices (201, 202, 203); at least one processor component configured to run the process execution engine and, in accordance with the first finite state machine, to process retrieved buffered messages (M2_1, M2_2, M2_3), to generate an aggregate message including at least a subset of the buffered messages (M2_1, M2_2, M2_3) in the aggregate message content portion having the message-set sub-type, and to provide, in accordance with the first state machine, the aggregate message for further processing to a further agent device, or to another agent operating the first agent device.