# Programming Agents by Their Social Relationships: A Commitment-Based Approach
## 3 Social Relationships as Commitments  
We propose to program the interaction between agents by explicitly representing the social relationships among them. In our view, social relationships should become resources that are reified as part of the environment; they should also be subject to _social control_, thus acquiring a normative and regulative value. For this reason, we rely on the notion of _social commitment_. A social commitment [9],represented as \(C(x,y,p,q)\), captures the fact that an agent \(x\) (debtor) commits towards an agent \(y\) (creditor) to bring about a consequent condition \(q\) when an antecedent condition \(p\) will hold. Antecedent and consequent conditions are generally expressed in _precedence logic_[31], an event-based linear temporal logic for modeling web services' composition. It deals with occurrences of events along runs (i.e., sequence of instanced events). Event occurrences are assumed to be non-repeating and persistent: once an event has occurred, it has occurred for the whole execution. The logic has three operators: \"\(\vee\)\" (choice), \"\(\wedge\)\" (co-occurrence), and \"\(\cdot\)\" (before). The _before_ operator allows constraining the order with which two events must occur; e.g., \(a\cdot b\) means that \(a\) must occur before \(b\), but the two events do not need to occur one immediately after the other. Commitments are proactively created by debtors, manifesting the agent capacity to take responsibilities towards bringing about some conditions autonomously. Moreover, commitments have a standardized lifecycle, formalized in [32] and summarized in Figure 1. As soon as a commitment is created, it is _active_. Active commitments can further be in two sub-states: _conditional_ when neither the antecedent, nor the consequent have occurred, and _detached_ as soon as the antecedent becomes true. A commitment is _violated_ either when its antecedent is true, but its consequent becomes false or when it is canceled by the debtor when detached. Conversely, it is _satisfied_ when the consequent occurs and the engagement is accomplished. It is _expired_ when it is no longer in effect; i.e., if the antecedent condition becomes false. Finally, a commitment becomes _terminated_ when the creditor releases the debtor from it or when it is canceled, being still conditional. Social commitments can be manipulated by the agents through some standard operations: namely, _create_, _cancel_, _release_, _discharge_, _assign_, and _delegate_[9]. _Create_ instantiates a commitment, changing its status from _null_ to _active_. Only the debtor of a commitment can create it. Conversely, _cancel_ revokes the commitment, setting its status to _terminated_ or _violated_, depending on whether the previous status was _conditional_ or _detached_, respectively. Again, only the debtor can cancel a commitment. The rationale is that a commitment debtor is allowed to change its mind about the accomplishment of the consequent only until the antecedent has not occurred, yet. _Release_, in turn, allows the creditor (and only the creditor) to terminate an active commitment. Release does not mean success or failure of the given commitment, but simply eliminates the expectation put on the debtor. _Discharge_ satisfies the commitment. In accordance with [9], we assume that this operation is performed concurrently with the actions that lead to the consequent occurrence. _Delegate_ changes the debtor of a given commitment and can be performed only by the new debtor. _Assign_, finally, transfers the commitment to another creditor and can be performed only by the actual one. An active commitment can be further suspended, i.e., put in the _pending_ status, by means of the _suspend_ operation. Conversely, _reactivate_ sets a pending commitment as active, again. Since a commitment can only be taken autonomously by a debtor towards a creditor on its own initiative, the agents' autonomy is preserved, and this aspect is fundamental in order to harmonize deliberation with goal achievement.