# Programming Agents by Their Social Relationships: A Commitment-Based Approach
## 4 A Conceptual Schema for Programming Agents with Social Relationships  
We believe that social relationships should be considered as first-class entities of any agent programming platform. When social relationships are directly available as programming constructs to agents and programmers, in fact, the resulting system enjoys some important software engineering properties. First, it is possible to standardize the agent programming activity by following a general schema that is independent of the specific agent platform at hand. In this section, we focus on the general schema, while its practical use is exemplified in the next sections. In particular, we focus on social relationships that can be seen as commitments and reify them as computational resources that can be directly used by agents. The conceptual architecture we propose is shown in Figure 3 where, to emphasize the generality of the programming schema, we abstract from any actual implementation and hence represent only classes without denoting fields and methods. The architecture encompasses both the classes that regard the agent being implemented (in yellow) and the classes through which commitments are made available (in blue). The rationale is that the programmer should be able to implement the agent code by only implementing the yellow classes, using the objects provided by the underlying commitment platform (in blue). We first explain the classes and relations concerning the commitment platform. Workspace abstracts the part of environment that is of interest for the agent at hand. The workspace will collect relevant pieces of information and resources such as events (see Event) and commitments (see Commitment). In particular, some events represent the occurrence of commitment state changes--for instance, the satisfaction of a commitment or its detachment--and, thus, they are relevant for some agent in the system. Such events belong to the class _social_ (see the specialization of Event by Social Event). Notice that an actual implementation of Workspace could maintain references of various types of resources, but in this conceptual architecture, we emphasize only those domain-independent classes that are essential for the reification of commitments and for the implementation of the agents. Figure 2: The logistic scenario. The class Commitment abstracts the reification of the social relationships into a resource that can be directly manipulated by the agents. In fact, by inspecting the Workspace, the agents can determine the set of possible commitments together with their current states. Agents who are debtors or creditors of a commitment can also operate upon them directly through commitment operations. This is made possible by the class Role, whose instances amount either to the debtors or the creditors of commitment instances. Commitments are also characterized by antecedent and consequent conditions, which are both abstracted by class Condition. Note that Condition is in relation to Event because the satisfaction or violation of a condition is seen as an event occurring in the workspace. In particular, thanks to the specialization Social Event, it is possible to specify commitments, whose antecedent or consequent conditions include operations on commitments. This allows the specification of nested commitments as commitments whose antecedent or consequent conditions amount to the creation of another commitment. All the explained classes represent the concepts that should be implemented by a platform providing social commitments as programming constructs. Their actual implementation, however, could require much more concrete classes. As an exemplification, in the following section, we will sketch the specific case of the 2 COMM library, and we will show how the very same platform can be interfaced with the JADE and with the JaCaMo agent programming platforms. Concerning the agent classes (in yellow in Figure 3), an Agent has at least one Goal that it wants to achieve, and it is equipped with at least one Social Behavior.