# Programming Agents by Their Social Relationships: A Commitment-Based Approach
## 5 2 COMM: An Infrastructure for Programming Social Relationships
### Modeling the Environment
_Notification of social relationships of interaction_: Commitment artifacts specialize CArtAgO artifacts because they implement the commitment lifecycle. Any change of state in the artifact, thus, corresponds to a change in the interaction state. For this reason, we can state that 2 COMM enables a form of automatic notification about social relationships that is not provided either by JADE or by JaCaMo. _Interaction/agent logic decoupling_: In JADE and JaCaMo, no specific abstractions are used for modeling and implementing the interaction logic. In JADE, agents interact by exchanging messages. In JaCaMo, agents can modify an artifact for communicating with others. In both cases, however, the semantics of the message or of the artifact operation must be encoded within the interacting agents. In 2 COMM, instead, the semantics of the interaction is given in terms of commitments. Therefore, when an agent acts upon the environment (e.g., pays for some goods), the meaning, and implications, of such an action is modeled via a state change occurring in a specific commitment. It follows that the logic of \begin{table}
\begin{tabular}{l c c c c} \hline \hline  & **JADE** & **JADE +** & **JaCaMo** & **JaCaMo +** \\  & & **2 COMM** & & **2 COMM** \\ \hline Programmable interaction means & X & ✓ & ✓ & ✓ \\ Notification of social relationships of interaction & X & ✓ & X & ✓ \\ Interaction/agent logic decoupling & X & ✓ & X & ✓ \\ Expected behaviors reasoning & X & ✓ & X & ✓ \\ Definition of structured schemas for interaction & ✓ & ✓ & X & ✓ \\ Runtime interaction monitoring & X & ✓ & ✓ & ✓ \\ Agent programming aware of social relationships & X & ✓ & X & ✓ \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Comparison among JADE, JaCaMo, and improvements provided by an explicit representation of social relationships. the interaction is not spread inside the agent code, but within the commitment artifacts. The 2 COMM agents need just to possess the proper behaviors/plans for handling the commitment lifecycle. _Expected behaviors reasoning_: As we have said, commitments have a normative power since they allow an agent to create an expectation about the behavior of others. The debtor of a commitment is expected by the creditor to bring about the consequent condition when the commitment will be detached. The debtor, in turns, creates a commitment because it anticipates that the creditor will be interested in the consequent condition and hence will be moved to detach the commitment. This mechanism of expectations is at the basis of the general schema of agent programming that we have proposed. Neither JADE nor JaCaMo can rely upon an analogous mechanism. _Definition of structured schemas for interaction_: As pointed out above, expectations allow us to define a general schema for programming agents that is independent of the agent-platform since it only depends on the lifecycle of commitments. _Runtime interaction monitoring_: Although we have not discussed this aspect in detail, 2 COMM facilitates the implementation of monitors that supervise the whole interaction occurring in the system. It would be sufficient, in fact, to have an agent monitoring each commitment artifact of a workspace and hence capturing every change of state in the commitments. Of course, this is a direct consequence of having social relationships explicitly modeled as first-class elements and not implicitly modeled via message passing as in JADE. In JaCaMo, a monitor could also be implemented as an observer of the artifacts in the environment. _Agent programming aware of social relationships_: The proposed programming schema guides a programmer in developing an agent that is aware and compliant with its engagements. In particular, the _Cooperate_ schema helps a programmer identify what social events are relevant for the agent being implement and what is expected of the agent given its engagements. ## 7 Discussion and Conclusions

In this work, we have presented a general schema for programming socially-responsive agents.